Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/16/2012 02:57:03 AM (13 years ago)
Author:
johnjamesjacoby
Message:

Add the ability to cancel a pending friendship request. Props ddean. Fixes #3897.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-themes/bp-default/_inc/ajax.php

    r5927 r5931  
    526526            echo __("Friendship could not be requested.", 'buddypress');
    527527        } 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');
    529538        }
    530539    } else {
Note: See TracChangeset for help on using the changeset viewer.