Ticket #2952: 2952.diff
File 2952.diff, 5.1 KB (added by , 14 years ago) |
---|
-
bp-activity.php
742 742 ) ); 743 743 744 744 /* 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 ) ) ); 746 746 747 747 /* Require the notifications code so email notifications can be set on the 'bp_activity_posted_update' action. */ 748 748 require_once( BP_PLUGIN_DIR . '/bp-activity/bp-activity-notifications.php' ); … … 869 869 else 870 870 $user_id = $args['user_id']; 871 871 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 ); 873 873 if ( !empty( $latest_update ) ) { 874 874 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 ); 876 876 } 877 877 878 878 do_action( 'bp_activity_delete', $args ); … … 1032 1032 } 1033 1033 1034 1034 function 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 ) ); 1036 1036 $existing_favs = bp_activity_get_specific( array( 'activity_ids' => $my_favs ) ); 1037 1037 1038 1038 foreach( (array)$existing_favs['activities'] as $fav ) 1039 1039 $new_favs[] = $fav->id; 1040 1040 1041 1041 $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 ); 1043 1043 1044 1044 return apply_filters( 'bp_activity_get_user_favorites', $new_favs ); 1045 1045 } … … 1051 1051 $user_id = $bp->loggedin_user->id; 1052 1052 1053 1053 /* 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 ) ); 1055 1055 $my_favs[] = $activity_id; 1056 1056 1057 1057 /* Update the total number of users who have favorited this activity */ … … 1062 1062 else 1063 1063 $fav_count = 1; 1064 1064 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 ); 1066 1066 bp_activity_update_meta( $activity_id, 'favorite_count', $fav_count ); 1067 1067 1068 1068 do_action( 'bp_activity_add_user_favorite', $activity_id, $user_id ); … … 1077 1077 $user_id = $bp->loggedin_user->id; 1078 1078 1079 1079 /* 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 ) ); 1081 1081 $my_favs = array_flip( (array) $my_favs ); 1082 1082 unset( $my_favs[$activity_id] ); 1083 1083 $my_favs = array_unique( array_flip( $my_favs ) ); … … 1090 1090 bp_activity_update_meta( $activity_id, 'favorite_count', $fav_count ); 1091 1091 } 1092 1092 1093 update_user_meta( $user_id, 'bp_favorite_activities', $my_favs );1093 update_user_meta( $user_id, $bp->user_favorite_activities_key, $my_favs ); 1094 1094 1095 1095 do_action( 'bp_activity_remove_user_favorite', $activity_id, $user_id ); 1096 1096 … … 1212 1212 bp_activity_delete( array( 'user_id' => $user_id ) ); 1213 1213 1214 1214 // 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 ); 1217 1217 1218 1218 do_action( 'bp_activity_remove_data', $user_id ); 1219 1219 } -
bp-activity/bp-activity-templatetags.php
842 842 if ( !$user_id ) 843 843 $user_id = $bp->displayed_user->id; 844 844 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 ) ) 846 846 return false; 847 847 848 848 $latest_update = '"' . apply_filters( 'bp_get_activity_latest_update_excerpt', trim( strip_tags( bp_create_excerpt( $update['content'], 40 ) ) ) ) . '"'; -
bp-core.php
73 73 74 74 // Get the base database prefix 75 75 $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'; 76 78 77 79 // The domain for the root of the site where the main blog resides 78 80 $bp->root_domain = bp_core_get_root_domain(); … … 2153 2155 2154 2156 bp_core_update_page_meta( $page_ids ); 2155 2157 } 2156 ?> 2157 No newline at end of file 2158 ?>