Skip to:
Content

BuddyPress.org

Changeset 4558


Ignore:
Timestamp:
06/24/2011 06:52:57 PM (10 years ago)
Author:
boonebgorges
Message:

Introduces bp_x_user_meta() wrapper functions. Refactors internal user_meta calls to use the new functions. Fixes #3299

Location:
trunk
Files:
24 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-activity/bp-activity-classes.php

    r4378 r4558  
    524524
    525525    function total_favorite_count( $user_id ) {
    526         if ( !$favorite_activity_entries = get_user_meta( $user_id, bp_get_user_meta_key( 'bp_favorite_activities' ), true ) )
     526        if ( !$favorite_activity_entries = bp_get_user_meta( $user_id, 'bp_favorite_activities', true ) )
    527527            return 0;
    528528
  • trunk/bp-activity/bp-activity-functions.php

    r4553 r4558  
    3939 */
    4040function bp_activity_clear_new_mentions( $user_id ) {
    41     delete_user_meta( $user_id, bp_get_user_meta_key( 'bp_new_mention_count' ) );
    42     delete_user_meta( $user_id, bp_get_user_meta_key( 'bp_new_mentions' ) );
     41    bp_delete_user_meta( $user_id, 'bp_new_mention_count' );
     42    bp_delete_user_meta( $user_id, 'bp_new_mentions' );
    4343}
    4444
     
    6565
    6666            // Adjust the mention list and count for the member
    67             $new_mention_count = (int)get_user_meta( $user_id, bp_get_user_meta_key( 'bp_new_mention_count' ), true );
    68             if ( !$new_mentions = get_user_meta( $user_id, bp_get_user_meta_key( 'bp_new_mentions' ), true ) )
     67            $new_mention_count = (int)bp_get_user_meta( $user_id, 'bp_new_mention_count', true );
     68            if ( !$new_mentions = bp_get_user_meta( $user_id, 'bp_new_mentions', true ) )
    6969                $new_mentions = array();
    7070
     
    8989
    9090            // Resave the user_meta
    91             update_user_meta( $user_id, bp_get_user_meta_key( 'bp_new_mention_count' ), $new_mention_count );
    92             update_user_meta( $user_id, bp_get_user_meta_key( 'bp_new_mentions' ), $new_mentions );
     91            bp_update_user_meta( $user_id, 'bp_new_mention_count', $new_mention_count );
     92            bp_update_user_meta( $user_id, 'bp_new_mentions', $new_mentions );
    9393        }
    9494    }
     
    191191
    192192    // Get favorites for user
    193     $favs = get_user_meta( $user_id, bp_get_user_meta_key( 'bp_favorite_activities' ), true );
     193    $favs = bp_get_user_meta( $user_id, 'bp_favorite_activities', true );
    194194
    195195    return apply_filters( 'bp_activity_get_user_favorites', $favs );
     
    216216
    217217    // Update the user's personal favorites
    218     $my_favs   = get_user_meta( $bp->loggedin_user->id, bp_get_user_meta_key( 'bp_favorite_activities' ), true );
     218    $my_favs   = bp_get_user_meta( $bp->loggedin_user->id, 'bp_favorite_activities', true );
    219219    $my_favs[] = $activity_id;
    220220
     
    224224
    225225    // Update user meta
    226     update_user_meta( $bp->loggedin_user->id, bp_get_user_meta_key( 'bp_favorite_activities' ), $my_favs );
     226    bp_update_user_meta( $bp->loggedin_user->id, 'bp_favorite_activities', $my_favs );
    227227
    228228    // Update activity meta counts
     
    256256
    257257    // Remove the fav from the user's favs
    258     $my_favs = get_user_meta( $user_id, bp_get_user_meta_key( 'bp_favorite_activities' ), true );
     258    $my_favs = bp_get_user_meta( $user_id, 'bp_favorite_activities', true );
    259259    $my_favs = array_flip( (array) $my_favs );
    260260    unset( $my_favs[$activity_id] );
     
    268268
    269269            // Update users favorites
    270             if ( update_user_meta( $user_id, bp_get_user_meta_key( 'bp_favorite_activities' ), $my_favs ) ) {
     270            if ( bp_update_user_meta( $user_id, 'bp_favorite_activities', $my_favs ) ) {
    271271
    272272                // Execute additional code
     
    500500
    501501    // Remove any usermeta
    502     delete_user_meta( $user_id, bp_get_user_meta_key( 'bp_latest_update' ) );
    503     delete_user_meta( $user_id, bp_get_user_meta_key( 'bp_favorite_activities' ) );
     502    bp_delete_user_meta( $user_id, 'bp_latest_update' );
     503    bp_delete_user_meta( $user_id, 'bp_favorite_activities' );
    504504
    505505    // Execute additional code
     
    676676
    677677    // Add this update to the "latest update" usermeta so it can be fetched anywhere.
    678     update_user_meta( $bp->loggedin_user->id, bp_get_user_meta_key( 'bp_latest_update' ), array( 'id' => $activity_id, 'content' => wp_filter_kses( $content ) ) );
     678    bp_update_user_meta( $bp->loggedin_user->id, 'bp_latest_update', array( 'id' => $activity_id, 'content' => wp_filter_kses( $content ) ) );
    679679
    680680    // Require the notifications code so email notifications can be set on the 'bp_activity_posted_update' action.
     
    808808    do_action( 'bp_before_activity_delete', $args );
    809809
    810     $latest_update = get_user_meta( $user_id, bp_get_user_meta_key( 'bp_latest_update' ), true );
     810    $latest_update = bp_get_user_meta( $user_id, 'bp_latest_update', true );
    811811    if ( !empty( $latest_update ) ) {
    812812        if ( in_array( (int)$latest_update['id'], (array)$activity_ids_deleted ) )
    813             delete_user_meta( $user_id, bp_get_user_meta_key( 'bp_latest_update' ) );
     813            bp_delete_user_meta( $user_id, 'bp_latest_update' );
    814814    }
    815815
  • trunk/bp-activity/bp-activity-notifications.php

    r4372 r4558  
    3535
    3636        // Now email the user with the contents of the message (if they have enabled email notifications)
    37         if ( 'no' != get_user_meta( $receiver_user_id, bp_get_user_meta_key( 'notification_activity_new_mention' ), true ) ) {
     37        if ( 'no' != bp_get_user_meta( $receiver_user_id, 'notification_activity_new_mention', true ) ) {
    3838            $poster_name = bp_core_get_user_displayname( $poster_user_id );
    3939
     
    8282    $original_activity = new BP_Activity_Activity( $activity_id );
    8383
    84     if ( $original_activity->user_id != $commenter_id && 'no' != get_user_meta( $original_activity->user_id, bp_get_user_meta_key( 'notification_activity_new_reply' ), true ) ) {
     84    if ( $original_activity->user_id != $commenter_id && 'no' != bp_get_user_meta( $original_activity->user_id, 'notification_activity_new_reply', true ) ) {
    8585        $poster_name = bp_core_get_user_displayname( $commenter_id );
    8686        $thread_link = bp_activity_get_permalink( $activity_id );
     
    127127    $parent_comment = new BP_Activity_Activity( $parent_id );
    128128
    129     if ( $parent_comment->user_id != $commenter_id && $original_activity->user_id != $parent_comment->user_id && 'no' != get_user_meta( $parent_comment->user_id, bp_get_user_meta_key( 'notification_activity_new_reply' ), true ) ) {
     129    if ( $parent_comment->user_id != $commenter_id && $original_activity->user_id != $parent_comment->user_id && 'no' != bp_get_user_meta( $parent_comment->user_id, 'notification_activity_new_reply', true ) ) {
    130130        $poster_name = bp_core_get_user_displayname( $commenter_id );
    131131        $thread_link = bp_activity_get_permalink( $activity_id );
  • trunk/bp-activity/bp-activity-screens.php

    r4520 r4558  
    157157    global $bp;
    158158
    159     if ( !$mention = get_user_meta( $bp->displayed_user->id, bp_get_user_meta_key( 'notification_activity_new_mention' ), true ) )
     159    if ( !$mention = bp_get_user_meta( $bp->displayed_user->id, 'notification_activity_new_mention', true ) )
    160160        $mention = 'yes';
    161161
    162     if ( !$reply = get_user_meta( $bp->displayed_user->id, bp_get_user_meta_key( 'notification_activity_new_reply' ), true ) )
     162    if ( !$reply = bp_get_user_meta( $bp->displayed_user->id, 'notification_activity_new_reply', true ) )
    163163        $reply = 'yes'; ?>
    164164
  • trunk/bp-activity/bp-activity-template.php

    r4548 r4558  
    9494
    9595        // Get an array of the logged in user's favorite activities
    96         $this->my_favs = maybe_unserialize( get_user_meta( $bp->loggedin_user->id, bp_get_user_meta_key( 'bp_favorite_activities' ), true ) );
     96        $this->my_favs = maybe_unserialize( bp_get_user_meta( $bp->loggedin_user->id, 'bp_favorite_activities', true ) );
    9797
    9898        // Fetch specific activity items based on ID's
     
    12301230            $user_id = $bp->displayed_user->id;
    12311231
    1232         if ( !$update = get_user_meta( $user_id, bp_get_user_meta_key( 'bp_latest_update' ), true ) )
     1232        if ( !$update = bp_get_user_meta( $user_id, 'bp_latest_update', true ) )
    12331233            return false;
    12341234
     
    13481348        global $bp;
    13491349
    1350         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 ) );
     1350        return apply_filters( 'bp_get_total_mention_count_for_user', bp_get_user_meta( $user_id, 'bp_new_mention_count', true ) );
    13511351    }
    13521352
  • trunk/bp-core/bp-core-classes.php

    r4462 r4558  
    137137     * @uses bp_core_get_userlink() Returns a HTML formatted link for a user with the user's full name as the link text
    138138     * @uses bp_core_get_user_email() Returns the email address for the user based on user ID
    139      * @uses get_user_meta() WordPress function returns the value of passed usermeta name from usermeta table
     139     * @uses bp_get_user_meta() BP function returns the value of passed usermeta name from usermeta table
    140140     * @uses bp_core_fetch_avatar() Returns HTML formatted avatar for a user
    141141     * @uses bp_profile_last_updated_date() Returns the last updated date for a user.
     
    167167        $this->avatar_thumb = bp_core_fetch_avatar( array( 'item_id' => $this->id, 'type' => 'thumb' ) );
    168168        $this->avatar_mini  = bp_core_fetch_avatar( array( 'item_id' => $this->id, 'type' => 'thumb', 'width' => 30, 'height' => 30 ) );
    169         $this->last_active  = bp_core_get_last_activity( get_user_meta( $this->id, bp_get_user_meta_key( 'last_activity' ), true ), __( 'active %s ago', 'buddypress' ) );
     169        $this->last_active  = bp_core_get_last_activity( bp_get_user_meta( $this->id, 'last_activity', true ), __( 'active %s ago', 'buddypress' ) );
    170170    }
    171171
  • trunk/bp-core/bp-core-functions.php

    r4556 r4558  
    656656 * @package BuddyPress Core
    657657 * @global $userdata WordPress user data for the current logged in user.
    658  * @uses update_user_meta() WordPress function to update user metadata in the usermeta table.
     658 * @uses bp_update_user_meta() BP function to update user metadata in the usermeta table.
    659659 */
    660660function bp_core_record_activity() {
     
    664664        return false;
    665665
    666     $activity = get_user_meta( $bp->loggedin_user->id, bp_get_user_meta_key( 'last_activity' ), true );
     666    $activity = bp_get_user_meta( $bp->loggedin_user->id, 'last_activity', true );
    667667
    668668    if ( !is_numeric( $activity ) )
     
    673673
    674674    if ( empty( $activity ) || strtotime( $current_time ) >= strtotime( '+5 minutes', $activity ) )
    675         update_user_meta( $bp->loggedin_user->id, bp_get_user_meta_key( 'last_activity' ), $current_time );
     675        bp_update_user_meta( $bp->loggedin_user->id, 'last_activity', $current_time );
    676676}
    677677add_action( 'wp_head', 'bp_core_record_activity' );
     
    10251025 * BP's usermeta keys are filtered with this function, so that they can be altered on the fly.
    10261026 *
    1027  * Plugin authors who access or modify metadata created by BuddyPress should use
    1028  * this function exclusively in the context of the _user_meta() functions. For example,
     1027 * Plugin authors should use BP's _user_meta() functions, which bakes in bp_get_user_meta_key().
     1028 *    $last_active = bp_get_user_meta( $user_id, 'last_activity', true );
     1029 * If you have to use WP's _user_meta() functions for some reason, you should use this function, eg
    10291030 *    $last_active = get_user_meta( $user_id, bp_get_user_meta_key( 'last_activity' ), true );
    1030  * Do not hardcode these keys.
    1031  *
    1032  * If your plugin introduces custom user metadata that might change between multiple BP instances
    1033  * on a single WP installation, you are strongly recommended to use this function when storing and
    1034  * retrieving metadata.
     1031 * If using the WP functions, do not not hardcode your meta keys.
    10351032 *
    10361033 * @package BuddyPress
     
    10441041    return apply_filters( 'bp_get_user_meta_key', $key );
    10451042}
     1043
     1044/**
     1045 * Get a piece of usermeta
     1046 *
     1047 * This is a wrapper for get_user_meta() that allows for easy use of bp_get_user_meta_key(), thereby
     1048 * increasing compatibility with non-standard BP setups.
     1049 *
     1050 * @package BuddyPress
     1051 * @since 1.3
     1052 *
     1053 * @uses bp_get_user_meta_key() For a filterable version of the meta key
     1054 * @uses get_user_meta() See get_user_meta() docs for more details on parameters
     1055 * @param int $user_id The id of the user whose meta you're fetching
     1056 * @param string $key The meta key to retrieve.
     1057 * @param bool $single Whether to return a single value.
     1058 * @return mixed Will be an array if $single is false. Will be value of meta data field if $single
     1059 *  is true.
     1060 */
     1061function bp_get_user_meta( $user_id, $key, $single = false ) {
     1062    return get_user_meta( $user_id, bp_get_user_meta_key( $key ), $single );
     1063}
     1064
     1065/**
     1066 * Update a piece of usermeta
     1067 *
     1068 * This is a wrapper for update_user_meta() that allows for easy use of bp_get_user_meta_key(),
     1069 * thereby increasing compatibility with non-standard BP setups.
     1070 *
     1071 * @package BuddyPress
     1072 * @since 1.3
     1073 *
     1074 * @uses bp_get_user_meta_key() For a filterable version of the meta key
     1075 * @uses update_user_meta() See update_user_meta() docs for more details on parameters
     1076 * @param int $user_id The id of the user whose meta you're setting
     1077 * @param string $key The meta key to set.
     1078 * @param mixed $value Metadata value.
     1079 * @param mixed $prev_value Optional. Previous value to check before removing.
     1080 * @return bool False on failure, true if success.
     1081 */
     1082function bp_update_user_meta( $user_id, $key, $value, $prev_value = '' ) {
     1083    return update_user_meta( $user_id, bp_get_user_meta_key( $key ), $value, $prev_value );
     1084}
     1085
     1086/**
     1087 * Delete a piece of usermeta
     1088 *
     1089 * This is a wrapper for delete_user_meta() that allows for easy use of bp_get_user_meta_key(),
     1090 * thereby increasing compatibility with non-standard BP setups.
     1091 *
     1092 * @package BuddyPress
     1093 * @since 1.3
     1094 *
     1095 * @uses bp_get_user_meta_key() For a filterable version of the meta key
     1096 * @uses delete_user_meta() See delete_user_meta() docs for more details on parameters
     1097 * @param int $user_id The id of the user whose meta you're deleting
     1098 * @param string $key The meta key to delete.
     1099 * @param mixed $value Optional. Metadata value.
     1100 * @return bool False for failure. True for success.
     1101 */
     1102function bp_delete_user_meta( $user_id, $key, $value = '' ) {
     1103    return delete_user_meta( $user_id, bp_get_user_meta_key( $key ), $value );
     1104}
     1105
    10461106
    10471107/** Global Manipulators *******************************************************/
  • trunk/bp-friends/bp-friends-classes.php

    r4444 r4558  
    133133
    134134        // Do not update meta if user has never had friends
    135         if ( !$count && !get_user_meta( $user_id, bp_get_user_meta_key( 'total_friend_count' ), true ) )
     135        if ( !$count && !bp_get_user_meta( $user_id, 'total_friend_count', true ) )
    136136            return 0;
    137137
    138         update_user_meta( $user_id, bp_get_user_meta_key( 'total_friend_count' ), (int)$count );
     138        bp_update_user_meta( $user_id, 'total_friend_count', (int)$count );
    139139        return (int)$count;
    140140    }
  • trunk/bp-friends/bp-friends-functions.php

    r4372 r4558  
    156156
    157157    if ( !$count = wp_cache_get( 'bp_total_friend_count_' . $user_id, 'bp' ) ) {
    158         $count = get_user_meta( $user_id, bp_get_user_meta_key( 'total_friend_count' ), true );
     158        $count = bp_get_user_meta( $user_id, 'total_friend_count', true );
    159159        if ( empty( $count ) ) $count = 0;
    160160        wp_cache_set( 'bp_total_friend_count_' . $user_id, $count, 'bp' );
     
    259259    global $bp;
    260260   
    261     $meta_key = bp_get_user_meta_key( 'total_friend_count' );
    262    
    263261    if ( 'add' == $status ) {
    264         update_user_meta( $initiator_user_id, $meta_key, (int)get_user_meta( $initiator_user_id, $meta_key, true ) + 1 );
    265         update_user_meta( $friend_user_id, $meta_key, (int)get_user_meta( $friend_user_id, $meta_key, true ) + 1 );
     262        bp_update_user_meta( $initiator_user_id, 'total_friend_count', (int)bp_get_user_meta( $initiator_user_id, 'total_friend_count', true ) + 1 );
     263        bp_update_user_meta( $friend_user_id, 'total_friend_count', (int)bp_get_user_meta( $friend_user_id, 'total_friend_count', true ) + 1 );
    266264    } else {
    267         update_user_meta( $initiator_user_id, $meta_key, (int)get_user_meta( $initiator_user_id, $meta_key, true ) - 1 );
    268         update_user_meta( $friend_user_id, $meta_key, (int)get_user_meta( $friend_user_id, $meta_key, true ) - 1 );
     265        bp_update_user_meta( $initiator_user_id, 'total_friend_count', (int)bp_get_user_meta( $initiator_user_id, 'total_friend_count', true ) - 1 );
     266        bp_update_user_meta( $friend_user_id, 'total_friend_count', (int)bp_get_user_meta( $friend_user_id, 'total_friend_count', true ) - 1 );
    269267    }
    270268}
     
    278276
    279277    // Remove usermeta
    280     delete_user_meta( $user_id, bp_get_user_meta_key( 'total_friend_count' ) );
     278    bp_delete_user_meta( $user_id, 'total_friend_count' );
    281279
    282280    // Remove friendship requests FROM user
  • trunk/bp-friends/bp-friends-notifications.php

    r4372 r4558  
    66    $initiator_name = bp_core_get_user_displayname( $initiator_id );
    77
    8     if ( 'no' == get_user_meta( (int)$friend_id, bp_get_user_meta_key( 'notification_friends_friendship_request' ), true ) )
     8    if ( 'no' == bp_get_user_meta( (int)$friend_id, 'notification_friends_friendship_request', true ) )
    99        return false;
    1010
     
    5151    $friend_name = bp_core_get_user_displayname( $friend_id );
    5252
    53     if ( 'no' == get_user_meta( (int)$initiator_id, bp_get_user_meta_key( 'notification_friends_friendship_accepted' ), true ) )
     53    if ( 'no' == bp_get_user_meta( (int)$initiator_id, 'notification_friends_friendship_accepted', true ) )
    5454        return false;
    5555
  • trunk/bp-friends/bp-friends-screens.php

    r4372 r4558  
    5555    global $bp;
    5656
    57     if ( !$send_requests = get_user_meta( $bp->displayed_user->id, bp_get_user_meta_key( 'notification_friends_friendship_request' ), true ) )
     57    if ( !$send_requests = bp_get_user_meta( $bp->displayed_user->id, 'notification_friends_friendship_request', true ) )
    5858        $send_requests   = 'yes';
    5959
    60     if ( !$accept_requests = get_user_meta( $bp->displayed_user->id, bp_get_user_meta_key( 'notification_friends_friendship_accepted' ), true ) )
     60    if ( !$accept_requests = bp_get_user_meta( $bp->displayed_user->id, 'notification_friends_friendship_accepted', true ) )
    6161        $accept_requests = 'yes';
    6262?>
  • trunk/bp-groups/bp-groups-classes.php

    r4471 r4558  
    731731        groups_update_groupmeta( $this->group_id, 'total_member_count', ( (int) groups_get_groupmeta( $this->group_id, 'total_member_count' ) - 1 ) );
    732732
    733         $group_count = get_user_meta( $this->user_id, bp_get_user_meta_key( 'total_group_count' ), true );
     733        $group_count = bp_get_user_meta( $this->user_id, 'total_group_count', true );
    734734        if ( !empty( $group_count ) )
    735             update_user_meta( $this->user_id, bp_get_user_meta_key( 'total_group_count' ), (int)$group_count - 1 );
     735            bp_update_user_meta( $this->user_id, 'total_group_count', (int)$group_count - 1 );
    736736
    737737        return $this->save();
     
    747747
    748748        groups_update_groupmeta( $this->group_id, 'total_member_count', ( (int) groups_get_groupmeta( $this->group_id, 'total_member_count' ) + 1 ) );
    749         update_user_meta( $this->user_id, bp_get_user_meta_key( 'total_group_count' ), (int)get_user_meta( $this->user_id, bp_get_user_meta_key( 'total_group_count' ), true ) + 1 );
     749        bp_update_user_meta( $this->user_id, 'total_group_count', (int)bp_get_user_meta( $this->user_id, 'total_group_count', true ) + 1 );
    750750
    751751        return $this->save();
     
    759759        $this->date_modified = bp_core_current_time();
    760760
    761         update_user_meta( $this->user_id, bp_get_user_meta_key( 'total_group_count' ), (int)get_user_meta( $this->user_id, bp_get_user_meta_key( 'total_group_count' ), true ) + 1 );
     761        bp_update_user_meta( $this->user_id, 'total_group_count', (int)bp_get_user_meta( $this->user_id, 'total_group_count', true ) + 1 );
    762762    }
    763763
     
    768768        $this->date_modified = bp_core_current_time();
    769769
    770         update_user_meta( $this->user_id, bp_get_user_meta_key( 'total_group_count' ), (int)get_user_meta( $this->user_id, bp_get_user_meta_key( 'total_group_count' ), true ) + 1 );
     770        bp_update_user_meta( $this->user_id, 'total_group_count', (int)bp_get_user_meta( $this->user_id, 'total_group_count', true ) + 1 );
    771771    }
    772772
     
    781781        groups_update_groupmeta( $this->group_id, 'total_member_count', ( (int) groups_get_groupmeta( $this->group_id, 'total_member_count' ) - 1 ) );
    782782
    783         $group_count = get_user_meta( $this->user_id, bp_get_user_meta_key( 'total_group_count' ), true );
     783        $group_count = bp_get_user_meta( $this->user_id, 'total_group_count', true );
    784784        if ( !empty( $group_count ) )
    785             update_user_meta( $this->user_id, bp_get_user_meta_key( 'total_group_count' ), (int)$group_count - 1 );
     785            bp_update_user_meta( $this->user_id, 'total_group_count', (int)$group_count - 1 );
    786786
    787787        return $result;
  • trunk/bp-groups/bp-groups-functions.php

    r4524 r4558  
    253253
    254254    // Modify user's group memberhip count
    255     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 );
     255    bp_update_user_meta( $user_id, 'total_group_count', (int) bp_get_user_meta( $user_id, 'total_group_count', true ) - 1 );
    256256
    257257    /**
  • trunk/bp-groups/bp-groups-notifications.php

    r4372 r4558  
    1010    $user_ids = BP_Groups_Member::get_group_member_ids( $group->id );
    1111    foreach ( (array)$user_ids as $user_id ) {
    12         if ( 'no' == get_user_meta( $user_id, bp_get_user_meta_key( 'notification_groups_group_updated' ), true ) ) continue;
     12        if ( 'no' == bp_get_user_meta( $user_id, 'notification_groups_group_updated', true ) ) continue;
    1313
    1414        $ud = bp_core_get_core_userdata( $user_id );
     
    4848    bp_members_add_notification( $requesting_user_id, $admin_id, 'groups', 'new_membership_request', $group_id );
    4949
    50     if ( 'no' == get_user_meta( $admin_id, bp_get_user_meta_key( 'notification_groups_membership_request' ), true ) )
     50    if ( 'no' == bp_get_user_meta( $admin_id, 'notification_groups_membership_request', true ) )
    5151        return false;
    5252
     
    100100        bp_members_add_notification( $group_id, $requesting_user_id, 'groups', 'membership_request_rejected' );
    101101
    102     if ( 'no' == get_user_meta( $requesting_user_id, bp_get_user_meta_key( 'notification_membership_request_completed' ), true ) )
     102    if ( 'no' == bp_get_user_meta( $requesting_user_id, 'notification_membership_request_completed', true ) )
    103103        return false;
    104104
     
    161161    bp_members_add_notification( $group_id, $user_id, 'groups', $type );
    162162
    163     if ( 'no' == get_user_meta( $user_id, bp_get_user_meta_key( 'notification_groups_admin_promotion' ), true ) )
     163    if ( 'no' == bp_get_user_meta( $user_id, 'notification_groups_admin_promotion', true ) )
    164164        return false;
    165165
     
    211211        bp_members_add_notification( $group->id, $invited_user_id, 'groups', 'group_invite' );
    212212
    213         if ( 'no' == get_user_meta( $invited_user_id, bp_get_user_meta_key( 'notification_groups_invite' ), true ) )
     213        if ( 'no' == bp_get_user_meta( $invited_user_id, 'notification_groups_invite', true ) )
    214214            return false;
    215215
     
    272272
    273273        // Now email the user with the contents of the message (if they have enabled email notifications)
    274         if ( 'no' != get_user_meta( $user_id, bp_get_user_meta_key( 'notification_activity_new_mention' ), true ) ) {
     274        if ( 'no' != bp_get_user_meta( $user_id, 'notification_activity_new_mention', true ) ) {
    275275            $poster_name = bp_core_get_user_displayname( $poster_user_id );
    276276
  • trunk/bp-groups/bp-groups-screens.php

    r4524 r4558  
    794794add_action( 'bp_screens', 'groups_screen_group_admin_delete_group' );
    795795
     796/**
     797 * Renders the group settings fields on the Notification Settings page
     798 *
     799 * @package BuddyPress
     800 */
    796801function groups_screen_notification_settings() {
    797802    global $bp;
    798803
    799     if ( !$group_invite = get_user_meta( $bp->displayed_user->id, bp_get_user_meta_key( 'notification_groups_invite' ), true ) )
     804    if ( !$group_invite = bp_get_user_meta( $bp->displayed_user->id, 'notification_groups_invite', true ) )
    800805        $group_invite  = 'yes';
    801806
    802     if ( !$group_update = get_user_meta( $bp->displayed_user->id, bp_get_user_meta_key( 'notification_groups_group_updated' ), true ) )
     807    if ( !$group_update = bp_get_user_meta( $bp->displayed_user->id, 'notification_groups_group_updated', true ) )
    803808        $group_update  = 'yes';
    804809
    805     if ( !$group_promo = get_user_meta( $bp->displayed_user->id, bp_get_user_meta_key( 'notification_groups_admin_promotion' ), true ) )
     810    if ( !$group_promo = bp_get_user_meta( $bp->displayed_user->id, 'notification_groups_admin_promotion', true ) )
    806811        $group_promo   = 'yes';
    807812
    808     if ( !$group_request = get_user_meta( $bp->displayed_user->id, bp_get_user_meta_key( 'notification_groups_membership_request' ), true ) )
     813    if ( !$group_request = bp_get_user_meta( $bp->displayed_user->id, 'notification_groups_membership_request', true ) )
    809814        $group_request = 'yes';
    810815?>
  • trunk/bp-members/bp-members-functions.php

    r4510 r4558  
    620620 * @package BuddyPress Core
    621621 * @param $user_id The user id for the user to delete usermeta for
    622  * @uses delete_user_meta() deletes a row from the wp_usermeta table based on meta_key
     622 * @uses bp_delete_user_meta() deletes a row from the wp_usermeta table based on meta_key
    623623 */
    624624function bp_core_remove_data( $user_id ) {
    625625    // Remove usermeta
    626     delete_user_meta( $user_id, bp_get_user_meta_key( 'last_activity' ) );
     626    bp_delete_user_meta( $user_id, 'last_activity' );
    627627
    628628    // Flush the cache to remove the user from all cached objects
  • trunk/bp-members/bp-members-template.php

    r4488 r4558  
    751751            $user_id = $bp->displayed_user->id;
    752752
    753         $last_activity = bp_core_get_last_activity( get_user_meta( $user_id, bp_get_user_meta_key( 'last_activity' ), true ), __('active %s ago', 'buddypress') );
     753        $last_activity = bp_core_get_last_activity( bp_get_user_meta( $user_id, 'last_activity', true ), __('active %s ago', 'buddypress') );
    754754
    755755        return apply_filters( 'bp_get_last_activity', $last_activity );
  • trunk/bp-messages/bp-messages-classes.php

    r4372 r4558  
    420420        $wpdb->query( $wpdb->prepare( "UPDATE {$bp->messages->table_name_notices} SET is_active = 0 WHERE id != %d", $id ) );
    421421
    422         update_user_meta( $bp->loggedin_user->id, bp_get_user_meta_key( 'last_activity' ), bp_core_current_time() );
     422        bp_update_user_meta( $bp->loggedin_user->id, 'last_activity', bp_core_current_time() );
    423423
    424424        do_action_ref_array( 'messages_notice_after_save', array( &$this ) );
  • trunk/bp-messages/bp-messages-notifications.php

    r4372 r4558  
    1010
    1111    foreach( $recipients as $recipient ) {
    12         if ( $sender_id == $recipient->user_id || 'no' == get_user_meta( $recipient->user_id, bp_get_user_meta_key( 'notification_messages_new_message' ), true ) )
     12        if ( $sender_id == $recipient->user_id || 'no' == bp_get_user_meta( $recipient->user_id, 'notification_messages_new_message', true ) )
    1313            continue;
    1414
  • trunk/bp-messages/bp-messages-screens.php

    r4506 r4558  
    134134    }
    135135
    136     if ( !$new_messages = get_user_meta( $bp->displayed_user->id, bp_get_user_meta_key( 'notification_messages_new_message' ), true ) )
     136    if ( !$new_messages = bp_get_user_meta( $bp->displayed_user->id, 'notification_messages_new_message', true ) )
    137137        $new_messages = 'yes';
    138138
    139     if ( !$new_notices = get_user_meta( $bp->displayed_user->id, bp_get_user_meta_key( 'notification_messages_new_notice' ), true ) )
     139    if ( !$new_notices = bp_get_user_meta( $bp->displayed_user->id, 'notification_messages_new_notice', true ) )
    140140        $new_notices  = 'yes';
    141141?>
  • trunk/bp-messages/bp-messages-template.php

    r4372 r4558  
    504504        return false;
    505505
    506     $closed_notices = get_user_meta( $userdata->ID, bp_get_user_meta_key( 'closed_notices' ), true );
     506    $closed_notices = bp_get_user_meta( $userdata->ID, 'closed_notices', true );
    507507
    508508    if ( !$closed_notices )
  • trunk/bp-settings/bp-settings-actions.php

    r4506 r4558  
    126126            foreach ( (array)$_POST['notifications'] as $key => $value ) {
    127127                if ( $meta_key = bp_get_user_meta_key( $key ) )
    128                     update_user_meta( (int)$bp->displayed_user->id, $meta_key, $value );
     128                    bp_update_user_meta( (int)$bp->displayed_user->id, $meta_key, $value );
    129129            }
    130130        }
  • trunk/bp-themes/bp-default/_inc/ajax.php

    r4548 r4558  
    503503        echo "-1<div id='message' class='error'><p>" . __('There was a problem closing the notice.', 'buddypress') . '</p></div>';
    504504    } else {
    505         $notice_ids = get_user_meta( $userdata->ID, bp_get_user_meta_key( 'closed_notices' ), true );
     505        $notice_ids = bp_get_user_meta( $userdata->ID, 'closed_notices', true );
    506506
    507507        $notice_ids[] = (int) $_POST['notice_id'];
    508508
    509         update_user_meta( $userdata->ID, bp_get_user_meta_key( 'closed_notices' ), $notice_ids );
     509        bp_update_user_meta( $userdata->ID, 'closed_notices', $notice_ids );
    510510    }
    511511}
  • trunk/bp-xprofile/bp-xprofile-template.php

    r4451 r4558  
    711711        global $bp;
    712712
    713         $last_updated = get_user_meta( $bp->displayed_user->id, bp_get_user_meta_key( 'profile_last_updated' ), true );
     713        $last_updated = bp_get_user_meta( $bp->displayed_user->id, 'profile_last_updated', true );
    714714
    715715        if ( $last_updated )
Note: See TracChangeset for help on using the changeset viewer.