Skip to:
Content
Pages
Categories
Search
Top
Bottom

Activity widget

  • Avatar of daniel@lubryka.com
    daniel@lubryka.com
    Participant

    @daniellubrykacom

    hello everybody,

    as my site is getting more and more users, some of them will never be connected, so they’re not really interested what’s going on with these particular users that they’re not friends of them

    the thing i’m struggling with is: how to modify sitewide activity widget so it shows only activity of friends

    i almost did it, but the thing that is stopping mi is wp_cache function that not supports friend’s activity

    would you please give me any hints on how to solve it ?

    we’re talking about main page here

Viewing 3 replies - 1 through 3 (of 3 total)
  • Avatar of Jeff Sayre
    Jeff Sayre
    Participant

    @jeffsayre

    You will most likely need to make a custom widget and a new function.

    If you look at the default Site Wide Activity Widget that comes with BP, on line 36 of bp_activity_widget.php, you’ll see this line:

    $activity = bp_activity_get_sitewide_activity( $options['max_items'] );

    Instead of call that function, which exists in bp_activity.php and ends up calling the model get_sitewide_activity() in bp_activity_classes.php, you will need to create a new function that instead calls the model get_activity_for_friends().

    Avatar of daniel@lubryka.com
    daniel@lubryka.com
    Participant

    @daniellubrykacom

    Well, i tried something like this:

    $activity = bp_activity_get_friends_activity( $user_id=$bp_loggedin_user_id, $max_items = 30, $max_items_per_friend = false, $pag_num = false, $pag_page = false ) ;

    however it returns no results – empty list and msg: no activity

    any suggestions how may I improve it ?

    Avatar of Jeff Sayre
    Jeff Sayre
    Participant

    @jeffsayre

    Well, without looking into this in more detail, this at the very least

    $user_id=$bp_loggedin_user_id

    should be replaced with this

    $bp->loggedin_user->id

    You will also need to actually have a function called bp_activity_get_sitewide_activity().

Viewing 3 replies - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.