Changeset 5931
- Timestamp:
- 03/16/2012 02:57:03 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-friends/bp-friends-classes.php
r5729 r5931 208 208 } 209 209 210 public static function withdraw($friendship_id) { 211 global $wpdb, $bp; 212 213 return $wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->friends->table_name} WHERE id = %d AND initiator_user_id = %d", $friendship_id, bp_loggedin_user_id() ) ); 214 } 215 210 216 public static function reject($friendship_id) { 211 217 global $wpdb, $bp; -
trunk/bp-friends/bp-friends-functions.php
r5729 r5931 134 134 135 135 do_action_ref_array( 'friends_friendship_rejected', array( $friendship_id, &$friendship ) ); 136 return true; 137 } 138 139 return false; 140 } 141 142 function friends_withdraw_friendship( $initiator_userid, $friend_userid ) { 143 global $bp; 144 145 $friendship_id = BP_Friends_Friendship::get_friendship_id( $initiator_userid, $friend_userid ); 146 $friendship = new BP_Friends_Friendship( $friendship_id, true, false ); 147 148 if ( !$friendship->is_confirmed && BP_Friends_Friendship::withdraw( $friendship_id ) ) { 149 // Remove the friend request notice 150 bp_core_delete_notifications_by_item_id( $friendship->friend_user_id, $friendship->initiator_user_id, $bp->friends->id, 'friendship_request' ); 151 152 do_action_ref_array( 'friends_friendship_whithdrawn', array( $friendship_id, &$friendship ) ); 136 153 return true; 137 154 } -
trunk/bp-friends/bp-friends-screens.php
r5712 r5931 46 46 else 47 47 bp_core_add_message( __( 'Friendship could not be rejected', 'buddypress' ), 'error' ); 48 49 bp_core_redirect( trailingslashit( bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action() ) ); 50 51 } elseif ( bp_is_action_variable( 'cancel', 0 ) && is_numeric( bp_action_variable( 1 ) ) ) { 52 // Check the nonce 53 check_admin_referer( 'friends_withdraw_friendship' ); 54 55 if ( friends_withdraw_friendship( bp_loggedin_user_id(), bp_action_variable( 1 ) ) ) 56 bp_core_add_message( __( 'Friendship request withdrawn', 'buddypress' ) ); 57 else 58 bp_core_add_message( __( 'Friendship request could not be withdrawn', 'buddypress' ), 'error' ); 48 59 49 60 bp_core_redirect( trailingslashit( bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action() ) ); -
trunk/bp-friends/bp-friends-template.php
r5927 r5931 319 319 'must_be_logged_in' => true, 320 320 'block_self' => true, 321 'wrapper_class' => 'friendship-button pending ',321 'wrapper_class' => 'friendship-button pending_friend', 322 322 'wrapper_id' => 'friendship-button-' . $potential_friend_id, 323 'link_href' => trailingslashit( bp_loggedin_user_domain() . bp_get_friends_slug() . '/requests' ), 324 'link_text' => __( 'Friendship Requested', 'buddypress' ), 325 'link_title' => __( 'Friendship Requested', 'buddypress' ), 326 'link_class' => 'friendship-button pending requested' 323 'link_href' => wp_nonce_url( bp_loggedin_user_domain() . bp_get_friends_slug() . '/requests/cancel/' . $potential_friend_id . '/', 'friends_withdraw_friendship' ), 324 'link_text' => __( 'Cancel Friendship Request', 'buddypress' ), 325 'link_title' => __( 'Cancel Friendship Requested', 'buddypress' ), 326 'link_id' => 'friend-' . $potential_friend_id, 327 'link_rel' => 'remove', 328 'link_class' => 'friendship-button pending_friend requested' 327 329 ); 328 330 break; -
trunk/bp-themes/bp-default/_inc/ajax.php
r5927 r5931 526 526 echo __("Friendship could not be requested.", 'buddypress'); 527 527 } else { 528 echo '<a href="' . bp_loggedin_user_domain() . bp_get_friends_slug() . '/requests" class="requested">' . __( 'Friendship Requested', 'buddypress' ) . '</a>'; 528 echo '<a id="friend-' . $_POST['fid'] . '" class="remove" rel="remove" title="' . __( 'Cancel Friendship Request', 'buddypress' ) . '" href="' . wp_nonce_url( bp_loggedin_user_domain() . bp_get_friends_slug() . '/requests/cancel/' . (int)$_POST['fid'] . '/', 'friends_withdraw_friendship' ) . '" class="requested">' . __( 'Cancel Friendship Request', 'buddypress' ) . '</a>'; 529 } 530 } else if( 'pending' == BP_Friends_Friendship::check_is_friend( bp_loggedin_user_id(), (int)$_POST['fid'] ) ) { 531 532 check_ajax_referer('friends_withdraw_friendship'); 533 534 if ( friends_withdraw_friendship( bp_loggedin_user_id(), (int)$_POST['fid'] ) ) { 535 echo '<a id="friend-' . $_POST['fid'] . '" class="add" rel="add" title="' . __( 'Add Friend', 'buddypress' ) . '" href="' . wp_nonce_url( bp_loggedin_user_domain() . bp_get_friends_slug() . '/add-friend/' . $_POST['fid'], 'friends_add_friend' ) . '">' . __( 'Add Friend', 'buddypress' ) . '</a>'; 536 } else { 537 echo __("Friendship request could not be cancelled.", 'buddypress'); 529 538 } 530 539 } else { -
trunk/bp-themes/bp-default/_inc/global.js
r5868 r5931 918 918 parentdiv.removeClass('add_friend'); 919 919 parentdiv.removeClass('loading'); 920 parentdiv.addClass('pending ');920 parentdiv.addClass('pending_friend'); 921 921 parentdiv.fadeIn(200).html(response); 922 922 }
Note: See TracChangeset
for help on using the changeset viewer.