bp_start_following( array $args = '' )

Start following a user’s activity.

Description

Parameters

$args

(Optional) Array of arguments.

  • 'leader_id'
    (int) The user ID of the person we want to stop following.
  • 'follower_id'
    (int) The user ID initiating the unfollow request.

Default value: ''

Return

(bool)

Source

File: bp-activity/bp-activity-functions.php

4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
function bp_start_following( $args = '' ) {
 
    $r = wp_parse_args( $args, array(
        'leader_id'   => bp_displayed_user_id(),
        'follower_id' => bp_loggedin_user_id()
    ) );
 
    $follow = new BP_Activity_Follow( $r['leader_id'], $r['follower_id'] );
 
    // existing follow already exists
    if ( ! empty( $follow->id ) ) {
        return false;
    }
 
    if ( ! $follow->save() ) {
        return false;
    }
 
    do_action_ref_array( 'bp_start_following', array( &$follow ) );
 
    return true;
}

Changelog

Changelog
Version Description
BuddyBoss 1.0.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.