Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
05/16/2011 10:22:39 PM (14 years ago)
Author:
boonebgorges
Message:

Refactors user_meta key filtering to remove overhead in the bp global. Fixes #2952. Props nacin.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-functions.php

    r4372 r4378  
    2828
    2929    $page_blog_id = $is_enable_multiblog ? get_current_blog_id() : BP_ROOT_BLOG;
    30    
     30
    3131    // Upgrading from an earlier version of BP pre-1.3
    3232    if ( empty( $page_ids ) || isset( $page_ids['members'] ) ) {       
     
    10011001 * BuddyPress stores a number of pieces of userdata in the WordPress central usermeta table. In
    10021002 * order to allow plugins to enable multiple instances of BuddyPress on a single WP installation,
    1003  * BP's usermeta keys are abstracted and stored in the $bp global, at $bp->user_meta_keys.
     1003 * BP's usermeta keys are filtered with this function, so that they can be altered on the fly.
    10041004 *
    10051005 * Plugin authors who access or modify metadata created by BuddyPress should use
     
    10091009 *
    10101010 * If your plugin introduces custom user metadata that might change between multiple BP instances
    1011  * on a single WP installation, you are strongly recommended to register your meta keys in the $bp
    1012  * global (see BP_Core_Component::setup_globals()), and use this function when storing and
     1011 * on a single WP installation, you are strongly recommended to use this function when storing and
    10131012 * retrieving metadata.
    10141013 *
    10151014 * @package BuddyPress
    10161015 * @since 1.3
    1017  * @see BP_Core_Component::_setup_globals()
    10181016 *
    10191017 * @uses apply_filters() Filter bp_get_user_meta_key to modify keys individually
    1020  * @param str $name
     1018 * @param str $key
    10211019 * @return str $key
    10221020 */
    1023 function bp_get_user_meta_key( $name = false ) {
    1024     global $bp;
    1025    
    1026     if ( !$name )
    1027         return false;
    1028    
    1029     $key = isset( $bp->user_meta_keys->$name ) ? $bp->user_meta_keys->$name : false;
    1030    
    1031     return apply_filters( 'bp_get_user_meta_key', $key, $name );
     1021function bp_get_user_meta_key( $key = false ) {
     1022    return apply_filters( 'bp_get_user_meta_key', $key );
    10321023}
    10331024
Note: See TracChangeset for help on using the changeset viewer.