[buddypress-trac] [BuddyPress] #2952: Filter user meta keys

buddypress-trac at lists.automattic.com buddypress-trac at lists.automattic.com
Sat May 14 19:07:32 UTC 2011


#2952: Filter user meta keys
--------------------------+------------------------------------
  Reporter:  wpmuguru     |      Owner:  johnjamesjacoby
      Type:  enhancement  |     Status:  assigned
  Priority:  normal       |  Milestone:  1.3
 Component:  Core         |    Version:
Resolution:               |   Keywords:  has-patch dev-feedback
--------------------------+------------------------------------

Comment (by boonebgorges):

 I chatted with wpmuguru and we discussed an alternative strategy. Instead
 of stashing meta keys in the global, what if we had BP-specific wrapper
 functions for saving usermeta? That way, we could filter *all* meta keys
 as they get saved. So something like:

 {{{
 function bp_update_user_meta( $user_id, $meta_key, $meta_value ) {
   $meta_key = apply_filters( 'bp_update_user_meta_key', $meta_key );

   return update_user_meta( $user_id, $meta_key, $meta_value );
 }
 }}}

 The downside is that we'll have to go through the codebase and make the
 necessary changes, and also that we'll have to remember to use the wrapper
 in future meta saves. But, on the other hand, it means that we don't have
 to do a cumbersome apply_filters everywhere where a piece of metadata is
 saved. Thoughts?

-- 
Ticket URL: <https://trac.buddypress.org/ticket/2952#comment:12>
BuddyPress <http://buddypress.org/>
BuddyPress


More information about the buddypress-trac mailing list