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