Changes from branches/1.2/bp-friends.php at r3111 to tags/1.2.6/bp-friends.php at r3297
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tags/1.2.6/bp-friends.php
- Property svn:eol-style deleted
r3111 r3297 27 27 ) {$charset_collate};"; 28 28 29 require_once(ABSPATH . 'wp-admin/ upgrade-functions.php');29 require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); 30 30 dbDelta($sql); 31 31 … … 34 34 35 35 function friends_setup_globals() { 36 global $bp , $wpdb;36 global $bp; 37 37 38 38 /* For internal identification */ 39 39 $bp->friends->id = 'friends'; 40 40 41 $bp->friends->table_name = $wpdb->base_prefix . 'bp_friends'; 41 $bp->friends->slug = BP_FRIENDS_SLUG; 42 43 $bp->friends->table_name = $bp->table_prefix . 'bp_friends'; 44 42 45 $bp->friends->format_notification_function = 'friends_format_notifications'; 43 $bp->friends->slug = BP_FRIENDS_SLUG;44 46 45 47 /* Register this in the active components array */ … … 51 53 52 54 function friends_check_installed() { 53 global $ wpdb, $bp;54 55 if ( !is_s ite_admin() )55 global $bp; 56 57 if ( !is_super_admin() ) 56 58 return false; 57 59 … … 156 158 <td></td> 157 159 <td><?php _e( 'A member sends you a friendship request', 'buddypress' ) ?></td> 158 <td class="yes"><input type="radio" name="notifications[notification_friends_friendship_request]" value="yes" <?php if ( !get_user meta( $current_user->id,'notification_friends_friendship_request') || 'yes' == get_usermeta( $current_user->id,'notification_friends_friendship_request') ) { ?>checked="checked" <?php } ?>/></td>159 <td class="no"><input type="radio" name="notifications[notification_friends_friendship_request]" value="no" <?php if ( get_user meta( $current_user->id,'notification_friends_friendship_request') == 'no' ) { ?>checked="checked" <?php } ?>/></td>160 <td class="yes"><input type="radio" name="notifications[notification_friends_friendship_request]" value="yes" <?php if ( !get_user_meta( $current_user->id, 'notification_friends_friendship_request', true ) || 'yes' == get_user_meta( $current_user->id, 'notification_friends_friendship_request', true ) ) { ?>checked="checked" <?php } ?>/></td> 161 <td class="no"><input type="radio" name="notifications[notification_friends_friendship_request]" value="no" <?php if ( get_user_meta( $current_user->id, 'notification_friends_friendship_request', true ) == 'no' ) { ?>checked="checked" <?php } ?>/></td> 160 162 </tr> 161 163 <tr> 162 164 <td></td> 163 165 <td><?php _e( 'A member accepts your friendship request', 'buddypress' ) ?></td> 164 <td class="yes"><input type="radio" name="notifications[notification_friends_friendship_accepted]" value="yes" <?php if ( !get_user meta( $current_user->id,'notification_friends_friendship_accepted') || 'yes' == get_usermeta( $current_user->id,'notification_friends_friendship_accepted') ) { ?>checked="checked" <?php } ?>/></td>165 <td class="no"><input type="radio" name="notifications[notification_friends_friendship_accepted]" value="no" <?php if ( 'no' == get_user meta( $current_user->id,'notification_friends_friendship_accepted') ) { ?>checked="checked" <?php } ?>/></td>166 <td class="yes"><input type="radio" name="notifications[notification_friends_friendship_accepted]" value="yes" <?php if ( !get_user_meta( $current_user->id, 'notification_friends_friendship_accepted', true ) || 'yes' == get_user_meta( $current_user->id, 'notification_friends_friendship_accepted', true ) ) { ?>checked="checked" <?php } ?>/></td> 167 <td class="no"><input type="radio" name="notifications[notification_friends_friendship_accepted]" value="no" <?php if ( 'no' == get_user_meta( $current_user->id, 'notification_friends_friendship_accepted', true ) ) { ?>checked="checked" <?php } ?>/></td> 166 168 </tr> 167 169 … … 281 283 'item_id' => false, 282 284 'secondary_item_id' => false, 283 'recorded_time' => gmdate( "Y-m-d H:i:s"),285 'recorded_time' => bp_core_current_time(), 284 286 'hide_sitewide' => false 285 287 ); … … 362 364 $friendship->is_confirmed = 0; 363 365 $friendship->is_limited = 0; 364 $friendship->date_created = time();366 $friendship->date_created = bp_core_current_time(); 365 367 366 368 if ( $force_accept ) … … 416 418 friends_update_friend_totals( $friendship->initiator_user_id, $friendship->friend_user_id ); 417 419 418 / * Remove the friend request notice */420 // Remove the friend request notice 419 421 bp_core_delete_notifications_for_user_by_item_id( $friendship->friend_user_id, $friendship->initiator_user_id, $bp->friends->id, 'friendship_request' ); 420 422 421 / * Add a friend accepted notice for the initiating user */423 // Add a friend accepted notice for the initiating user 422 424 bp_core_add_notification( $friendship->friend_user_id, $friendship->initiator_user_id, $bp->friends->id, 'friendship_accepted' ); 423 425 … … 425 427 $friend_link = bp_core_get_userlink( $friendship->friend_user_id ); 426 428 427 / * Record in activity streams for the initiator */429 // Record in activity streams for the initiator 428 430 friends_record_activity( array( 429 'user_id' => $friendship->initiator_user_id, 430 'type' => 'friendship_created', 431 'action' => apply_filters( 'friends_activity_friendship_accepted_action', sprintf( __( '%s and %s are now friends', 'buddypress' ), $initiator_link, $friend_link ), &$friendship ), 432 'item_id' => $friendship_id 431 'user_id' => $friendship->initiator_user_id, 432 'type' => 'friendship_created', 433 'action' => apply_filters( 'friends_activity_friendship_accepted_action', sprintf( __( '%s and %s are now friends', 'buddypress' ), $initiator_link, $friend_link ), &$friendship ), 434 'item_id' => $friendship_id, 435 'secondary_item_id' => $friendship->friend_user_id 433 436 ) ); 434 437 435 / * Record in activity streams for the friend */438 // Record in activity streams for the friend 436 439 friends_record_activity( array( 437 'user_id' => $friendship->friend_user_id, 438 'type' => 'friendship_created', 439 'action' => apply_filters( 'friends_activity_friendship_accepted_action', sprintf( __( '%s and %s are now friends', 'buddypress' ), $friend_link, $initiator_link ), &$friendship ), 440 'item_id' => $friendship_id, 441 'hide_sitewide' => true /* We've already got the first entry site wide */ 440 'user_id' => $friendship->friend_user_id, 441 'type' => 'friendship_created', 442 'action' => apply_filters( 'friends_activity_friendship_accepted_action', sprintf( __( '%s and %s are now friends', 'buddypress' ), $friend_link, $initiator_link ), &$friendship ), 443 'item_id' => $friendship_id, 444 'secondary_item_id' => $friendship->initiator_user_id, 445 'hide_sitewide' => true // We've already got the first entry site wide 442 446 ) ); 443 447 444 / * Send the email notification */448 // Send the email notification 445 449 require_once( BP_PLUGIN_DIR . '/bp-friends/bp-friends-notifications.php' ); 446 450 friends_notification_accepted_request( $friendship->id, $friendship->initiator_user_id, $friendship->friend_user_id ); … … 488 492 489 493 if ( !$count = wp_cache_get( 'bp_total_friend_count_' . $user_id, 'bp' ) ) { 490 $count = get_user meta( $user_id, 'total_friend_count');494 $count = get_user_meta( $user_id, 'total_friend_count', true ); 491 495 if ( empty( $count ) ) $count = 0; 492 496 wp_cache_set( 'bp_total_friend_count_' . $user_id, $count, 'bp' ); … … 591 595 function friends_update_friend_totals( $initiator_user_id, $friend_user_id, $status = 'add' ) { 592 596 if ( 'add' == $status ) { 593 update_user meta( $initiator_user_id, 'total_friend_count', (int)get_usermeta( $initiator_user_id, 'total_friend_count') + 1 );594 update_user meta( $friend_user_id, 'total_friend_count', (int)get_usermeta( $friend_user_id, 'total_friend_count') + 1 );597 update_user_meta( $initiator_user_id, 'total_friend_count', (int)get_user_meta( $initiator_user_id, 'total_friend_count', true ) + 1 ); 598 update_user_meta( $friend_user_id, 'total_friend_count', (int)get_user_meta( $friend_user_id, 'total_friend_count', true ) + 1 ); 595 599 } else { 596 update_user meta( $initiator_user_id, 'total_friend_count', (int)get_usermeta( $initiator_user_id, 'total_friend_count') - 1 );597 update_user meta( $friend_user_id, 'total_friend_count', (int)get_usermeta( $friend_user_id, 'total_friend_count') - 1 );600 update_user_meta( $initiator_user_id, 'total_friend_count', (int)get_user_meta( $initiator_user_id, 'total_friend_count', true ) - 1 ); 601 update_user_meta( $friend_user_id, 'total_friend_count', (int)get_user_meta( $friend_user_id, 'total_friend_count', true ) - 1 ); 598 602 } 599 603 } … … 603 607 604 608 /* Remove usermeta */ 605 delete_user meta( $user_id, 'total_friend_count' );609 delete_user_meta( $user_id, 'total_friend_count' ); 606 610 607 611 /* Remove friendship requests FROM user */
Note: See TracChangeset
for help on using the changeset viewer.