bp_get_follower_ids( mixed $args = '' )

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

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 followers

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

4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
function bp_get_follower_ids( $args = '' ) {
 
    $r = wp_parse_args( $args, array(
        'user_id' => bp_displayed_user_id()
    ) );
 
    $ids = implode( ',', (array) bp_get_followers( array( 'user_id' => $r['user_id'] ) ) );
 
    $ids = empty( $ids ) ? 0 : $ids;
 
    return apply_filters( 'bp_get_follower_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.