[buddypress-trac] [BuddyPress Trac] #5669: Help plugins to generate activities for their post type(s)

buddypress-trac noreply at wordpress.org
Tue Nov 25 21:02:04 UTC 2014


#5669: Help plugins to generate activities for their post type(s)
-----------------------------------+------------------
 Reporter:  imath                  |       Owner:
     Type:  enhancement            |      Status:  new
 Priority:  normal                 |   Milestone:  2.2
Component:  Activity               |     Version:  2.0
 Severity:  normal                 |  Resolution:
 Keywords:  2nd-opinion has-patch  |
-----------------------------------+------------------

Comment (by imath):

 Replying to [comment:18 boonebgorges]:
 > > Unfortunately i cannot rely on bp_ready as it's too late for the
 activity administration screen (dropdown list of activity actions).
 >
 > > I am not a huge fan of the name of the new core action,
 "bp_fully_loaded".
 >
 > I changed `'bp_activity_tracking_register_post_types'` to 'bp_ready' and
 the admin dropdown seems to be populating fine. And to be honest, if it's
 broken, we should be fixing the dropdown rather than creating a new action
 - we should not be generating markup before 'bp_ready'. Let's try to get
 rid of this new action.

 Actually i was wrong. "wp" so "bp_ready" are not fired at all into the
 activity administration. It seems that "wp" hook in the WordPress
 administration is only fired when viewing {{{wp-admin/edit.php}}}. As a
 screenshot master, here are some proofs :

 ==== Activity Administration index page ====

 [[Image(https://farm8.staticflickr.com/7516/15877581012_282619dff3_z.jpg)]]

 ==== Activity Administration single item page ====

 [[Image(https://farm8.staticflickr.com/7496/15690719488_16c24b8784_z.jpg)]]

 As the dropdowns wasn't populating in the administration, i gave up with
 'bp_ready'. I've just done some testing and it appears this hook is
 '''not''' fired when submitting a post. So we cannot use it at all.

 I understand the new hook, which at first wasn't bothering you, is now
 very annoying.

 So to avoid making things wrong another time, could we find an agreement
 on the way you and the team want to deal with this :

 1. Use the lazy method you recommended
 2. Create a new hook on 'wp_loaded' (the annoying 'bp_fully_loaded')
 3. {{{add_action( 'init', 'bp_activity_tracking_register_post_types',
 PHP_INT_MAX );}}}

 My concern about the lazy method is link to the way activity actions are
 get. In core, and surely in plugins and themes playing with them, we are
 getting the actions this way {{{buddypress()->activity->actions}}}. And i
 haven't found any wrapper function to get all actions.
 The only way i see is creating a wrapper function and replace all
 occurrences of {{{buddypress()->activity->actions}}} in the code, but then
 i think there's a risk plugins and themes will keep on directly using
 {{{buddypress()->activity->actions}}}. But if you and the team are
 thinking it's the way, then i'll use it.

 So 1, 2, 3 or another option ?

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/5669#comment:19>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list