Ticket #2952: 2952.4.diff
File 2952.4.diff, 39.4 KB (added by , 13 years ago) |
---|
-
bp-themes/bp-default/_inc/ajax.php
112 112 break; 113 113 case 'mentions': 114 114 $feed_url = $bp->loggedin_user->domain . bp_get_activity_slug() . '/mentions/feed/'; 115 delete_user_meta( $bp->loggedin_user->id, 'bp_new_mention_count');115 delete_user_meta( $bp->loggedin_user->id, $bp->user_meta_keys->new_mention_count ); 116 116 break; 117 117 default: 118 118 $feed_url = home_url( bp_get_activity_root_slug() . '/feed/' ); … … 256 256 echo '-1<div id="message" class="error"><p>' . __( 'There was a problem when deleting. Please try again.', 'buddypress' ) . '</p></div>'; 257 257 return false; 258 258 } 259 259 260 260 do_action( 'bp_activity_action_delete_activity', $activity->id, $activity->user_id ); 261 261 262 262 return true; … … 498 498 if ( !isset( $_POST['notice_id'] ) ) { 499 499 echo "-1<div id='message' class='error'><p>" . __('There was a problem closing the notice.', 'buddypress') . '</p></div>'; 500 500 } else { 501 $notice_ids = get_user_meta( $userdata->ID, 'closed_notices', true );501 $notice_ids = get_user_meta( $userdata->ID, $bp->user_meta_keys->closed_notices, true ); 502 502 503 503 $notice_ids[] = (int) $_POST['notice_id']; 504 504 505 update_user_meta( $userdata->ID, 'closed_notices', $notice_ids );505 update_user_meta( $userdata->ID, $bp->user_meta_keys->closed_notices, $notice_ids ); 506 506 } 507 507 } 508 508 add_action( 'wp_ajax_messages_close_notice', 'bp_dtheme_ajax_close_notice' ); -
bp-xprofile/bp-xprofile-loader.php
92 92 'table_name_meta' => $bp->table_prefix . 'bp_xprofile_meta', 93 93 ); 94 94 95 $user_meta_keys = array( 96 'profile_last_updated' => 'profile_last_updated' 97 ); 98 95 99 $globals = array( 96 100 'slug' => BP_XPROFILE_SLUG, 97 101 'root_slug' => isset( $bp->pages->xprofile->slug ) ? $bp->pages->xprofile->slug : BP_XPROFILE_SLUG, 98 102 'notification_callback' => 'xprofile_format_notifications', 99 'global_tables' => $global_tables 103 'global_tables' => $global_tables, 104 'user_meta_keys' => $user_meta_keys 100 105 ); 101 106 102 107 parent::_setup_globals( $globals ); -
bp-xprofile/bp-xprofile-template.php
712 712 function bp_get_profile_last_updated() { 713 713 global $bp; 714 714 715 $last_updated = get_user_meta( $bp->displayed_user->id, 'profile_last_updated', true );715 $last_updated = get_user_meta( $bp->displayed_user->id, $bp->user_meta_keys->profile_last_updated, true ); 716 716 717 717 if ( $last_updated ) 718 718 return apply_filters( 'bp_get_profile_last_updated', sprintf( __('Profile updated %s ago', 'buddypress'), bp_core_time_since( strtotime( $last_updated ) ) ) ); -
bp-core/bp-core-loader.php
149 149 150 150 // The user ID of the user who is currently logged in. 151 151 $bp->loggedin_user->id = $current_user->ID; 152 153 // Keys for BP user_meta 154 $bp->user_meta_keys->last_activity = apply_filters( 'bp_user_meta_key_last_activity', 'last_activity' ); 155 $bp->user_meta_keys->closed_notices = apply_filters( 'bp_user_meta_key_closed_notices', 'closed_notices' ); 152 156 153 157 /** Avatars ***********************************************************/ 154 158 -
bp-core/bp-core-functions.php
641 641 if ( !is_user_logged_in() ) 642 642 return false; 643 643 644 $activity = get_user_meta( $bp->loggedin_user->id, 'last_activity', true );644 $activity = get_user_meta( $bp->loggedin_user->id, $bp->user_meta_keys->last_activity, true ); 645 645 646 646 if ( !is_numeric( $activity ) ) 647 647 $activity = strtotime( $activity ); … … 650 650 $current_time = bp_core_current_time(); 651 651 652 652 if ( empty( $activity ) || strtotime( $current_time ) >= strtotime( '+5 minutes', $activity ) ) 653 update_user_meta( $bp->loggedin_user->id, 'last_activity', $current_time );653 update_user_meta( $bp->loggedin_user->id, $bp->user_meta_keys->last_activity, $current_time ); 654 654 } 655 655 add_action( 'wp_head', 'bp_core_record_activity' ); 656 656 -
bp-core/bp-core-classes.php
59 59 * @uses bp_profile_last_updated_date() Returns the last updated date for a user. 60 60 */ 61 61 function populate() { 62 global $bp; 63 62 64 if ( bp_is_active( 'xprofile' ) ) 63 65 $this->profile_data = $this->get_profile_data(); 64 66 … … 82 84 $this->avatar = bp_core_fetch_avatar( array( 'item_id' => $this->id, 'type' => 'full' ) ); 83 85 $this->avatar_thumb = bp_core_fetch_avatar( array( 'item_id' => $this->id, 'type' => 'thumb' ) ); 84 86 $this->avatar_mini = bp_core_fetch_avatar( array( 'item_id' => $this->id, 'type' => 'thumb', 'width' => 30, 'height' => 30 ) ); 85 $this->last_active = bp_core_get_last_activity( get_user_meta( $this->id, 'last_activity', true ), __( 'active %s ago', 'buddypress' ) );87 $this->last_active = bp_core_get_last_activity( get_user_meta( $this->id, $bp->user_meta_keys->last_activity, true ), __( 'active %s ago', 'buddypress' ) ); 86 88 } 87 89 88 90 function populate_extras() { -
bp-core/bp-core-component.php
108 108 'notification_callback' => '', 109 109 'search_string' => '', 110 110 'global_tables' => '', 111 'user_meta_keys' => array() 111 112 ); 112 113 $r = wp_parse_args( $args, $defaults ); 113 114 … … 127 128 if ( !empty( $r['global_tables'] ) ) 128 129 foreach ( $r['global_tables'] as $global_name => $table_name ) 129 130 $this->$global_name = $table_name; 130 131 132 // User meta keys 133 if ( !empty( $r['user_meta_keys'] ) ) { 134 foreach ( $r['user_meta_keys'] as $key_name => $key_value ) 135 $bp->user_meta_keys->$key_name = apply_filters( "bp_user_meta_keys-$key_name", $key_value ); 136 } 137 131 138 /** BuddyPress ********************************************************/ 132 139 133 140 // Register this component in the active components array -
bp-members/bp-members-functions.php
81 81 * @package BuddyPress Core 82 82 * @global $current_user WordPress global variable containing current logged in user information 83 83 * @param user_id The ID of the user. 84 * @uses get_user_meta() WordPress function to get the usermeta for a user.85 84 */ 86 85 function bp_core_get_user_domain( $user_id, $user_nicename = false, $user_login = false ) { 87 86 global $bp; … … 626 625 * @uses delete_user_meta() deletes a row from the wp_usermeta table based on meta_key 627 626 */ 628 627 function bp_core_remove_data( $user_id ) { 628 global $bp; 629 629 630 // Remove usermeta 630 delete_user_meta( $user_id, 'last_activity');631 delete_user_meta( $user_id, $bp->user_meta_keys->last_activity ); 631 632 632 633 // Flush the cache to remove the user from all cached objects 633 634 wp_cache_flush(); -
bp-members/bp-members-template.php
750 750 if ( empty( $user_id ) ) 751 751 $user_id = $bp->displayed_user->id; 752 752 753 $last_activity = bp_core_get_last_activity( get_user_meta( $user_id, 'last_activity', true ), __('active %s ago', 'buddypress') );753 $last_activity = bp_core_get_last_activity( get_user_meta( $user_id, $bp->user_meta_keys->last_activity, true ), __('active %s ago', 'buddypress') ); 754 754 755 755 return apply_filters( 'bp_get_last_activity', $last_activity ); 756 756 } -
bp-friends/bp-friends-screens.php
54 54 function friends_screen_notification_settings() { 55 55 global $bp; 56 56 57 58 if ( !$send_requests = get_user_meta( $bp->displayed_user->id, 'notification_friends_friendship_request', true ) ) 57 if ( !$send_requests = get_user_meta( $bp->displayed_user->id, $bp->user_meta_keys->notification_friends_friendship_request, true ) ) 59 58 $send_requests = 'yes'; 60 59 61 if ( !$accept_requests = get_user_meta( $bp->displayed_user->id, 'notification_friends_friendship_accepted', true ) )60 if ( !$accept_requests = get_user_meta( $bp->displayed_user->id, $bp->user_meta_keys->notification_friends_friendship_accepted, true ) ) 62 61 $accept_requests = 'yes'; 63 62 ?> 64 63 -
bp-friends/bp-friends-loader.php
70 70 'table_name' => $bp->table_prefix . 'bp_friends', 71 71 'table_name_meta' => $bp->table_prefix . 'bp_friends_meta', 72 72 ); 73 74 // User meta keys 75 $user_meta_keys = array( 76 'total_friend_count' => 'total_friend_count', 77 'notification_friends_friendship_request' => 'notification_friends_friendship_request', 78 'notification_friends_friendship_accepted' => 'notification_friends_friendship_accepted' 79 ); 73 80 74 81 // All globals for the friends component. 75 82 // Note that global_tables is included in this array. … … 79 86 'search_string' => __( 'Search Friends...', 'buddypress' ), 80 87 'notification_callback' => 'friends_format_notifications', 81 88 'global_tables' => $global_tables, 89 'user_meta_keys' => $user_meta_keys 82 90 ); 83 91 84 92 parent::_setup_globals( $globals ); -
bp-friends/bp-friends-functions.php
155 155 $user_id = ( $bp->displayed_user->id ) ? $bp->displayed_user->id : $bp->loggedin_user->id; 156 156 157 157 if ( !$count = wp_cache_get( 'bp_total_friend_count_' . $user_id, 'bp' ) ) { 158 $count = get_user_meta( $user_id, 'total_friend_count', true );158 $count = get_user_meta( $user_id, $bp->user_meta_keys->total_friend_count, true ); 159 159 if ( empty( $count ) ) $count = 0; 160 160 wp_cache_set( 'bp_total_friend_count_' . $user_id, $count, 'bp' ); 161 161 } … … 256 256 } 257 257 258 258 function friends_update_friend_totals( $initiator_user_id, $friend_user_id, $status = 'add' ) { 259 global $bp; 260 259 261 if ( 'add' == $status ) { 260 update_user_meta( $initiator_user_id, 'total_friend_count', (int)get_user_meta( $initiator_user_id, 'total_friend_count', true ) + 1 );261 update_user_meta( $friend_user_id, 'total_friend_count', (int)get_user_meta( $friend_user_id, 'total_friend_count', true ) + 1 );262 update_user_meta( $initiator_user_id, $bp->user_meta_keys->total_friend_count, (int)get_user_meta( $initiator_user_id, 'total_friend_count', true ) + 1 ); 263 update_user_meta( $friend_user_id, $bp->user_meta_keys->total_friend_count, (int)get_user_meta( $friend_user_id, 'total_friend_count', true ) + 1 ); 262 264 } else { 263 update_user_meta( $initiator_user_id, 'total_friend_count', (int)get_user_meta( $initiator_user_id, 'total_friend_count', true ) - 1 );264 update_user_meta( $friend_user_id, 'total_friend_count', (int)get_user_meta( $friend_user_id, 'total_friend_count', true ) - 1 );265 update_user_meta( $initiator_user_id, $bp->user_meta_keys->total_friend_count, (int)get_user_meta( $initiator_user_id, 'total_friend_count', true ) - 1 ); 266 update_user_meta( $friend_user_id, $bp->user_meta_keys->total_friend_count, (int)get_user_meta( $friend_user_id, 'total_friend_count', true ) - 1 ); 265 267 } 266 268 } 267 269 … … 273 275 BP_Friends_Friendship::delete_all_for_user($user_id); 274 276 275 277 // Remove usermeta 276 delete_user_meta( $user_id, 'total_friend_count');278 delete_user_meta( $user_id, $bp->user_meta_keys->total_friend_count ); 277 279 278 280 // Remove friendship requests FROM user 279 281 bp_members_delete_notifications_from_user( $user_id, $bp->friends->id, 'friendship_request' ); -
bp-friends/bp-friends-notifications.php
5 5 6 6 $initiator_name = bp_core_get_user_displayname( $initiator_id ); 7 7 8 if ( 'no' == get_user_meta( (int)$friend_id, 'notification_friends_friendship_request', true ) )8 if ( 'no' == get_user_meta( (int)$friend_id, $bp->user_meta_keys->notification_friends_friendship_request, true ) ) 9 9 return false; 10 10 11 11 $ud = get_userdata( $friend_id ); … … 50 50 51 51 $friend_name = bp_core_get_user_displayname( $friend_id ); 52 52 53 if ( 'no' == get_user_meta( (int)$initiator_id, 'notification_friends_friendship_accepted', true ) )53 if ( 'no' == get_user_meta( (int)$initiator_id, $bp->user_meta_keys->notification_friends_friendship_accepted, true ) ) 54 54 return false; 55 55 56 56 $ud = get_userdata( $initiator_id ); -
bp-friends/bp-friends-classes.php
132 132 $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(id) FROM {$bp->friends->table_name} WHERE (initiator_user_id = %d OR friend_user_id = %d) AND is_confirmed = 1", $user_id, $user_id ) ); 133 133 134 134 // Do not update meta if user has never had friends 135 if ( !$count && !get_user_meta( $user_id, 'total_friend_count', true ) )135 if ( !$count && !get_user_meta( $user_id, $bp->user_meta_keys->total_friend_count, true ) ) 136 136 return 0; 137 137 138 update_user_meta( $user_id, 'total_friend_count', (int)$count );138 update_user_meta( $user_id, $bp->user_meta_keys->total_friend_count, (int)$count ); 139 139 return (int)$count; 140 140 } 141 141 -
bp-activity/bp-activity-screens.php
134 134 function bp_activity_screen_notification_settings() { 135 135 global $bp; 136 136 137 if ( !$mention = get_user_meta( $bp->displayed_user->id, 'notification_activity_new_mention', true ) )137 if ( !$mention = get_user_meta( $bp->displayed_user->id, $bp->user_meta_keys->notification_activity_new_mention, true ) ) 138 138 $mention = 'yes'; 139 139 140 if ( !$reply = get_user_meta( $bp->displayed_user->id, 'notification_activity_new_reply', true ) )140 if ( !$reply = get_user_meta( $bp->displayed_user->id, $bp->user_meta_keys->notification_activity_new_reply, true ) ) 141 141 $reply = 'yes'; ?> 142 142 143 143 <table class="notification-settings" id="activity-notification-settings"> -
bp-activity/bp-activity-loader.php
62 62 if ( !defined( 'BP_ACTIVITY_SLUG' ) ) 63 63 define( 'BP_ACTIVITY_SLUG', $this->id ); 64 64 65 // Global tables for messagingcomponent65 // Global tables for activity component 66 66 $global_tables = array( 67 67 'table_name' => $bp->table_prefix . 'bp_activity', 68 68 'table_name_meta' => $bp->table_prefix . 'bp_activity_meta', 69 69 ); 70 71 // User meta keys 72 $user_meta_keys = array( 73 'new_mention_count' => 'bp_new_mention_count', 74 'favorite_activities' => 'bp_favorite_activities', 75 'latest_update' => 'bp_latest_update', 76 'notification_activity_new_mention' => 'notification_activity_new_mention', 77 'notification_activity_new_reply' => 'notification_activity_new_reply' 78 ); 70 79 71 // All globals for messagingcomponent.80 // All globals for activity component. 72 81 // Note that global_tables is included in this array. 73 82 $globals = array( 74 83 'path' => BP_PLUGIN_DIR, … … 76 85 'root_slug' => isset( $bp->pages->activity->slug ) ? $bp->pages->activity->slug : BP_ACTIVITY_SLUG, 77 86 'search_string' => __( 'Search Activity...', 'buddypress' ), 78 87 'global_tables' => $global_tables, 88 'user_meta_keys' => $user_meta_keys 79 89 ); 80 90 81 91 parent::_setup_globals( $globals ); -
bp-activity/bp-activity-filters.php
113 113 * @param string $content The activity content 114 114 */ 115 115 function bp_activity_at_name_filter( $content ) { 116 global $bp; 117 116 118 $usernames = bp_activity_find_mentions( $content ); 117 119 118 120 foreach( (array)$usernames as $username ) { … … 125 127 continue; 126 128 127 129 // Increase the number of new @ mentions for the user 128 $new_mention_count = (int)get_user_meta( $user_id, 'bp_new_mention_count', true );129 update_user_meta( $user_id, 'bp_new_mention_count', $new_mention_count + 1 );130 $new_mention_count = (int)get_user_meta( $user_id, $bp->user_meta_keys->new_mention_count, true ); 131 update_user_meta( $user_id, $bp->user_meta_keys->new_mention_count, $new_mention_count + 1 ); 130 132 131 133 $content = preg_replace( '/(@' . $username . '\b)/', "<a href='" . bp_core_get_user_domain( $user_id ) . "' rel='nofollow'>@$username</a>", $content ); 132 134 } -
bp-activity/bp-activity-functions.php
38 38 * @param $activity_id The unique id for the activity item 39 39 */ 40 40 function bp_activity_reduce_mention_count( $activity_id ) { 41 global $bp; 42 41 43 $activity = new BP_Activity_Activity( $activity_id ); 42 44 43 45 if ( $usernames = bp_activity_find_mentions( strip_tags( $activity->content ) ) ) { … … 51 53 continue; 52 54 53 55 // Decrease the number of new @ mentions for the user 54 $new_mention_count = (int)get_user_meta( $user_id, 'bp_new_mention_count', true );55 update_user_meta( $user_id, 'bp_new_mention_count', $new_mention_count - 1 );56 $new_mention_count = (int)get_user_meta( $user_id, $bp->user_meta_keys->new_mention_count, true ); 57 update_user_meta( $user_id, $bp->user_meta_keys->new_mention_count, $new_mention_count - 1 ); 56 58 } 57 59 } 58 60 } … … 154 156 $user_id = $bp->displayed_user->id; 155 157 156 158 // Get favorites for user 157 $favs = get_user_meta( $user_id, 'bp_favorite_activities', true );159 $favs = get_user_meta( $user_id, $bp->user_meta_keys->favorite_activities, true ); 158 160 159 161 return apply_filters( 'bp_activity_get_user_favorites', $favs ); 160 162 } … … 179 181 $user_id = $bp->loggedin_user->id; 180 182 181 183 // Update the user's personal favorites 182 $my_favs = get_user_meta( $bp->loggedin_user->id, 'bp_favorite_activities', true );184 $my_favs = get_user_meta( $bp->loggedin_user->id, $bp->user_meta_keys->favorite_activities, true ); 183 185 $my_favs[] = $activity_id; 184 186 185 187 // Update the total number of users who have favorited this activity … … 187 189 $fav_count = !empty( $fav_count ) ? (int)$fav_count + 1 : 1; 188 190 189 191 // Update user meta 190 update_user_meta( $bp->loggedin_user->id, 'bp_favorite_activities', $my_favs );192 update_user_meta( $bp->loggedin_user->id, $bp->user_meta_keys->favorite_activities, $my_favs ); 191 193 192 194 // Update activity meta counts 193 195 if ( true === bp_activity_update_meta( $activity_id, 'favorite_count', $fav_count ) ) { … … 219 221 $user_id = $bp->loggedin_user->id; 220 222 221 223 // Remove the fav from the user's favs 222 $my_favs = get_user_meta( $user_id, 'bp_favorite_activities', true );224 $my_favs = get_user_meta( $user_id, $bp->user_meta_keys->favorite_activities, true ); 223 225 $my_favs = array_flip( (array) $my_favs ); 224 226 unset( $my_favs[$activity_id] ); 225 227 $my_favs = array_unique( array_flip( $my_favs ) ); … … 231 233 if ( bp_activity_update_meta( $activity_id, 'favorite_count', (int)$fav_count - 1 ) ) { 232 234 233 235 // Update users favorites 234 if ( update_user_meta( $user_id, 'bp_favorite_activities', $my_favs ) ) {236 if ( update_user_meta( $user_id, $bp->user_meta_keys->favorite_activities, $my_favs ) ) { 235 237 236 238 // Execute additional code 237 239 do_action( 'bp_activity_remove_user_favorite', $activity_id, $user_id ); … … 463 465 bp_activity_delete( array( 'user_id' => $user_id ) ); 464 466 465 467 // Remove any usermeta 466 delete_user_meta( $user_id, 'bp_latest_update');467 delete_user_meta( $user_id, 'bp_favorite_activities');468 delete_user_meta( $user_id, $bp->user_meta_keys->latest_update ); 469 delete_user_meta( $user_id, $bp->user_meta_keys->favorite_activities ); 468 470 469 471 // Execute additional code 470 472 do_action( 'bp_activity_remove_data', $user_id ); // Deprecated! Do not use! … … 639 641 ) ); 640 642 641 643 // Add this update to the "latest update" usermeta so it can be fetched anywhere. 642 update_user_meta( $bp->loggedin_user->id, 'bp_latest_update', array( 'id' => $activity_id, 'content' => wp_filter_kses( $content ) ) );644 update_user_meta( $bp->loggedin_user->id, $bp->user_meta_keys->latest_update, array( 'id' => $activity_id, 'content' => wp_filter_kses( $content ) ) ); 643 645 644 646 // Require the notifications code so email notifications can be set on the 'bp_activity_posted_update' action. 645 647 require_once( BP_PLUGIN_DIR . '/bp-activity/bp-activity-notifications.php' ); … … 768 770 769 771 do_action( 'bp_before_activity_delete', $args ); 770 772 771 $latest_update = get_user_meta( $user_id, 'bp_latest_update', true );773 $latest_update = get_user_meta( $user_id, $bp->user_meta_keys->latest_update, true ); 772 774 if ( !empty( $latest_update ) ) { 773 775 if ( in_array( (int)$latest_update['id'], (array)$activity_ids_deleted ) ) 774 delete_user_meta( $user_id, 'bp_latest_update');776 delete_user_meta( $user_id, $bp->user_meta_keys->latest_update ); 775 777 } 776 778 777 779 do_action( 'bp_activity_delete', $args ); -
bp-activity/bp-activity-notifications.php
34 34 $message = ''; 35 35 36 36 // 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, 'notification_activity_new_mention', true ) ) {37 if ( 'no' != get_user_meta( $receiver_user_id, $bp->user_meta_keys->notification_activity_new_mention, true ) ) { 38 38 $poster_name = bp_core_get_user_displayname( $poster_user_id ); 39 39 40 40 $message_link = bp_activity_get_permalink( $activity_id ); … … 81 81 82 82 $original_activity = new BP_Activity_Activity( $activity_id ); 83 83 84 if ( $original_activity->user_id != $commenter_id && 'no' != get_user_meta( $original_activity->user_id, 'notification_activity_new_reply', true ) ) {84 if ( $original_activity->user_id != $commenter_id && 'no' != get_user_meta( $original_activity->user_id, $bp->user_meta_keys->notification_activity_new_reply, true ) ) { 85 85 $poster_name = bp_core_get_user_displayname( $commenter_id ); 86 86 $thread_link = bp_activity_get_permalink( $activity_id ); 87 87 $settings_link = bp_core_get_user_domain( $original_activity->user_id ) . BP_SETTINGS_SLUG . '/notifications/'; … … 126 126 127 127 $parent_comment = new BP_Activity_Activity( $parent_id ); 128 128 129 if ( $parent_comment->user_id != $commenter_id && $original_activity->user_id != $parent_comment->user_id && 'no' != get_user_meta( $parent_comment->user_id, 'notification_activity_new_reply', true ) ) {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->user_meta_keys->notification_activity_new_reply, true ) ) { 130 130 $poster_name = bp_core_get_user_displayname( $commenter_id ); 131 131 $thread_link = bp_activity_get_permalink( $activity_id ); 132 132 $settings_link = bp_core_get_user_domain( $parent_comment->user_id ) . BP_SETTINGS_SLUG . '/notifications/'; -
bp-activity/bp-activity-template.php
93 93 $this->disable_blogforum_replies = isset( $bp->site_options['bp-disable-blogforum-comments'] ) ? $bp->site_options['bp-disable-blogforum-comments'] : false; 94 94 95 95 // 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_favorite_activities', true ) );96 $this->my_favs = maybe_unserialize( get_user_meta( $bp->loggedin_user->id, $bp->user_meta_keys->favorite_activities, true ) ); 97 97 98 98 // Fetch specific activity items based on ID's 99 99 if ( !empty( $include ) ) … … 1025 1025 if ( !$user_id ) 1026 1026 $user_id = $bp->displayed_user->id; 1027 1027 1028 if ( !$update = get_user_meta( $user_id, 'bp_latest_update', true ) )1028 if ( !$update = get_user_meta( $user_id, $bp->user_meta_keys->latest_update, true ) ) 1029 1029 return false; 1030 1030 1031 1031 $latest_update = '"' . apply_filters( 'bp_get_activity_latest_update_excerpt', trim( strip_tags( bp_create_excerpt( $update['content'], 358 ) ) ) ) . '"'; … … 1141 1141 echo bp_get_total_favorite_count_for_user( $user_id ); 1142 1142 } 1143 1143 function bp_get_total_mention_count_for_user( $user_id = 0 ) { 1144 return apply_filters( 'bp_get_total_mention_count_for_user', get_user_meta( $user_id, 'bp_new_mention_count', true ) ); 1144 global $bp; 1145 1146 return apply_filters( 'bp_get_total_mention_count_for_user', get_user_meta( $user_id, $bp->user_meta_keys->new_mention_count, true ) ); 1145 1147 } 1146 1148 1147 1149 function bp_send_public_message_link() { -
bp-activity/bp-activity-classes.php
525 525 function total_favorite_count( $user_id ) { 526 526 global $bp; 527 527 528 if ( !$favorite_activity_entries = get_user_meta( $user_id, 'bp_favorite_activities', true ) )528 if ( !$favorite_activity_entries = get_user_meta( $user_id, $bp->user_meta_keys->favorite_activities, true ) ) 529 529 return 0; 530 530 531 531 return count( maybe_unserialize( $favorite_activity_entries ) ); -
bp-settings/bp-settings-actions.php
116 116 117 117 if ( isset( $_POST['notifications'] ) ) { 118 118 foreach ( (array)$_POST['notifications'] as $key => $value ) { 119 update_user_meta( (int)$bp->displayed_user->id, $ key, $value );119 update_user_meta( (int)$bp->displayed_user->id, $bp->user_meta_keys->$key, $value ); 120 120 } 121 121 } 122 122 -
bp-messages/bp-messages-loader.php
69 69 'table_name_messages' => $bp->table_prefix . 'bp_messages_messages', 70 70 'table_name_recipients' => $bp->table_prefix . 'bp_messages_recipients' 71 71 ); 72 73 $user_meta_keys = array( 74 'notification_messages_new_message' => 'notification_messages_new_message', 75 'notification_messages_new_notice' => 'notification_messages_new_notice' 76 ); 72 77 73 78 // All globals for messaging component. 74 79 // Note that global_tables is included in this array. … … 77 82 'notification_callback' => 'messages_format_notifications', 78 83 'search_string' => __( 'Search Messages...', 'buddypress' ), 79 84 'global_tables' => $global_tables, 85 'user_meta_keys' => $user_meta_keys 80 86 ); 81 87 82 88 $this->autocomplete_all = defined( 'BP_MESSAGES_AUTOCOMPLETE_ALL' ); -
bp-messages/bp-messages-notifications.php
9 9 $sender_name = bp_core_get_user_displayname( $sender_id ); 10 10 11 11 foreach( $recipients as $recipient ) { 12 if ( $sender_id == $recipient->user_id || 'no' == get_user_meta( $recipient->user_id, 'notification_messages_new_message', true ) )12 if ( $sender_id == $recipient->user_id || 'no' == get_user_meta( $recipient->user_id, $bp->user_meta_keys->notification_messages_new_message, true ) ) 13 13 continue; 14 14 15 15 // User data and links -
bp-messages/bp-messages-template.php
496 496 } 497 497 498 498 function bp_message_get_notices() { 499 global $userdata ;499 global $userdata, $bp; 500 500 501 501 $notice = BP_Messages_Notice::get_active(); 502 502 503 503 if ( empty( $notice ) ) 504 504 return false; 505 505 506 $closed_notices = get_user_meta( $userdata->ID, 'closed_notices', true );506 $closed_notices = get_user_meta( $userdata->ID, $bp->user_meta_keys->closed_notices, true ); 507 507 508 508 if ( !$closed_notices ) 509 509 $closed_notices = array(); -
bp-messages/bp-messages-classes.php
419 419 // Now deactivate all notices apart from the new one. 420 420 $wpdb->query( $wpdb->prepare( "UPDATE {$bp->messages->table_name_notices} SET is_active = 0 WHERE id != %d", $id ) ); 421 421 422 update_user_meta( $bp->loggedin_user->id, 'last_activity', bp_core_current_time() );422 update_user_meta( $bp->loggedin_user->id, $bp->user_meta_keys->last_activity, bp_core_current_time() ); 423 423 424 424 do_action_ref_array( 'messages_notice_after_save', array( &$this ) ); 425 425 -
bp-messages/bp-messages-screens.php
104 104 function messages_screen_notification_settings() { 105 105 global $bp; 106 106 107 if ( !$new_messages = get_user_meta( $bp->displayed_user->id, 'notification_messages_new_message', true ) )107 if ( !$new_messages = get_user_meta( $bp->displayed_user->id, $bp->user_meta_keys->notification_messages_new_message, true ) ) 108 108 $new_messages = 'yes'; 109 109 110 if ( !$new_notices = get_user_meta( $bp->displayed_user->id, 'notification_messages_new_notice', true ) )110 if ( !$new_notices = get_user_meta( $bp->displayed_user->id, $bp->user_meta_keys->notification_messages_new_notice, true ) ) 111 111 $new_notices = 'yes'; 112 112 ?> 113 113 -
bp-groups/bp-groups-classes.php
714 714 } 715 715 716 716 function ban() { 717 global $bp; 718 717 719 if ( $this->is_admin ) 718 720 return false; 719 721 … … 722 724 723 725 groups_update_groupmeta( $this->group_id, 'total_member_count', ( (int) groups_get_groupmeta( $this->group_id, 'total_member_count' ) - 1 ) ); 724 726 725 $group_count = get_user_meta( $this->user_id, 'total_group_count', true );727 $group_count = get_user_meta( $this->user_id, $bp->user_meta_keys->total_group_count, true ); 726 728 if ( !empty( $group_count ) ) 727 update_user_meta( $this->user_id, 'total_group_count', (int)$group_count - 1 );729 update_user_meta( $this->user_id, $bp->user_meta_keys->total_group_count, (int)$group_count - 1 ); 728 730 729 731 return $this->save(); 730 732 } 731 733 732 734 function unban() { 735 global $bp; 736 733 737 if ( $this->is_admin ) 734 738 return false; 735 739 736 740 $this->is_banned = 0; 737 741 738 742 groups_update_groupmeta( $this->group_id, 'total_member_count', ( (int) groups_get_groupmeta( $this->group_id, 'total_member_count' ) + 1 ) ); 739 update_user_meta( $this->user_id, 'total_group_count', (int)get_user_meta( $this->user_id, 'total_group_count', true ) + 1 );743 update_user_meta( $this->user_id, $bp->user_meta_keys->total_group_count, (int)get_user_meta( $this->user_id, $bp->user_meta_keys->total_group_count, true ) + 1 ); 740 744 741 745 return $this->save(); 742 746 } 743 747 744 748 function accept_invite() { 749 global $bp; 750 745 751 $this->inviter_id = 0; 746 752 $this->is_confirmed = 1; 747 753 $this->date_modified = bp_core_current_time(); 748 754 749 update_user_meta( $this->user_id, 'total_group_count', (int)get_user_meta( $this->user_id, 'total_group_count', true ) + 1 );755 update_user_meta( $this->user_id, $bp->user_meta_keys->total_group_count, (int)get_user_meta( $this->user_id, $bp->user_meta_keys->total_group_count, true ) + 1 ); 750 756 } 751 757 752 758 function accept_request() { 759 global $bp; 760 753 761 $this->is_confirmed = 1; 754 762 $this->date_modified = bp_core_current_time(); 755 763 756 update_user_meta( $this->user_id, 'total_group_count', (int)get_user_meta( $this->user_id, 'total_group_count', true ) + 1 );764 update_user_meta( $this->user_id, $bp->user_meta_keys->total_group_count, (int)get_user_meta( $this->user_id, $bp->user_meta_keys->total_group_count, true ) + 1 ); 757 765 } 758 766 759 767 function remove() { … … 766 774 767 775 groups_update_groupmeta( $this->group_id, 'total_member_count', ( (int) groups_get_groupmeta( $this->group_id, 'total_member_count' ) - 1 ) ); 768 776 769 $group_count = get_user_meta( $this->user_id, 'total_group_count', true );777 $group_count = get_user_meta( $this->user_id, $bp->user_meta_keys->total_group_count, true ); 770 778 if ( !empty( $group_count ) ) 771 update_user_meta( $this->user_id, 'total_group_count', (int)$group_count - 1 );779 update_user_meta( $this->user_id, $bp->user_meta_keys->total_group_count, (int)$group_count - 1 ); 772 780 773 781 return $result; 774 782 } -
bp-groups/bp-groups-screens.php
786 786 function groups_screen_notification_settings() { 787 787 global $bp; 788 788 789 if ( !$group_invite = get_user_meta( $bp->displayed_user->id, 'notification_groups_invite', true ) )789 if ( !$group_invite = get_user_meta( $bp->displayed_user->id, $bp->user_meta_keys->notification_groups_invite, true ) ) 790 790 $group_invite = 'yes'; 791 791 792 if ( !$group_update = get_user_meta( $bp->displayed_user->id, 'notification_groups_group_updated', true ) )792 if ( !$group_update = get_user_meta( $bp->displayed_user->id, $bp->user_meta_keys->notification_groups_group_updated, true ) ) 793 793 $group_update = 'yes'; 794 794 795 if ( !$group_promo = get_user_meta( $bp->displayed_user->id, 'notification_groups_admin_promotion', true ) )795 if ( !$group_promo = get_user_meta( $bp->displayed_user->id, $bp->user_meta_keys->notification_groups_admin_promotion, true ) ) 796 796 $group_promo = 'yes'; 797 797 798 if ( !$group_request = get_user_meta( $bp->displayed_user->id, 'notification_groups_membership_request', true ) )798 if ( !$group_request = get_user_meta( $bp->displayed_user->id, $bp->user_meta_keys->notification_groups_membership_request, true ) ) 799 799 $group_request = 'yes'; 800 800 ?> 801 801 -
bp-groups/bp-groups-loader.php
73 73 'table_name_members' => $bp->table_prefix . 'bp_groups_members', 74 74 'table_name_groupmeta' => $bp->table_prefix . 'bp_groups_groupmeta' 75 75 ); 76 77 // User meta_keys 78 $user_meta_keys = array( 79 'total_group_count' => 'total_group_count', 80 'notification_groups_group_updated' => 'notification_groups_group_updated', 81 'notification_groups_membership_request' => 'notification_groups_membership_request', 82 'notification_membership_request_completed' => 'notification_membership_request_completed', 83 'notification_groups_invite' => 'notification_groups_invite', 84 'notification_groups_admin_promotion' => 'notification_groups_admin_promotion' 85 ); 76 86 77 87 // All globals for messaging component. 78 88 // Note that global_tables is included in this array. … … 82 92 'notification_callback' => 'groups_format_notifications', 83 93 'search_string' => __( 'Search Groups...', 'buddypress' ), 84 94 'global_tables' => $global_tables, 95 'user_meta_keys' => $user_meta_keys 85 96 ); 86 97 87 98 parent::_setup_globals( $globals ); -
bp-groups/bp-groups-functions.php
248 248 groups_update_groupmeta( $group_id, 'total_member_count', (int) groups_get_groupmeta( $group_id, 'total_member_count') - 1 ); 249 249 250 250 // Modify user's group memberhip count 251 update_user_meta( $user_id, 'total_group_count', (int) get_user_meta( $user_id, 'total_group_count', true ) - 1 );251 update_user_meta( $user_id, $bp->user_meta_keys->total_group_count, (int) get_user_meta( $user_id, $bp->user_meta_keys->total_group_count, true ) - 1 ); 252 252 253 253 /** 254 254 * If the user joined this group less than five minutes ago, remove the -
bp-groups/bp-groups-notifications.php
9 9 10 10 $user_ids = BP_Groups_Member::get_group_member_ids( $group->id ); 11 11 foreach ( (array)$user_ids as $user_id ) { 12 if ( 'no' == get_user_meta( $user_id, 'notification_groups_group_updated', true ) ) continue;12 if ( 'no' == get_user_meta( $user_id, $bp->user_meta_keys->notification_groups_group_updated, true ) ) continue; 13 13 14 14 $ud = bp_core_get_core_userdata( $user_id ); 15 15 … … 47 47 48 48 bp_members_add_notification( $requesting_user_id, $admin_id, 'groups', 'new_membership_request', $group_id ); 49 49 50 if ( 'no' == get_user_meta( $admin_id, 'notification_groups_membership_request', true ) )50 if ( 'no' == get_user_meta( $admin_id, $bp->user_meta_keys->notification_groups_membership_request, true ) ) 51 51 return false; 52 52 53 53 $requesting_user_name = bp_core_get_user_displayname( $requesting_user_id ); … … 99 99 else 100 100 bp_members_add_notification( $group_id, $requesting_user_id, 'groups', 'membership_request_rejected' ); 101 101 102 if ( 'no' == get_user_meta( $requesting_user_id, 'notification_membership_request_completed', true ) )102 if ( 'no' == get_user_meta( $requesting_user_id, $bp->user_meta_keys->notification_membership_request_completed, true ) ) 103 103 return false; 104 104 105 105 $group = new BP_Groups_Group( $group_id ); … … 210 210 // Post a screen notification first. 211 211 bp_members_add_notification( $group->id, $invited_user_id, 'groups', 'group_invite' ); 212 212 213 if ( 'no' == get_user_meta( $invited_user_id, 'notification_groups_invite', true ) )213 if ( 'no' == get_user_meta( $invited_user_id, $bp->user_meta_keys->notification_groups_invite, true ) ) 214 214 return false; 215 215 216 216 $invited_ud = bp_core_get_core_userdata($invited_user_id); … … 271 271 continue; 272 272 273 273 // Now email the user with the contents of the message (if they have enabled email notifications) 274 if ( 'no' != get_user_meta( $user_id, 'notification_activity_new_mention', true ) ) {274 if ( 'no' != get_user_meta( $user_id, $bp->user_meta_keys->notification_activity_new_mention, true ) ) { 275 275 $poster_name = bp_core_get_user_displayname( $poster_user_id ); 276 276 277 277 $message_link = bp_activity_get_permalink( $activity_id );