Skip to:
Content

BuddyPress.org

Opened 10 years ago

Closed 10 years ago

#5515 closed defect (bug) (fixed)

Bug when marking activity favorite

Reported by: mpa4hu's profile mpa4hu Owned by: boonebgorges's profile boonebgorges
Milestone: 2.0 Priority: normal
Severity: normal Version: 2.0
Component: Core Keywords:
Cc: mpa4hu@…

Description

Well, at least I think this is a bug.

Try to favorite an activity which was not favorited before.

This should fail here (bp-activity-functions.php)

	// Update activity meta counts
	if ( true === bp_activity_update_meta( $activity_id, 'favorite_count', $fav_count ) ) {
		var_dump('asdasd');
		// Execute additional code
		do_action( 'bp_activity_add_user_favorite', $activity_id, $user_id );
		// Success
		return true;
	// Saving meta was unsuccessful for an unknown reason
	} else {
		// Execute additional code
		do_action( 'bp_activity_add_user_favorite_fail', $activity_id, $user_id );
		return false;
	}

bp_activity_update_meta is not equal to true.

I have tested this with buddypress 1.9.2 but works fine, but with lastest verion (beta from svn) this will fail. (tested with lastest fresh wp install and default buddypress theme)

I tried my best to debug why would this happen but had no success.
bp_activity_update_meta indeed happeens but does not return true, so things attached to bp_activity_add_user_favorite action will not execute.

interestingly enough if you unfavorite it and then favorite it again, this will work.

Do you see same?

Change History (4)

#1 @boonebgorges
10 years ago

  • Milestone changed from Awaiting Review to 2.0
  • Owner set to boonebgorges
  • Status changed from new to assigned

Thanks for the report. This is indeed a bug, introduced by changes in #5399, specifically B2 r8132.

#2 @mpa4hu
10 years ago

  • Milestone changed from 2.0 to Awaiting Review

Just to add some info: first time it returns (int) id of activity_meta inserted into database, and only when it exists it returns true

oops I accidently changed status

Last edited 10 years ago by mpa4hu (previous) (diff)

#3 @mpa4hu
10 years ago

  • Milestone changed from Awaiting Review to 2.0

#4 @boonebgorges
10 years ago

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

In 8237:

Don't do a strict type check when deciding on bp_activity_add_user_favorite() return value

Since r8132, bp_activity_update_meta() has returned an integer value when
falling through to add_metadata(). Thus, we should have a more generous test
for whether the update has been successful. See #5399

Fixes #5515

Note: See TracTickets for help on using tickets.