Skip to:
Content

Opened 18 months ago

Closed 18 months ago

Last modified 18 months ago

#2176 closed defect (fixed)

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

Reported by: r-a-y Owned by:
Milestone: 2.3 Priority: normal
Severity: normal Version: 2.2
Component: 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 18 months ago.

Download all attachments as: .zip

Change History (6)

r-a-y18 months ago

comment:1 johnjamesjacoby18 months ago

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

Last edited 18 months ago by johnjamesjacoby (previous) (diff)

comment:2 johnjamesjacoby18 months ago

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

comment:3 johnjamesjacoby18 months 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.

comment:4 johnjamesjacoby18 months ago

  • Milestone changed from Awaiting Review to 2.3

comment:5 r-a-y18 months 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.