Skip to:
Content
Pages
Categories
Search
Top
Bottom

How can I filter The Activity Stream Loop with more than one scope


  • Rocio Valdivia
    Participant

    @_dorsvenabili

    Hi!!!

    I would like to show in the same activity tab the personal activity and the favourite activity. For that, I have modified the template activity-loop.php and I have change this line:

    `if ( bp_has_activities( bp_ajax_querystring( ‘activity’ ) ) ) :`

    for this one:

    `if ( bp_has_activities( ‘scope=friends,favorites’ ) ) :`

    As I found here: http://codex.buddypress.org/developer-docs/custom-buddypress-loops/the-activity-stream-loop/

    But it doesn’t work, beacuse, I think that the parameter scope don’t accept more than one value. So, is there another way to show all the activity of friends and favourites in the same tab?

    Thanks so much!!! :)

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

  • abysshorror
    Member

    @abysshorror

    Hey ! try this:

    `if ( bp_has_activities( ‘scope=friends’ ) || bp_has_activities( ‘scope=favorites’ )) :`


    Rocio Valdivia
    Participant

    @_dorsvenabili

    Hi abysshorror!

    Thanks for reply so fast :). I have tried your code and it doesn’t work, even I tried with && instead || but nothing. The problem is that using both ways, it only shows the first scope activitys, for example, using this:

    `if ( bp_has_activities( ‘scope=friends’ ) || bp_has_activities( ‘scope=favorites’ )) :`

    it only shows the friends activity. And there is another problem, if I use the code above, when I click on the load more link, it works, but showing the sames activities again and again.

    Somebody knows how can I solve this? Thanks! :)

    bp_has_activities() queries the database, so the second call would overwrite the data from the first, not add to it. The scope argument only accepts a single parameter; I think you’d have to build your own version of bp_has_activities() and see if it will work.


    abysshorror
    Member

    @abysshorror

    @paulgibbs wouldn’t this work ?

    `

    `


    Rocio Valdivia
    Participant

    @_dorsvenabili

    Yes @abysshorror it works, thanks, but it’s not what I was looking for.

    @DJPaul yes, I agree, the function that I have to modify is bp_activity_get() in bp-activity-functions.php to retrieve an activity or activities of both scopes :)

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How can I filter The Activity Stream Loop with more than one scope’ is closed to new replies.
Skip to toolbar