Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Multiple activity loops on same page


Roger Coathup
Participant

@rogercoathup

@djpaul, @nuprn1

I ran into a stack of problems with this approach:

1. A call to make a new BP_Activity_Template requires a full set of parameters (it doesn’t default them).

2. All the bp_ functions, e.g. bp_has_activities() work on a single global activities template ($activities_template)

3. The methods (functions) you can call directly on the BP_Activity_Template calls are very limited (has_activities, next_activity, rewind_activities, user_activities, the_activity).

[Edit: the call to the_activity() references a global $activity but then doesn’t do anything with it, e.g. it doesn’t instantiate it]

4. All the presentational / data functions you’d want to use, e.g. for pagination_count, title, avatar, item ids, object names, content, only work on the global $activity_template (not on the $activity global)

Am I missing something obvious? Or is this really not feasible with the current methods?

The code I tried:
`
$page = 1; $per_page = 10; $scope = ‘ ‘, $max = 200;

$activities = new BP_Activity_Template ($page, $per_page, $max, false, ‘DESC’, false, false, false, false);

if ($activities->has_activities()) :
while ( $activities->user_activities() ) : $activities->the_activity();
`
then, I was stuck as there don’t seem to be any easy methods to access the activity content.

My surmise is that the_activity() should be instantiating the global $activity (but it doesn’t), and then the bp_ functions should work on the $activity global not on the $activity_template global

Skip to toolbar