Skip to:
Content

BuddyPress.org

Opened 10 years ago

Closed 10 years ago

#2070 closed defect (bug) (fixed)

Mulitple Custom Activity Loops

Reported by: lofish Owned by:
Milestone: 1.5 Priority: major
Severity: Version:
Component: Activity Keywords:
Cc:

Description

If you run through a custom activity loop in a plugin specifying specific fields such as user_id its output will be influenced by another activity loop executed elsewhere on the page.

e.g. bp_has_activities('user_id='.bp_loggedin_user_id().'&max=10&scope=friends') will show a different users activity if you view another persons profile activity (so user_id is effectively overwritten).

There should probably be a reset_activity_loop function or similar that allows for more than one custom loop to be invoked in the same space. Not sure if this extends to other custom loops.

Change History (6)

#1 @lofish
10 years ago

Just noticed similar behaviour within a custom groups loop. Get a full group list except where I visit a specific group, whereupon the list only shows the single group.

#2 @lofish
10 years ago

Sorry folks, the groups issue was down to my misunderstanding of the code. With the correct parameters it works correctly for my needs.

The activity loop issue I think I have traced to this conditional:

if ( $user_id = ( !empty( $bp->displayed_user->id ) ) ? $bp->displayed_user->id : $bp->loggedin_user->id )

If you pass in a user_id it will still get overwritten by this line, so I would think there should be a check beforehand to make sure the user_id isn't already set as a parameter.

#3 @apeatling
10 years ago

  • Component set to Activity

Yes, this looks like a bug in the code, it is not checking for an existing user_id parameter.

#4 @apeatling
10 years ago

  • Priority changed from minor to major

#5 @lofish
10 years ago

  • Milestone set to 1.2.3

Propose we fix by changing conditional to:

if ( !empty( $user_id )
$user_id = ( !empty( $bp->displayed_user->id ) ) ? $bp->displayed_user->id : $bp->loggedin_user->id )

basically just checking if the user_id has already been set.

#6 @mrmaz
10 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [2910]) fixes #2070

Note: See TracTickets for help on using tickets.