Skip to:
Content
Pages
Categories
Search
Top
Bottom

Making bp_has_activities() have a global scope

  • Hi everyone,

    This one should be fairly obvious but I’m missing something — so when I try to access bp_has_activities(); on the main page it retrieves activity for all users, which is what I’m looking for:
    http://erniehsiung.com/8asians/

    However, when I go to a profile page, the sidebar function only shows activity for that particular user when I would like it to retain all members from the main page:
    http://erniehsiung.com/8asians/members/admin/

    What are the parameters I should be pulling in? From the docs, it says that scope pulls out $bp->current_action, but that is an empty string on the front page, and the permutations of user_id or scope that I’ve tried doesn’t seem to do the trick either.

    Thanks,
    – Ernie

Viewing 3 replies - 1 through 3 (of 3 total)
  • this is defined within the function, to pick up the profile of the user you are viewing…

    /* User filtering */
    if ( !empty( $bp->displayed_user->id ) )
    $user_id = $bp->displayed_user->id;

    but the wp_parse_args call is after – so have you tried passing in user_id=false to the loop?


    Boone Gorges
    Keymaster

    @boonebgorges

    Here are some of the accepted arguments: https://codex.buddypress.org/developer-docs/custom-buddypress-loops/the-activity-stream-loop/

    Also, check out the inline documentation in buddypress/bp-activity/bp-activity-templatetags.php.

    @nuprn1 is right that you need to pass in user_id=0.

    Thanks to both of you guys for your help and to the inline documentation! I didn’t realize that you had to set the user_id=0 and set the scope to zero as well.
    To anyone else looking:
    bp_has_activities(‘per_page=6&user_id=0&scope=0’);

    Will bring up global activity within a side bar fine, even if you’re on a profile page.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Making bp_has_activities() have a global scope’ is closed to new replies.
Skip to toolbar