<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[BuddyPress][4378] trunk: Refactors user_meta key filtering to remove overhead in the bp global.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg > ul, #logmsg > ol { margin-left: 0; margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd>4378</dd>
<dt>Author</dt> <dd>boonebgorges</dd>
<dt>Date</dt> <dd>2011-05-16 22:22:39 +0000 (Mon, 16 May 2011)</dd>
</dl>

<h3>Log Message</h3>
<pre>Refactors user_meta key filtering to remove overhead in the bp global. Fixes #2952. Props nacin.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbpactivitybpactivityclassesphp">trunk/bp-activity/bp-activity-classes.php</a></li>
<li><a href="#trunkbpactivitybpactivityfunctionsphp">trunk/bp-activity/bp-activity-functions.php</a></li>
<li><a href="#trunkbpactivitybpactivityloaderphp">trunk/bp-activity/bp-activity-loader.php</a></li>
<li><a href="#trunkbpactivitybpactivitytemplatephp">trunk/bp-activity/bp-activity-template.php</a></li>
<li><a href="#trunkbpcorebpcoreclassesphp">trunk/bp-core/bp-core-classes.php</a></li>
<li><a href="#trunkbpcorebpcorecomponentphp">trunk/bp-core/bp-core-component.php</a></li>
<li><a href="#trunkbpcorebpcorefunctionsphp">trunk/bp-core/bp-core-functions.php</a></li>
<li><a href="#trunkbpcorebpcoreloaderphp">trunk/bp-core/bp-core-loader.php</a></li>
<li><a href="#trunkbpfriendsbpfriendsloaderphp">trunk/bp-friends/bp-friends-loader.php</a></li>
<li><a href="#trunkbpgroupsbpgroupsfunctionsphp">trunk/bp-groups/bp-groups-functions.php</a></li>
<li><a href="#trunkbpgroupsbpgroupsloaderphp">trunk/bp-groups/bp-groups-loader.php</a></li>
<li><a href="#trunkbpmessagesbpmessagesloaderphp">trunk/bp-messages/bp-messages-loader.php</a></li>
<li><a href="#trunkbpxprofilebpxprofileloaderphp">trunk/bp-xprofile/bp-xprofile-loader.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbpactivitybpactivityclassesphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-activity/bp-activity-classes.php (4377 => 4378)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-activity/bp-activity-classes.php        2011-05-16 21:41:01 UTC (rev 4377)
+++ trunk/bp-activity/bp-activity-classes.php        2011-05-16 22:22:39 UTC (rev 4378)
</span><span class="lines">@@ -523,7 +523,7 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function total_favorite_count( $user_id ) {
</span><del>-                if ( !$favorite_activity_entries = get_user_meta( $user_id, bp_get_user_meta_key( 'favorite_activities' ), true ) )
</del><ins>+                if ( !$favorite_activity_entries = get_user_meta( $user_id, bp_get_user_meta_key( 'bp_favorite_activities' ), true ) )
</ins><span class="cx">                         return 0;
</span><span class="cx"> 
</span><span class="cx">                 return count( maybe_unserialize( $favorite_activity_entries ) );
</span></span></pre></div>
<a id="trunkbpactivitybpactivityfunctionsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-activity/bp-activity-functions.php (4377 => 4378)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-activity/bp-activity-functions.php        2011-05-16 21:41:01 UTC (rev 4377)
+++ trunk/bp-activity/bp-activity-functions.php        2011-05-16 22:22:39 UTC (rev 4378)
</span><span class="lines">@@ -190,7 +190,7 @@
</span><span class="cx">                 $user_id = $bp-&gt;displayed_user-&gt;id;
</span><span class="cx"> 
</span><span class="cx">         // Get favorites for user
</span><del>-        $favs = get_user_meta( $user_id, bp_get_user_meta_key( 'favorite_activities' ), true );
</del><ins>+        $favs = get_user_meta( $user_id, bp_get_user_meta_key( 'bp_favorite_activities' ), true );
</ins><span class="cx"> 
</span><span class="cx">         return apply_filters( 'bp_activity_get_user_favorites', $favs );
</span><span class="cx"> }
</span><span class="lines">@@ -215,7 +215,7 @@
</span><span class="cx">                 $user_id = $bp-&gt;loggedin_user-&gt;id;
</span><span class="cx"> 
</span><span class="cx">         // Update the user's personal favorites
</span><del>-        $my_favs   = get_user_meta( $bp-&gt;loggedin_user-&gt;id, bp_get_user_meta_key( 'favorite_activities' ), true );
</del><ins>+        $my_favs   = get_user_meta( $bp-&gt;loggedin_user-&gt;id, bp_get_user_meta_key( 'bp_favorite_activities' ), true );
</ins><span class="cx">         $my_favs[] = $activity_id;
</span><span class="cx"> 
</span><span class="cx">         // Update the total number of users who have favorited this activity
</span><span class="lines">@@ -223,7 +223,7 @@
</span><span class="cx">         $fav_count = !empty( $fav_count ) ? (int)$fav_count + 1 : 1;
</span><span class="cx"> 
</span><span class="cx">         // Update user meta
</span><del>-        update_user_meta( $bp-&gt;loggedin_user-&gt;id, bp_get_user_meta_key( 'favorite_activities' ), $my_favs );
</del><ins>+        update_user_meta( $bp-&gt;loggedin_user-&gt;id, bp_get_user_meta_key( 'bp_favorite_activities' ), $my_favs );
</ins><span class="cx"> 
</span><span class="cx">         // Update activity meta counts
</span><span class="cx">         if ( true === bp_activity_update_meta( $activity_id, 'favorite_count', $fav_count ) ) {
</span><span class="lines">@@ -255,7 +255,7 @@
</span><span class="cx">                 $user_id = $bp-&gt;loggedin_user-&gt;id;
</span><span class="cx"> 
</span><span class="cx">         // Remove the fav from the user's favs
</span><del>-        $my_favs = get_user_meta( $user_id, bp_get_user_meta_key( 'favorite_activities' ), true );
</del><ins>+        $my_favs = get_user_meta( $user_id, bp_get_user_meta_key( 'bp_favorite_activities' ), true );
</ins><span class="cx">         $my_favs = array_flip( (array) $my_favs );
</span><span class="cx">         unset( $my_favs[$activity_id] );
</span><span class="cx">         $my_favs = array_unique( array_flip( $my_favs ) );
</span><span class="lines">@@ -267,7 +267,7 @@
</span><span class="cx">                 if ( bp_activity_update_meta( $activity_id, 'favorite_count', (int)$fav_count - 1 ) ) {
</span><span class="cx"> 
</span><span class="cx">                         // Update users favorites
</span><del>-                        if ( update_user_meta( $user_id, bp_get_user_meta_key( 'favorite_activities' ), $my_favs ) ) {
</del><ins>+                        if ( update_user_meta( $user_id, bp_get_user_meta_key( 'bp_favorite_activities' ), $my_favs ) ) {
</ins><span class="cx"> 
</span><span class="cx">                                 // Execute additional code
</span><span class="cx">                                 do_action( 'bp_activity_remove_user_favorite', $activity_id, $user_id );
</span><span class="lines">@@ -499,8 +499,8 @@
</span><span class="cx">         bp_activity_delete( array( 'user_id' =&gt; $user_id ) );
</span><span class="cx"> 
</span><span class="cx">         // Remove any usermeta
</span><del>-        delete_user_meta( $user_id, bp_get_user_meta_key( 'latest_update' ) );
-        delete_user_meta( $user_id, bp_get_user_meta_key( 'favorite_activities' ) );
</del><ins>+        delete_user_meta( $user_id, bp_get_user_meta_key( 'bp_latest_update' ) );
+        delete_user_meta( $user_id, bp_get_user_meta_key( 'bp_favorite_activities' ) );
</ins><span class="cx"> 
</span><span class="cx">         // Execute additional code
</span><span class="cx">         do_action( 'bp_activity_remove_data', $user_id ); // Deprecated! Do not use!
</span><span class="lines">@@ -675,7 +675,7 @@
</span><span class="cx">         ) );
</span><span class="cx"> 
</span><span class="cx">         // Add this update to the &quot;latest update&quot; usermeta so it can be fetched anywhere.
</span><del>-        update_user_meta( $bp-&gt;loggedin_user-&gt;id, bp_get_user_meta_key( 'latest_update' ), array( 'id' =&gt; $activity_id, 'content' =&gt; wp_filter_kses( $content ) ) );
</del><ins>+        update_user_meta( $bp-&gt;loggedin_user-&gt;id, bp_get_user_meta_key( 'bp_latest_update' ), array( 'id' =&gt; $activity_id, 'content' =&gt; wp_filter_kses( $content ) ) );
</ins><span class="cx"> 
</span><span class="cx">          // Require the notifications code so email notifications can be set on the 'bp_activity_posted_update' action.
</span><span class="cx">         require_once( BP_PLUGIN_DIR . '/bp-activity/bp-activity-notifications.php' );
</span><span class="lines">@@ -807,10 +807,10 @@
</span><span class="cx"> 
</span><span class="cx">         do_action( 'bp_before_activity_delete', $args );
</span><span class="cx"> 
</span><del>-        $latest_update = get_user_meta( $user_id, bp_get_user_meta_key( 'latest_update' ), true );
</del><ins>+        $latest_update = get_user_meta( $user_id, bp_get_user_meta_key( 'bp_latest_update' ), true );
</ins><span class="cx">         if ( !empty( $latest_update ) ) {
</span><span class="cx">                 if ( in_array( (int)$latest_update['id'], (array)$activity_ids_deleted ) )
</span><del>-                        delete_user_meta( $user_id, bp_get_user_meta_key( 'latest_update' ) );
</del><ins>+                        delete_user_meta( $user_id, bp_get_user_meta_key( 'bp_latest_update' ) );
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         do_action( 'bp_activity_delete', $args );
</span></span></pre></div>
<a id="trunkbpactivitybpactivityloaderphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-activity/bp-activity-loader.php (4377 => 4378)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-activity/bp-activity-loader.php        2011-05-16 21:41:01 UTC (rev 4377)
+++ trunk/bp-activity/bp-activity-loader.php        2011-05-16 22:22:39 UTC (rev 4378)
</span><span class="lines">@@ -67,16 +67,6 @@
</span><span class="cx">                         'table_name'      =&gt; $bp-&gt;table_prefix . 'bp_activity',
</span><span class="cx">                         'table_name_meta' =&gt; $bp-&gt;table_prefix . 'bp_activity_meta',
</span><span class="cx">                 );
</span><del>-                
-                // User meta keys
-                $user_meta_keys = array(
-                        'new_mention_count'                         =&gt; 'bp_new_mention_count',
-                        'new_mentions'                                =&gt; 'bp_new_mentions',
-                        'favorite_activities'                         =&gt; 'bp_favorite_activities',
-                        'latest_update'                         =&gt; 'bp_latest_update',
-                        'notification_activity_new_mention'        =&gt; 'notification_activity_new_mention',
-                        'notification_activity_new_reply'        =&gt; 'notification_activity_new_reply'
-                );
</del><span class="cx"> 
</span><span class="cx">                 // All globals for activity component.
</span><span class="cx">                 // Note that global_tables is included in this array.
</span><span class="lines">@@ -85,8 +75,7 @@
</span><span class="cx">                         'slug'                  =&gt; BP_ACTIVITY_SLUG,
</span><span class="cx">                         'root_slug'             =&gt; isset( $bp-&gt;pages-&gt;activity-&gt;slug ) ? $bp-&gt;pages-&gt;activity-&gt;slug : BP_ACTIVITY_SLUG,
</span><span class="cx">                         'search_string'         =&gt; __( 'Search Activity...', 'buddypress' ),
</span><del>-                        'global_tables'         =&gt; $global_tables,
-                        'user_meta_keys'        =&gt; $user_meta_keys
</del><ins>+                        'global_tables'         =&gt; $global_tables
</ins><span class="cx">                 );
</span><span class="cx"> 
</span><span class="cx">                 parent::_setup_globals( $globals );
</span></span></pre></div>
<a id="trunkbpactivitybpactivitytemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/bp-activity/bp-activity-template.php (4377 => 4378)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-activity/bp-activity-template.php        2011-05-16 21:41:01 UTC (rev 4377)
+++ trunk/bp-activity/bp-activity-template.php        2011-05-16 22:22:39 UTC (rev 4378)
</span><span class="lines">@@ -93,7 +93,7 @@
</span><span class="cx">                 $this-&gt;disable_blogforum_replies = isset( $bp-&gt;site_options['bp-disable-blogforum-comments'] ) ? $bp-&gt;site_options['bp-disable-blogforum-comments'] : false;
</span><span class="cx"> 
</span><span class="cx">                 // Get an array of the logged in user's favorite activities
</span><del>-                $this-&gt;my_favs = maybe_unserialize( get_user_meta( $bp-&gt;loggedin_user-&gt;id, bp_get_user_meta_key( 'favorite_activities' ), true ) );
</del><ins>+                $this-&gt;my_favs = maybe_unserialize( get_user_meta( $bp-&gt;loggedin_user-&gt;id, bp_get_user_meta_key( 'bp_favorite_activities' ), true ) );
</ins><span class="cx"> 
</span><span class="cx">                 // Fetch specific activity items based on ID's
</span><span class="cx">                 if ( !empty( $include ) )
</span><span class="lines">@@ -1025,7 +1025,7 @@
</span><span class="cx">                 if ( !$user_id )
</span><span class="cx">                         $user_id = $bp-&gt;displayed_user-&gt;id;
</span><span class="cx"> 
</span><del>-                if ( !$update = get_user_meta( $user_id, bp_get_user_meta_key( 'latest_update' ), true ) )
</del><ins>+                if ( !$update = get_user_meta( $user_id, bp_get_user_meta_key( 'bp_latest_update' ), true ) )
</ins><span class="cx">                         return false;
</span><span class="cx"> 
</span><span class="cx">                 $latest_update = '&amp;quot;' . apply_filters( 'bp_get_activity_latest_update_excerpt', trim( strip_tags( bp_create_excerpt( $update['content'], 358 ) ) ) ) . '&amp;quot;';
</span><span class="lines">@@ -1143,7 +1143,7 @@
</span><span class="cx">         function bp_get_total_mention_count_for_user( $user_id = 0 ) {
</span><span class="cx">                 global $bp;
</span><span class="cx">                 
</span><del>-                return apply_filters( 'bp_get_total_mention_count_for_user', get_user_meta( $user_id, bp_get_user_meta_key( 'new_mention_count' ), true ) );
</del><ins>+                return apply_filters( 'bp_get_total_mention_count_for_user', get_user_meta( $user_id, bp_get_user_meta_key( 'bp_new_mention_count' ), true ) );
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx"> function bp_send_public_message_link() {
</span></span></pre></div>
<a id="trunkbpcorebpcoreclassesphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/bp-core-classes.php (4377 => 4378)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/bp-core-classes.php        2011-05-16 21:41:01 UTC (rev 4377)
+++ trunk/bp-core/bp-core-classes.php        2011-05-16 22:22:39 UTC (rev 4378)
</span><span class="lines">@@ -431,7 +431,7 @@
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 // Fetch the user's latest update
</span><del>-                $user_update = $wpdb-&gt;get_results( &quot;SELECT user_id as id, meta_value as latest_update FROM &quot; . CUSTOM_USER_META_TABLE . &quot; WHERE meta_key = 'bp_latest_update' AND user_id IN ( {$user_ids} )&quot; );
</del><ins>+                $user_update = $wpdb-&gt;get_results( &quot;SELECT user_id as id, meta_value as latest_update FROM &quot; . CUSTOM_USER_META_TABLE . &quot; WHERE meta_key = '&quot; . bp_get_user_meta_key( 'bp_latest_update' ) . &quot;' AND user_id IN ( {$user_ids} )&quot; );
</ins><span class="cx">                 for ( $i = 0; $i &lt; count( $paged_users ); $i++ ) {
</span><span class="cx">                         foreach ( (array)$user_update as $update ) {
</span><span class="cx">                                 if ( $update-&gt;id == $paged_users[$i]-&gt;id )
</span></span></pre></div>
<a id="trunkbpcorebpcorecomponentphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/bp-core-component.php (4377 => 4378)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/bp-core-component.php        2011-05-16 21:41:01 UTC (rev 4377)
+++ trunk/bp-core/bp-core-component.php        2011-05-16 22:22:39 UTC (rev 4378)
</span><span class="lines">@@ -94,7 +94,6 @@
</span><span class="cx">          *
</span><span class="cx">          * @uses apply_filters() Calls 'bp_{@link bp_Component::name}_id'
</span><span class="cx">          * @uses apply_filters() Calls 'bp_{@link bp_Component::name}_slug'
</span><del>-         * @uses apply_filters() Calls 'bp_user_meta_keys_$key_name'
</del><span class="cx">          *
</span><span class="cx">          * @param arr $args Used to
</span><span class="cx">          */
</span><span class="lines">@@ -108,8 +107,7 @@
</span><span class="cx">                         'root_slug'             =&gt; '',
</span><span class="cx">                         'notification_callback' =&gt; '',
</span><span class="cx">                         'search_string'         =&gt; '',
</span><del>-                        'global_tables'         =&gt; '',
-                        'user_meta_keys'        =&gt; array()
</del><ins>+                        'global_tables'         =&gt; ''
</ins><span class="cx">                 );
</span><span class="cx">                 $r = wp_parse_args( $args, $defaults );
</span><span class="cx"> 
</span><span class="lines">@@ -129,12 +127,6 @@
</span><span class="cx">                 if ( !empty( $r['global_tables'] ) )
</span><span class="cx">                         foreach ( $r['global_tables'] as $global_name =&gt; $table_name )
</span><span class="cx">                                 $this-&gt;$global_name = $table_name;
</span><del>-                        
-                // User meta keys
-                if ( !empty( $r['user_meta_keys'] ) ) {
-                        foreach ( $r['user_meta_keys'] as $key_name =&gt; $key_value )
-                                $bp-&gt;user_meta_keys-&gt;$key_name = apply_filters( &quot;bp_user_meta_keys_$key_name&quot;, $key_value );
-                }
</del><span class="cx">                 
</span><span class="cx">                 /** BuddyPress ********************************************************/
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkbpcorebpcorefunctionsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/bp-core-functions.php (4377 => 4378)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/bp-core-functions.php        2011-05-16 21:41:01 UTC (rev 4377)
+++ trunk/bp-core/bp-core-functions.php        2011-05-16 22:22:39 UTC (rev 4378)
</span><span class="lines">@@ -27,7 +27,7 @@
</span><span class="cx">         $is_enable_multiblog = is_multisite() &amp;&amp; defined( 'BP_ENABLE_MULTIBLOG' ) &amp;&amp; BP_ENABLE_MULTIBLOG ? true : false;
</span><span class="cx"> 
</span><span class="cx">         $page_blog_id = $is_enable_multiblog ? get_current_blog_id() : BP_ROOT_BLOG;
</span><del>-        
</del><ins>+
</ins><span class="cx">         // Upgrading from an earlier version of BP pre-1.3
</span><span class="cx">         if ( empty( $page_ids ) || isset( $page_ids['members'] ) ) {                
</span><span class="cx">                 if ( empty( $page_ids ) ) {                
</span><span class="lines">@@ -1000,7 +1000,7 @@
</span><span class="cx">  *
</span><span class="cx">  * BuddyPress stores a number of pieces of userdata in the WordPress central usermeta table. In
</span><span class="cx">  * order to allow plugins to enable multiple instances of BuddyPress on a single WP installation,
</span><del>- * BP's usermeta keys are abstracted and stored in the $bp global, at $bp-&gt;user_meta_keys.
</del><ins>+ * BP's usermeta keys are filtered with this function, so that they can be altered on the fly.
</ins><span class="cx">  *
</span><span class="cx">  * Plugin authors who access or modify metadata created by BuddyPress should use
</span><span class="cx">  * this function exclusively in the context of the _user_meta() functions. For example,
</span><span class="lines">@@ -1008,27 +1008,18 @@
</span><span class="cx">  * Do not hardcode these keys.
</span><span class="cx">  * 
</span><span class="cx">  * If your plugin introduces custom user metadata that might change between multiple BP instances
</span><del>- * on a single WP installation, you are strongly recommended to register your meta keys in the $bp
- * global (see BP_Core_Component::setup_globals()), and use this function when storing and
</del><ins>+ * on a single WP installation, you are strongly recommended to use this function when storing and
</ins><span class="cx">  * retrieving metadata.
</span><span class="cx">  *
</span><span class="cx">  * @package BuddyPress
</span><span class="cx">  * @since 1.3
</span><del>- * @see BP_Core_Component::_setup_globals()
</del><span class="cx">  *
</span><span class="cx">  * @uses apply_filters() Filter bp_get_user_meta_key to modify keys individually
</span><del>- * @param str $name
</del><ins>+ * @param str $key
</ins><span class="cx">  * @return str $key
</span><span class="cx">  */
</span><del>-function bp_get_user_meta_key( $name = false ) {
-        global $bp;
-        
-        if ( !$name )
-                return false;
-        
-        $key = isset( $bp-&gt;user_meta_keys-&gt;$name ) ? $bp-&gt;user_meta_keys-&gt;$name : false;
-        
-        return apply_filters( 'bp_get_user_meta_key', $key, $name );
</del><ins>+function bp_get_user_meta_key( $key = false ) {
+        return apply_filters( 'bp_get_user_meta_key', $key );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /** Global Manipulators *******************************************************/
</span></span></pre></div>
<a id="trunkbpcorebpcoreloaderphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/bp-core-loader.php (4377 => 4378)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/bp-core-loader.php        2011-05-16 21:41:01 UTC (rev 4377)
+++ trunk/bp-core/bp-core-loader.php        2011-05-16 22:22:39 UTC (rev 4378)
</span><span class="lines">@@ -149,10 +149,6 @@
</span><span class="cx"> 
</span><span class="cx">                 // The user ID of the user who is currently logged in.
</span><span class="cx">                 $bp-&gt;loggedin_user-&gt;id   = $current_user-&gt;ID;
</span><del>-                
-                // Keys for BP user_meta
-                $bp-&gt;user_meta_keys-&gt;last_activity         = apply_filters( 'bp_user_meta_key_last_activity', 'last_activity' );
-                $bp-&gt;user_meta_keys-&gt;closed_notices         = apply_filters( 'bp_user_meta_key_closed_notices', 'closed_notices' );
</del><span class="cx"> 
</span><span class="cx">                 /** Avatars ***********************************************************/
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkbpfriendsbpfriendsloaderphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-friends/bp-friends-loader.php (4377 => 4378)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-friends/bp-friends-loader.php        2011-05-16 21:41:01 UTC (rev 4377)
+++ trunk/bp-friends/bp-friends-loader.php        2011-05-16 22:22:39 UTC (rev 4378)
</span><span class="lines">@@ -70,13 +70,6 @@
</span><span class="cx">                         'table_name'      =&gt; $bp-&gt;table_prefix . 'bp_friends',
</span><span class="cx">                         'table_name_meta' =&gt; $bp-&gt;table_prefix . 'bp_friends_meta',
</span><span class="cx">                 );
</span><del>-                
-                // User meta keys
-                $user_meta_keys        = array(
-                        'total_friend_count'                                 =&gt; 'total_friend_count',
-                        'notification_friends_friendship_request'        =&gt; 'notification_friends_friendship_request',
-                        'notification_friends_friendship_accepted'        =&gt; 'notification_friends_friendship_accepted'
-                );
</del><span class="cx"> 
</span><span class="cx">                 // All globals for the friends component.
</span><span class="cx">                 // Note that global_tables is included in this array.
</span><span class="lines">@@ -85,8 +78,7 @@
</span><span class="cx">                         'slug'                  =&gt; BP_FRIENDS_SLUG,
</span><span class="cx">                         'search_string'         =&gt; __( 'Search Friends...', 'buddypress' ),
</span><span class="cx">                         'notification_callback' =&gt; 'friends_format_notifications',
</span><del>-                        'global_tables'         =&gt; $global_tables,
-                        'user_meta_keys'        =&gt; $user_meta_keys
</del><ins>+                        'global_tables'         =&gt; $global_tables
</ins><span class="cx">                 );
</span><span class="cx"> 
</span><span class="cx">                 parent::_setup_globals( $globals );
</span></span></pre></div>
<a id="trunkbpgroupsbpgroupsfunctionsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-groups/bp-groups-functions.php (4377 => 4378)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-groups/bp-groups-functions.php        2011-05-16 21:41:01 UTC (rev 4377)
+++ trunk/bp-groups/bp-groups-functions.php        2011-05-16 22:22:39 UTC (rev 4378)
</span><span class="lines">@@ -248,7 +248,7 @@
</span><span class="cx">         groups_update_groupmeta( $group_id, 'total_member_count', (int) groups_get_groupmeta( $group_id, 'total_member_count') - 1 );
</span><span class="cx"> 
</span><span class="cx">         // Modify user's group memberhip count
</span><del>-        update_user_meta( $user_id, $bp-&gt;user_meta_keys-&gt;total_group_count, (int) get_user_meta( $user_id, bp_get_user_meta_key( 'total_group_count' ), true ) - 1 );
</del><ins>+        update_user_meta( $user_id, bp_get_user_meta_key( 'total_group_count' ), (int) get_user_meta( $user_id, bp_get_user_meta_key( 'total_group_count' ), true ) - 1 );
</ins><span class="cx"> 
</span><span class="cx">         /**
</span><span class="cx">          * If the user joined this group less than five minutes ago, remove the
</span></span></pre></div>
<a id="trunkbpgroupsbpgroupsloaderphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-groups/bp-groups-loader.php (4377 => 4378)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-groups/bp-groups-loader.php        2011-05-16 21:41:01 UTC (rev 4377)
+++ trunk/bp-groups/bp-groups-loader.php        2011-05-16 22:22:39 UTC (rev 4378)
</span><span class="lines">@@ -73,16 +73,6 @@
</span><span class="cx">                         'table_name_members'   =&gt; $bp-&gt;table_prefix . 'bp_groups_members',
</span><span class="cx">                         'table_name_groupmeta' =&gt; $bp-&gt;table_prefix . 'bp_groups_groupmeta'
</span><span class="cx">                 );
</span><del>-                
-                // User meta_keys
-                $user_meta_keys = array(
-                        'total_group_count'                                 =&gt; 'total_group_count',
-                        'notification_groups_group_updated'             =&gt; 'notification_groups_group_updated',
-                        'notification_groups_membership_request'    =&gt; 'notification_groups_membership_request',
-                        'notification_membership_request_completed' =&gt; 'notification_membership_request_completed',
-                        'notification_groups_invite'                    =&gt; 'notification_groups_invite',
-                        'notification_groups_admin_promotion'            =&gt; 'notification_groups_admin_promotion'
-                );
</del><span class="cx"> 
</span><span class="cx">                 // All globals for messaging component.
</span><span class="cx">                 // Note that global_tables is included in this array.
</span><span class="lines">@@ -91,8 +81,7 @@
</span><span class="cx">                         'root_slug'             =&gt; isset( $bp-&gt;pages-&gt;groups-&gt;slug ) ? $bp-&gt;pages-&gt;groups-&gt;slug : BP_GROUPS_SLUG,
</span><span class="cx">                         'notification_callback' =&gt; 'groups_format_notifications',
</span><span class="cx">                         'search_string'         =&gt; __( 'Search Groups...', 'buddypress' ),
</span><del>-                        'global_tables'         =&gt; $global_tables,
-                        'user_meta_keys'        =&gt; $user_meta_keys
</del><ins>+                        'global_tables'         =&gt; $global_tables
</ins><span class="cx">                 );
</span><span class="cx"> 
</span><span class="cx">                 parent::_setup_globals( $globals );
</span></span></pre></div>
<a id="trunkbpmessagesbpmessagesloaderphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-messages/bp-messages-loader.php (4377 => 4378)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-messages/bp-messages-loader.php        2011-05-16 21:41:01 UTC (rev 4377)
+++ trunk/bp-messages/bp-messages-loader.php        2011-05-16 22:22:39 UTC (rev 4378)
</span><span class="lines">@@ -70,19 +70,13 @@
</span><span class="cx">                         'table_name_recipients' =&gt; $bp-&gt;table_prefix . 'bp_messages_recipients'
</span><span class="cx">                 );
</span><span class="cx">                 
</span><del>-                $user_meta_keys = array(
-                        'notification_messages_new_message' =&gt; 'notification_messages_new_message',
-                        'notification_messages_new_notice'  =&gt; 'notification_messages_new_notice'
-                );
-
</del><span class="cx">                 // All globals for messaging component.
</span><span class="cx">                 // Note that global_tables is included in this array.
</span><span class="cx">                 $globals = array(
</span><span class="cx">                         'slug'                  =&gt; BP_MESSAGES_SLUG,
</span><span class="cx">                         'notification_callback' =&gt; 'messages_format_notifications',
</span><span class="cx">                         'search_string'         =&gt; __( 'Search Messages...', 'buddypress' ),
</span><del>-                        'global_tables'         =&gt; $global_tables,
-                        'user_meta_keys'        =&gt; $user_meta_keys
</del><ins>+                        'global_tables'         =&gt; $global_tables
</ins><span class="cx">                 );
</span><span class="cx"> 
</span><span class="cx">                 $this-&gt;autocomplete_all = defined( 'BP_MESSAGES_AUTOCOMPLETE_ALL' );
</span></span></pre></div>
<a id="trunkbpxprofilebpxprofileloaderphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-xprofile/bp-xprofile-loader.php (4377 => 4378)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-xprofile/bp-xprofile-loader.php        2011-05-16 21:41:01 UTC (rev 4377)
+++ trunk/bp-xprofile/bp-xprofile-loader.php        2011-05-16 22:22:39 UTC (rev 4378)
</span><span class="lines">@@ -92,16 +92,11 @@
</span><span class="cx">                         'table_name_meta'        =&gt; $bp-&gt;table_prefix . 'bp_xprofile_meta',
</span><span class="cx">                 );
</span><span class="cx"> 
</span><del>-                $user_meta_keys = array(
-                        'profile_last_updated' =&gt; 'profile_last_updated'
-                );
-
</del><span class="cx">                 $globals = array(
</span><span class="cx">                         'slug'                  =&gt; BP_XPROFILE_SLUG,
</span><span class="cx">                         'root_slug'             =&gt; isset( $bp-&gt;pages-&gt;xprofile-&gt;slug ) ? $bp-&gt;pages-&gt;xprofile-&gt;slug : BP_XPROFILE_SLUG,
</span><span class="cx">                         'notification_callback' =&gt; 'xprofile_format_notifications',
</span><del>-                        'global_tables'         =&gt; $global_tables,
-                        'user_meta_keys'        =&gt; $user_meta_keys
</del><ins>+                        'global_tables'         =&gt; $global_tables
</ins><span class="cx">                 );
</span><span class="cx"> 
</span><span class="cx">                 parent::_setup_globals( $globals );
</span></span></pre>
</div>
</div>

</body>
</html>