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

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.