Skip to:
Content
Pages
Categories
Search
Top
Bottom

Inserting BP Avatars with shortcode.


  • Kristian Yngve
    Participant

    @kristianngve

    WordPress 4.5.3 running.
    BP Press: Version 2.5.10.
    WordPress as a directory, it’s in root.
    I have some custom functions in a child bp-custom.php.
    I’m running bbPress (standalone), Version 2.5.10.
    __________

    So, I’m looking at inserting BP Avatars (which would display the logged in user) with short-code. After some research, I understand BP doesn’t have any native BP short-codes, and you have to therefore make them yourself, granted.

    This is how I guess it used to work (back in good old 2011, that is…):

    THIS GOES IN THE FUNCTIONS.php:

    function logged_in_user_avatar_shortcode() {
    if ( is_user_logged_in() ) {
    global $current_user;
    get_currentuserinfo();
    return get_avatar( $current_user->ID );
    }
    }
    add_shortcode(‘logged-in-user-avatar’, ‘logged_in_user_avatar_shortcode’);

    ***And the shortcode to go anywhere in your content is: [logged-in-user-avatar]

    ———

    Any ideas what on what would work now?

    Kristian.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar