Skip to:
Content

BuddyPress.org

Ticket #2952: 2952.diff

File 2952.diff, 5.1 KB (added by wpmuguru, 14 years ago)
  • bp-activity.php

     
    742742        ) );
    743743
    744744        /* Add this update to the "latest update" usermeta so it can be fetched anywhere. */
    745         update_user_meta( $bp->loggedin_user->id, 'bp_latest_update', array( 'id' => $activity_id, 'content' => wp_filter_kses( $content ) ) );
     745        update_user_meta( $bp->loggedin_user->id, $bp->user_latest_update_key, array( 'id' => $activity_id, 'content' => wp_filter_kses( $content ) ) );
    746746
    747747        /* Require the notifications code so email notifications can be set on the 'bp_activity_posted_update' action. */
    748748        require_once( BP_PLUGIN_DIR . '/bp-activity/bp-activity-notifications.php' );
     
    869869        else
    870870                $user_id = $args['user_id'];
    871871
    872         $latest_update = get_user_meta( $user_id, 'bp_latest_update', true );
     872        $latest_update = get_user_meta( $user_id, $bp->user_latest_update_key, true );
    873873        if ( !empty( $latest_update ) ) {
    874874                if ( in_array( (int)$latest_update['id'], (array)$activity_ids_deleted ) )
    875                         delete_user_meta( $user_id, 'bp_latest_update' );
     875                        delete_user_meta( $user_id, $bp->user_latest_update_key );
    876876        }
    877877
    878878        do_action( 'bp_activity_delete', $args );
     
    10321032}
    10331033
    10341034function bp_activity_get_user_favorites( $user_id ) {
    1035         $my_favs = maybe_unserialize( get_user_meta( $user_id, 'bp_favorite_activities', true ) );
     1035        $my_favs = maybe_unserialize( get_user_meta( $user_id, $bp->user_favorite_activities_key, true ) );
    10361036        $existing_favs = bp_activity_get_specific( array( 'activity_ids' => $my_favs ) );
    10371037
    10381038        foreach( (array)$existing_favs['activities'] as $fav )
    10391039                $new_favs[] = $fav->id;
    10401040
    10411041        $new_favs = array_unique( (array)$new_favs );
    1042         update_user_meta( $user_id, 'bp_favorite_activities', $new_favs );
     1042        update_user_meta( $user_id, $bp->user_favorite_activities_key, $new_favs );
    10431043
    10441044        return apply_filters( 'bp_activity_get_user_favorites', $new_favs );
    10451045}
     
    10511051                $user_id = $bp->loggedin_user->id;
    10521052
    10531053        /* Update the user's personal favorites */
    1054         $my_favs = maybe_unserialize( get_user_meta( $bp->loggedin_user->id, 'bp_favorite_activities', true ) );
     1054        $my_favs = maybe_unserialize( get_user_meta( $bp->loggedin_user->id, $bp->user_favorite_activities_key, true ) );
    10551055        $my_favs[] = $activity_id;
    10561056
    10571057        /* Update the total number of users who have favorited this activity */
     
    10621062        else
    10631063                $fav_count = 1;
    10641064
    1065         update_user_meta( $bp->loggedin_user->id, 'bp_favorite_activities', $my_favs );
     1065        update_user_meta( $bp->loggedin_user->id, $bp->user_favorite_activities_key, $my_favs );
    10661066        bp_activity_update_meta( $activity_id, 'favorite_count', $fav_count );
    10671067
    10681068        do_action( 'bp_activity_add_user_favorite', $activity_id, $user_id );
     
    10771077                $user_id = $bp->loggedin_user->id;
    10781078
    10791079        /* Remove the fav from the user's favs */
    1080         $my_favs = maybe_unserialize( get_user_meta( $user_id, 'bp_favorite_activities', true ) );
     1080        $my_favs = maybe_unserialize( get_user_meta( $user_id, $bp->user_favorite_activities_key, true ) );
    10811081        $my_favs = array_flip( (array) $my_favs );
    10821082        unset( $my_favs[$activity_id] );
    10831083        $my_favs = array_unique( array_flip( $my_favs ) );
     
    10901090                bp_activity_update_meta( $activity_id, 'favorite_count', $fav_count );
    10911091        }
    10921092
    1093         update_user_meta( $user_id, 'bp_favorite_activities', $my_favs );
     1093        update_user_meta( $user_id, $bp->user_favorite_activities_key, $my_favs );
    10941094
    10951095        do_action( 'bp_activity_remove_user_favorite', $activity_id, $user_id );
    10961096
     
    12121212        bp_activity_delete( array( 'user_id' => $user_id ) );
    12131213
    12141214        // Remove any usermeta
    1215         delete_user_meta( $user_id, 'bp_latest_update' );
    1216         delete_user_meta( $user_id, 'bp_favorite_activities' );
     1215        delete_user_meta( $user_id, $bp->user_latest_update_key );
     1216        delete_user_meta( $user_id, $bp->user_favorite_activities_key );
    12171217
    12181218        do_action( 'bp_activity_remove_data', $user_id );
    12191219}
  • bp-activity/bp-activity-templatetags.php

     
    842842                if ( !$user_id )
    843843                        $user_id = $bp->displayed_user->id;
    844844
    845                 if ( !$update = get_user_meta( $user_id, 'bp_latest_update', true ) )
     845                if ( !$update = get_user_meta( $user_id, $bp->user_latest_update_key, true ) )
    846846                        return false;
    847847
    848848                $latest_update = '"' . apply_filters( 'bp_get_activity_latest_update_excerpt', trim( strip_tags( bp_create_excerpt( $update['content'], 40 ) ) ) ) . '"';
  • bp-core.php

     
    7373
    7474        // Get the base database prefix
    7575        $bp->table_prefix = bp_core_get_table_prefix();
     76        $bp->user_latest_update_key = $bp->table_prefix . 'latest_update';
     77        $bp->user_favorite_activities_key = $bp->table_prefix . 'favorite_activities';
    7678
    7779        // The domain for the root of the site where the main blog resides
    7880        $bp->root_domain = bp_core_get_root_domain();
     
    21532155
    21542156        bp_core_update_page_meta( $page_ids );
    21552157}
    2156 ?>
    2157  No newline at end of file
     2158?>