BuddyDev

Search

BuddyPress Auto Friendship Pro + BuddyPress Featured Members Feature Suggestion

  • Participant
    Level: Guru
    Posts: 900
    Tosin on #45119

    Hello,

    Can you consider adding a feature to auto friend or auto follow featured members when Featured Members plugin is active.

    Thanks

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

    Hi Tosin,
    Thank you for the suggestion.

    can you please tell the intent on the request. Do you want new user to be friends with all the feature members or do you want the user who is being featured to be friends with other member matching the criteria?

    Regards
    Brajesh

  • Participant
    Level: Guru
    Posts: 900
    Tosin on #45135

    I want new users to be friends with all the featured members.

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

    Hi Tosin,
    Thank you. I will be getting back to you late this weekend with more details.

    Regards
    Brajesh

  • Participant
    Level: Guru
    Posts: 900
    Tosin on #45255

    Kind reminder sir

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

    Hi Tosin,
    Will it work if we supplied you some code instead.

    We do plan to change the way the users are selected but that will need some significant time as we hope to have a better maintainable and future adaptable solution for multiple custom sources of users.

    If you need a quick solution, Ravi or I can put some code quickly.

    Regards
    Brajesh

  • Participant
    Level: Guru
    Posts: 900
    Tosin on #45265

    code is ok sir

    Thanks

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on #45282

    Hello Tosin,

    Please use the following code. It will add all featured members as a friend on new user activation.

    
    add_action( 'bp_core_activated_user', function ( $user_id ) {
    
    	if ( ! function_exists( 'friends_add_friend' ) ) {
    		return;
    	}
    
    	$featured_user_ids = get_users(
    		array(
    			'meta_key' => '_is_featured',
    			'fields'   => 'ID',
    			'number'   => - 1,
    		)
    	);
    
    	if ( empty( $featured_user_ids ) ) {
    		return;
    	}
    
    	foreach ( $featured_user_ids as $featured_user_id ) {
    		friends_add_friend( $featured_user_id, $user_id, true );
    	}
    } );
    
    

    Please check.

    Regards
    Ravi

  • Participant
    Level: Guru
    Posts: 900
    Tosin on #45283

    Thanks for the quick feed back Ravi but please note that I use the follow plugin and not friendship connection

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on #45284

    Hello Tosin,

    Please use the function ‘bp_follow_start_following’ instead of ‘friends_add_friend’. Please give it a try.

    Regards
    Ravi

The topic ‘BuddyPress Auto Friendship Pro + BuddyPress Featured Members Feature Suggestion’ is closed to new replies.

This topic is: not resolved