BuddyDev

Search

Hiding users that have no avatars (mystery men) in the Recently Active widgets

  • Participant
    Level: Enlightened
    Posts: 46
    Kristian Yngve on #28266

    HI Brajesh Singh,

    What would the php code be to Hide users that have no avatars (mystery men) in the Recently Active widgets press?

    Screenshot:

    https://prntscr.com/rg4pp8

  • Keymaster
    (BuddyDev Team)
    Posts: 24706
    Brajesh Singh on #28267

    Hi Kristian,
    BuddyPress does not store the avatar presence in database.

    You will need some way to track it.

    Our plugins
    – BuddyPress Users with uploaded avatar
    – BuddyPress Force Profile Photo
    – BuddyPress profile Completion

    track the avatar status in meta, if you have any of these, Please take a look here for solution

    https://buddydev.com/support/forums/topic/members-without-profile-picture/

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 46
    Kristian Yngve on #28275

    I have the BuddyPress Force Profile Photo plugin, but the bots just sit there in in recently active after sign up with mystery man avatars.

    It’s good that they cannot do anything 🙂 but bad that they fill up the recently active buddypress widget 🙁

    I will look at the other suggestions and link now too.

  • Participant
    Level: Enlightened
    Posts: 46
    Kristian Yngve on #28276

    Ah! Your link looks like it is my case! 🙂

  • Participant
    Level: Enlightened
    Posts: 46
    Kristian Yngve on #28283

    Ah it doesn’t work for me sadly:

    The php:

    add_action( 'bp_after_has_members_parse_args', function ( $args ) {
    
    	if ( bp_is_members_directory() ) {
    		$args['meta_key']   = '_has_avatar';
    		$args['meta_value'] = 1;
    	}
    
    	return $args;
    } );

    still shows the users in the recently active despite having the BuddyPress Force Profile Photo plugin.

    Any suggestions on what I can do the the code?

  • Keymaster
    (BuddyDev Team)
    Posts: 24706
    Brajesh Singh on #28296

    Hi Kristian,
    The force profile photo uses a different key.

    Please use the following code instead

    
    add_action( 'bp_after_has_members_parse_args', function ( $args ) {
    
    	$args['meta_key']   = 'has_avatar';
    	$args['meta_value'] = 1;
    	
    
    	return $args;
    } );
    
    

    Please let me know if that works or not?

    Regards
    Brajesh

You must be logged in to reply to this topic.

This topic is: not resolved