This topic has 29 replies, 12 voices, and was last updated 10 years by abidjan-loves.

  • Author
  • #7376
     hughm
    Participant

    I would like to hide member profiles that have not uploaded an avatar from the member directory. I have tried BP Registration Options but it has a lot of problems. Any idea how to keep a clean Member Directory without the blank avatar profiles showing?

    #7416
     IamJAX
    Participant

    Similar question

    https://archived.seventhqueen.com/forums/topic/only-show-members-with-avatars

    This is not something that can be done easily since WP does not store Avatar on DB.

    I am also looking for similar functionality since the carousels on this theme on home page looks better by showing users only with avatar.

    #7425
     IamJAX
    Participant

    This filters the members carousels under search box. But does not remove the users without avatar from the top member section showing recent, popular etc.

    Would be nice to have this feature buiilt into theme. Hope it will be addded to a future update.

    #7428
     hughm
    Participant

    Thanks a lot. Looks great. I will test it out today.

    #7438
     SQadmin
    Keymaster

    Thanks @IamJAX for sharing

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #8902
     dentwo
    Participant

    i tried the above code … but it didn’t work for me 🙁

    any other solution?

    also, if anyone knows of any plugin which allows anyone (not restricted to user only) to review the members?

    thanks so much

    #8957
     Abe
    Keymaster

    You can try http://wordpress.org/plugins/bp-registration-options/

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    #9024
     mpitka
    Participant

    @IamJAX This code does not work. I get an error: Parse error: syntax error, unexpected T_STRING in /homez.755/boorntdk/www/wp-content/themes/sweetdate-child/functions.php on line 261

    ideas? 🙂

    #9119
     Abe
    Keymaster

    I updated @IamJAX code. now it should be fine

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    #9147
     mpitka
    Participant

    Thank you @Abe

    I understood this code wrong. I thought that it will remove only these profile pics from “latest registered members” -carousel from frontpage. Is there an easy way to modify it so?

    #9195
     Abe
    Keymaster

    Hi, not so easy.. you need to modify the default shortcode in a way to include only members with avatar

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    #9225
     mpitka
    Participant

    Hi!

    Okay, It just does not look so attractive when there’s so many profiles without avatar. Hope there’s coming fix soon!

    🙂

    #11945
     gcarlos8377
    Participant

    This code causes an issue with the activity feed page. No updates are reflected on the activity feed once this code is used. This happend to me. Hopefully this info helps someone in this forum.

    #12536
     frien337
    Participant

    I just tried this too and it breaks my site 🙁

    #12633
     Abe
    Keymaster

    @frien337, it breaks your site because you have copied it or added it in a bad way

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    #12656
     frien337
    Participant

    Thanks Abe. As Home Simpsonm says: “Doh!!!”. It works fine now but there is an issue with the activity wall. As gcarlos8377 mentioned, it stops it from showing any updates.

    Does anyone know anything about this?

    Thanks

    #12780
     Abe
    Keymaster

    We haven’t tested that

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    #12996
     frien337
    Participant

    Np’s Abe, by when do you guys reckon you’ll have it tested?

    #13179
     Abe
    Keymaster

    We will try next week, Cheers

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    #14246
     rudik2
    Participant

    Why hide user profiles without photos? You thus lose customers.
    Better display on the home page (carousel, newest, popular etc.) only profiles with photo thumbnails and in the search member results first profile with a photo.

    Users without a profile picture will be motivated to add a photo, because they notice that finding their profile will be difficult. The search results will be far.

    Sorry for my english 🙂

    #14252
     harryshapes
    Participant

    i agree with rudik.. but also agree with the first question – theme would be great to have members profile pics shown first 🙂

    btw does anyone know how to shut off the pop up login.. its stopped working for me and members cant log in.. can only login via the wp-admin set login page 🙁

    #14270
     rudik2
    Participant

    summa summarum members profile pics and newest first

    #14337
     abidjan-loves
    Participant

    STOP !!! Well This code causes an issue with the activity feed page.
    when once this code is used , no updates are reflected on the activity page.
    How can I solved this issue ? thx

    #14658
     Abe
    Keymaster

    We haven’t tested that code but we will do that and see if we come with a better solution

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    #15234
     ideasbydesign
    Participant

    Any Luck with this code?

    #15504
     Abe
    Keymaster

    This code added to sweetdate-child/functions.php works. we will add this as an option in Sweetdate settings in future versions:

    COPY CODE
    
    //Hide members without avatars 
    add_action( 'bp_core_delete_existing_avatar', 'log_avatar_deleted' );
    add_action( 'xprofile_avatar_uploaded', 'log_avatar_uploaded' );
    
    //on new avatar upload, record it to user meta
    function log_avatar_uploaded(){
    	update_user_meta(bp_loggedin_user_id(), 'has_avatar', 1);
    }
    
    //on delete avatar, delete it from user meta
    function log_avatar_deleted($args){
    	if($args['object']!='user')
    	return;
    	//we are sure it was user avatar delete
    	//remove the log from user meta
    	delete_user_meta(bp_loggedin_user_id(), 'has_avatar');
    }
    
    function modify_loop_and_pag($qs, $object=false) {
    	global $wpdb;
    	$include = '';
    
    	if( $object != 'members' )//hide for members only
    	return $qs;
    	
    	$subscribers = $wpdb->get_results("SELECT user_id FROM {$wpdb->usermeta } WHERE meta_key='has_avatar'" , ARRAY_N );
    	foreach($subscribers as $subscriber){
    		$include = $include . "," . $subscriber[0];
    	}
    
     $args = wp_parse_args( $qs );
     
     //check if we are listing friends?, do not apply in this case
    
     
     if( !empty( $args['include'] ) ) {
    	$args['include'] = $args['include'] . ',' . $include;
     }
     else {
    	$args['include'] = $include;
     }
     
     $qs = build_query($args);
    
     return $qs;
     
    }
    add_action( 'bp_ajax_querystring' , 'modify_loop_and_pag', 25, 2 );
    
    function current_user_has_avatar($id) {
    	global $bp;
    	if ( bp_core_fetch_avatar( array( 'item_id' => $id, 'no_grav' => true,'html'=> false ) ) != bp_core_avatar_default( 'local' ) ) {
    		return true;
    	}
    	return false;
    }
    
    // ATTENTION
    // This code should be deleted after first site load with the code
    //
    function init_avatar_meta(){
    	global $wpdb;
    	$ids=$wpdb->get_col("SELECT ID FROM $wpdb->users");//we don't need to check for meta value anyway
    	foreach( $ids as $id ){
    		if( current_user_has_avatar($id) ){
    			update_user_meta( $id, 'has_avatar', 1 );
    		} else {
    			delete_user_meta( $id, 'has_avatar' );
    		}
    	}
    }
    add_action('init', 'init_avatar_meta'); 
    
    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    #15537
     ideasbydesign
    Participant

    Hi Abe,

    Thanks for your reply.

    I have added it to my functions.php file and the code is working fine!

    I appreciate your help. Keep up the good work sweetdate is an excellent site.

    Kind regards

    Matt

    #15538
     Abe
    Keymaster

    Glad to hear that.
    Thank you

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    #16233
     frien337
    Participant

    Thanks Abe, it works wonderfully 🙂 One good feature to have (for the future) would be to allow a user to choose to show all profiles regardless of there being a photo or not – it could be good for people who want to see more members in the members list area.

    #16235
     abidjan-loves
    Participant

    really good! thanks @Abe for this update

Viewing 30 posts - 1 through 30 (of 30 total)

The topic ‘Hide Members Without Avatars’ is closed to new replies.

Log in with your credentials

Forgot your details?