BuddyDev

Search

[Resolved] Shortcode for displaying avatar of profile you're currently viewing?

  • Participant
    Level: Enlightened
    Posts: 30
    Rojo on #30552

    Hi. I’m trying to build custom BuddyPress profiles using a pagebuilder (Divi) and BuddyPress-specific shortcodes.
    It’s semi-working by combining Divi’s theme-builder capabilities to create custom headers (where I can display the user’s name with whatever design I want) with the default data that BP displays below that (and re-styling with CSS). However I also want to somehow display a member’s avatar in the custom header space. (This would replace the default single member profile header, which I would hide).

    I need a way (shortcode or whatever) to display the avatar of the member profile that a user is currently looking at. I tried using the BP Profile Shortcodes Extra plugin, but the [bpps_profile_avatar] shortcode there seems to either display YOUR id (when logged in), or a specific member id. But I need a “variable” shortcode that would dynamically get the id of the member currently being viewed. I can’t seem to figure out how to do that (or maybe I’m using the shortcode wrong, but I’ve tried every combination of possibilities it offers).

    Anyone have any suggestions? Thanks in advance.

  • Keymaster
    (BuddyDev Team)
    Posts: 24697
    Brajesh Singh on #30583

    Hi,
    Thank you for teh question.

    I had a look at the plugin.

    You can pass

    
     displayed="Yes"
    

    to show the avatar of the displayed user.

    Example

    
    
    [bpps_profile_avatar displayed="Yes"]
    
    

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 30
    Rojo on #30597

    Thanks for the reply, Brajesh! Unfortunately I already tried this, and it only displays the current logged in user’s avatar, no matter which profile you go to. So it’s always the same one (your own).

    Anyone have other suggestions of how I can make this work to display the avatar of the person of who’s profile I am currently viewing (rather than always my own)?

    Thanks

  • Keymaster
    (BuddyDev Team)
    Posts: 24697
    Brajesh Singh on #30606

    Hi,
    Please let me know the way you are using it. It seems that might be incorrect.

    I put the code in sidebar text widget and test for 4 profiles. It showed me their avatars correctly when I visited user’s profile.

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 30
    Rojo on #30626

    Interesting. When I put the shortcode in a sidebar text widget like you did, it works as intended.

    Originally I put it within a text module in Divi. Other BP shortcodes were working there, so I assumed this one would to – but for some reason it doesn’t (at least the specific thing I needed).

    Thanks for testing this. I will have to display avatars with a Divi sidebar widget now, which seems odd – but I guess whatever works, right?

  • Keymaster
    (BuddyDev Team)
    Posts: 24697
    Brajesh Singh on #30633

    Hi,
    I do not use Divi currently, so I am not sure why that did not work. As far as I understand that shortcode is correct and works. So, I will suggest checking with Divi team for any issue.

    Regards
    Brajesh

You must be logged in to reply to this topic.

This topic is: resolved