Group Mods

  • Profile picture of @mercime
  • Profile picture of r-a-y
  • Profile picture of Hugo

Only Show Members with Avatars (5 posts)

Started 1 year, 4 months ago by: Chelsea

  • Profile picture of Chelsea Chelsea said 1 year, 4 months ago:

    I’m trying to build a custom plugin/widget with most recently active members, but I only want to show those members that have uploaded a custom avatar. I’ve been told this is not possible without rewriting the core of BuddyPress. Has anyone done this? If so, how?

  • Profile picture of Boone Gorges Boone Gorges said 1 year, 4 months ago:

    I have done something similar. The reason why you can’t do it automatically is that avatar information is not stored in the database. You can get around this by creating some database content corresponding to avatars. There is a do_action hook near the end of the avatar upload process. Hook your own custom function to that hook that saves a has_avatar metadat item in the usermeta table using update_user_meta(). Then, in your widget bp_has_members loop, either load up a bunch of members and filter out the ones without avatars, or filter the sql queries themselves to make sure you only get members who have the has_avatar metadata. Not super straightforward, but definitely possible.

  • Profile picture of Chelsea Chelsea said 1 year, 4 months ago:

    Hey Boone, Thanks for the quick reply. We’ll try that. :)

  • Profile picture of Alicethai Watt said 10 months, 1 week ago:

    Boone, can you please explain this for all the noobs?! In a step-by-step way, with code examples etyc :)
    Thanks!

  • Profile picture of notlaura notlaura said 7 months, 1 week ago:

    @Watt – I’m looking for something similar and found this article: http://wpmu.org/how-to-create-a-gallery-of-members-avatars-in-buddypress/

    Hope that helps!