Please be advised that there's currently no out-of-the-box option to do this in BuddyBoss. Modifications are typically considered custom work, but we are making an exception in this case. Kindly check our Support Policy here: https://www.buddyboss.com/support-policy/.
Kindly try using the following code to set a dynamic user ID. You need to change the user ID from 80 to your desired value.
$user_id: This is the ID of the newly registered user.
$jlearn = 80;: This sets the user ID of the account that new members should automatically follow.
bp_start_following: This is a function that initiates the following relationship between the new user and the specified user.
1. Go to Appearance > Theme File Editor
2. Under “Select theme to edit”, choose (BuddyBoss Child/Whatever theme is active), then click “Select”.
3. Below Theme Files, select Theme Functions (functions.php).
4. Append the following just before the closing PHP tag “?>”:
/* Auto follow JLearn */
function lauralisa_followjlearn( $user_id ) {
if( !$user_id ) return false;
$jlearn = 80; // This is the user ID of the client account
bp_start_following( array(
'leader_id' => $jlearn,
'follower_id' => $user_id
) );
}
add_action( 'bp_core_activated_user', 'lauralisa_followjlearn' );
NOTE: Please make a backup of your site.
/* Auto follow JLearn */
function lauralisa_followjlearn( $user_id ) {
if( !$user_id ) return false;
$jlearn = 80; // This is the user ID of the client account
bp_start_following( array(
'leader_id' => $jlearn,
'follower_id' => $user_id
) );
}
add_action( 'bp_core_activated_user', 'lauralisa_followjlearn' );
NOTE: Please make a backup of your site.
5. Click “Update File”.
Did you find it helpful? Yes No
Send feedbackSorry we couldn't be helpful. Help us improve this article with your feedback.