Skip to:
Content

BuddyPress.org


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

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.