bp_get_following_ids( mixed $args = '' )

Returns a comma separated list of user_ids for a given user’s following.

Description

This can then be passed directly into the members loop querystring. On failure, returns an integer of zero. Needed when used in a members loop to prevent SQL errors.

Arguments include: ‘user_id’ – The user ID you want to check for a following

Parameters

$args

(Optional) Arguments can be passed as an associative array or as a URL argument string

Default value: ''

Return

(Mixed) Comma-seperated string of user IDs on success. Integer zero on failure.

Source

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

function bp_get_following_ids( $args = '' ) {

	$r = wp_parse_args( $args, array(
		'user_id' => bp_displayed_user_id()
	) );

	$ids = implode( ',', (array) bp_get_following( array( 'user_id' => $r['user_id'] ) ) );

	$ids = empty( $ids ) ? 0 : $ids;

	return apply_filters( 'bp_get_following_ids', $ids, $r['user_id'] );
}

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.