Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
05/16/2011 10:22:39 PM (13 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-activity/bp-activity-functions.php

    r4372 r4378  
    191191
    192192    // Get favorites for user
    193     $favs = get_user_meta( $user_id, bp_get_user_meta_key( 'favorite_activities' ), true );
     193    $favs = get_user_meta( $user_id, bp_get_user_meta_key( '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( 'favorite_activities' ), true );
     218    $my_favs   = get_user_meta( $bp->loggedin_user->id, bp_get_user_meta_key( '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( 'favorite_activities' ), $my_favs );
     226    update_user_meta( $bp->loggedin_user->id, bp_get_user_meta_key( '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( 'favorite_activities' ), true );
     258    $my_favs = get_user_meta( $user_id, bp_get_user_meta_key( '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( 'favorite_activities' ), $my_favs ) ) {
     270            if ( update_user_meta( $user_id, bp_get_user_meta_key( '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( 'latest_update' ) );
    503     delete_user_meta( $user_id, bp_get_user_meta_key( 'favorite_activities' ) );
     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' ) );
    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( 'latest_update' ), array( 'id' => $activity_id, 'content' => wp_filter_kses( $content ) ) );
     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 ) ) );
    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( 'latest_update' ), true );
     810    $latest_update = get_user_meta( $user_id, bp_get_user_meta_key( '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( 'latest_update' ) );
     813            delete_user_meta( $user_id, bp_get_user_meta_key( 'bp_latest_update' ) );
    814814    }
    815815
Note: See TracChangeset for help on using the changeset viewer.