Viewing 5 replies - 1 through 5 (of 5 total)
  • Try adding this code to your functions file.

    function auto_follow_users( $user_id ){
    	if ( function_exists( 'bp_follow_start_following' ) {
    
    	// Add your user ids here
    	$users_to_follow = array( '1', '2', '3' );
    
    		foreach ( $users_to_follow as $follow_user ) {
    			bp_follow_start_following( array( 'leader_id' => $follow_user, 'follower_id' => $user_id ) );
    
    			// If you don't want them to follow back remove the line below
    			bp_follow_start_following( array( 'leader_id' => $user_id, 'follower_id' => $follow_user ) );
    		}
    	}
    }
    add_action('bp_core_activated_user', 'auto_follow_users', 10, 1);

    Then, all you should have to do is change the array by adding the user ids of the users that want the new users to follow.

    Let me know how it works for you . . .

    Plugin Author r-a-y

    (@r-a-y)

    Thanks for posting a response to this forum question and for your code snippet, takinglife2themax!

    Thread Starter bernardworthy

    (@bernardworthy)

    I’ll try this out. Thanks!

    Hi all! When I add the code to my functions.php, my site goes blank. So, it seems something is a little off in the code. Tried to debug it, but couldn’t make it work. @r-a-y, do you see anything wrong with the code? Thanks.

    @leonardoarias, I receive the same error. Change this line

    if ( function_exists( 'bp_follow_start_following' ) {

    to

    if ( function_exists( 'bp_follow_start_following' ) ){

    (a parentheses was missing)

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Auto Follow After New User Registration’ is closed to new replies.