[buddypress-trac] [BuddyPress Trac] #3856: Saving activity update action as an array in db

buddypress-trac noreply at wordpress.org
Thu Mar 13 18:34:07 UTC 2014

#3856: Saving activity update action as an array in db
 Reporter:  modemlooper            |       Owner:  boonebgorges
     Type:  enhancement            |      Status:  closed
 Priority:  normal                 |   Milestone:  2.0
Component:  Activity               |     Version:
 Severity:  normal                 |  Resolution:  fixed
 Keywords:  has-patch 2nd-opinion  |
Changes (by boonebgorges):

 * owner:   => boonebgorges
 * status:  new => closed
 * resolution:   => fixed


 In [changeset:"8125"]:
 #!CommitTicketReference repository="" revision="8125"
 Generate activity actions dynamically, instead of using static values
 stored in the database

 Activity actions - like 'Joe became a registered member' - have always
 stored as static strings in the activity table. This has been a perennial
 in the side of BP site administrators. For one thing, static strings
 cannot be
 translated for multilingual audiences (without unreasonable workarounds).
 For another, information in these static strings becomes out of date as
 change their display names, groups change their names, and so on.

 This changeset makes it possible for activity types to be registered with
 new $format_callback function, passed to bp_activity_set_action(), which
 will use to generate the action dynamically when building the activity
 This makes the activity stream fully localizable, continually up-to-date,
 generally the bomb dot com.

 Existing plugins that do not register format_callback functions will
 to have their actions pulled directly from the database. Likewise, since a
 of the static string is saved in the activity table, static strings can be
 served if the given component is disabled at any point (and thus the
 is no longer available).

 The original argument for caching the action strings was that generating
 inline was too resource intensive; it often requires pulling up display
 user permalinks, group links, blog post names, and so forth. To address
 problem, each component can now prefetch required data at the beginning of
 activity loop by hooking to bp_activity_prefetch_object_data, and loading
 relevant data into the cache. The Activity, Friends, Groups, and Blogs
 component now do this natively. It's likely that this prefetching will
 other performance benefits, as plugin authors will now be able to access
 data etc inline without performance penalties.

 The case of the Blogs component is a special one; it's not practical to
 prefetch data from multiple blogs at the beginning of a loop, due to the
 resources required by switch_to_blog(). For this reason, the
 functions in the blog component cache some relevant data (like the post
 in blogmeta, where it's readily accessible within the loop.

 Fixes #3856

Ticket URL: <https://buddypress.trac.wordpress.org/ticket/3856#comment:30>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac

More information about the buddypress-trac mailing list