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

buddypress-trac noreply at wordpress.org
Sun Nov 23 19:13:25 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 boonebgorges):

 Thanks, imath! I think this is looking pretty good. A couple smallish
 suggestions, and one larger one surrounding i18n.

 *
 `test_bp_activity_catch_transition_post_type_status_publish_to_publish()`
 doesn't really test that no new activity was posted. Maybe after the
 initial post, delete the activity item, then `assertFalse()` for the
 second assertion?
 * You will probably want to clear out (or reset) the
 `buddypress()->activity->track` array between tests. You do in some cases,
 but not in others.
 * A possible alternative to your new 'bp_fully_loaded' hook is to have a
 wrapper function like `bp_activity_get_trackable_types()`, and then to use
 that function whenever you need to get information about these types.
 Internally, that function could dynamically assemble the required data
 (like currently happens in `bp_activity_tracking_register_post_types()`),
 and could store it in the `buddypress()` global if you wanted to, but in
 any case by the time it's called, all post types should have had a chance
 to register themselves. This kind of lazy-loading seems more elegant to me
 than introducing yet another `bp_` subhook (especially since it'll save
 the overhead of setting up the data if it's unneeded), but I'm glad to
 leave the decision up to you.
 * You'll probably want a hook at the end of
 `bp_activity_tracking_register_post_types()` (or a filter at the end of
 `bp_activity_get_trackable_types()`, if you decide to adopt the
 suggestion). It's likely that plugin authors will want to modify your
 default values for stuff like 'singular' and 'activity_comment', and there
 should be a centralized way for them to do it.
 * I don't feel very confident about the localizability of
 `bp_activity_format_activity_action_custom_post_type_post()`. Using
 `sprintf()` like this works in English and French, but I'm not confident
 it will work in other languages. What do you think about using the
 `sprintf()` as a fallback, with a different "preferred" method of storing
 a translatable full sentence in, say,
 `$post_type['labels']['bp_activity_new_post'] = __( '%s posted a new foo'
 )` or something like that? Obviously there would be a lot of details to
 work out, but I think we need to come up with a recommended way to
 register full sentences for the activity action formatter.

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


More information about the buddypress-trac mailing list