Skip to:
Content

bbPress.org

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#2176 closed defect (bug) (fixed)

BuddyPress: BBP_BuddyPress_Activity::register_activity_actions() not running early enough

Reported by: r-a-y's profile r-a-y Owned by:
Milestone: 2.3 Priority: normal
Severity: normal Version: 2.2
Component: Extend - BuddyPress Keywords: has-patch
Cc:

Description

Synopsis

BuddyPress 1.6 introduced the "Activity" dashboard to edit activity stream items.

When editing a bbPress forum activity item, the activity type changes from 'bbp_reply_create' / 'bbp_topic_create' to something else.

This creates this problem:
https://buddypress.trac.wordpress.org/ticket/4786

Why?

bbPress is not registering its activity actions early enough.

The BBP_BuddyPress_Activity class runs on bp_init at priority 10:
https://bbpress.trac.wordpress.org/browser/tags/2.2.3/includes/extend/buddypress/loader.php#L137

While in that same class, it tries to register its activity actions:
https://bbpress.trac.wordpress.org/browser/tags/2.2.3/includes/extend/buddypress/activity.php#L132

The 'bp_register_activity_actions' hook runs at bp_init at priority 8 so it's a chicken-before-egg scenario.

Proposed solution

Move the setup_components() hook to run at priority 7:

// Setup the components
add_action( 'bp_init', array( $this, 'setup_components' ), 7 );

In the attached patch, I've also registered some additional activity actions for the groups component.

Not sure what the consequences are with moving the hook a little earlier, but this was the easiest fix I could find.

Attachments (1)

2176.01.patch (1.9 KB) - added by r-a-y 11 years ago.

Download all attachments as: .zip

Change History (6)

@r-a-y
11 years ago

#1 @johnjamesjacoby
11 years ago

Are the additional activity stream actions really necessary? Won't that fragment the activity stream actions?

Last edited 11 years ago by johnjamesjacoby (previous) (diff)

#2 @johnjamesjacoby
11 years ago

(In [4719]) Whitespace cleanup in BuddyPress activity.php. See #2176.

#3 @johnjamesjacoby
11 years ago

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

(In [4720]) In BuddyPress's loader, setup components in priority 7, to get them in before activity actions are registered. Props r-a-y. Fixes #2176.

#4 @johnjamesjacoby
11 years ago

  • Milestone changed from Awaiting Review to 2.3

#5 @r-a-y
11 years ago

Hi JJJ,

Didn't get an email about this!

Re:

Are the additional activity stream actions really necessary? Won't that fragment the activity stream actions?

It isn't necessary for this ticket, but it might be better to add them anyway since bbP adds its own activity entries into the groups component. I'll leave it to your discretion.

Note: See TracTickets for help on using tickets.