friends_screen_requests()
Catch and process the Requests page.
Description
Source
File: bp-friends/screens/requests.php
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | function friends_screen_requests() { if ( bp_is_action_variable( 'accept' , 0 ) && is_numeric ( bp_action_variable( 1 ) ) ) { // Check the nonce. check_admin_referer( 'friends_accept_friendship' ); if ( friends_accept_friendship( bp_action_variable( 1 ) ) ) bp_core_add_message( __( 'Connection accepted' , 'buddyboss' ) ); else bp_core_add_message( __( 'Connection could not be accepted' , 'buddyboss' ), 'error' ); bp_core_redirect( trailingslashit( bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action() ) ); } elseif ( bp_is_action_variable( 'reject' , 0 ) && is_numeric ( bp_action_variable( 1 ) ) ) { // Check the nonce. check_admin_referer( 'friends_reject_friendship' ); if ( friends_reject_friendship( bp_action_variable( 1 ) ) ) bp_core_add_message( __( 'Connection rejected' , 'buddyboss' ) ); else bp_core_add_message( __( 'Connection could not be rejected' , 'buddyboss' ), 'error' ); bp_core_redirect( trailingslashit( bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action() ) ); } elseif ( bp_is_action_variable( 'cancel' , 0 ) && is_numeric ( bp_action_variable( 1 ) ) ) { // Check the nonce. check_admin_referer( 'friends_withdraw_friendship' ); if ( friends_withdraw_friendship( bp_loggedin_user_id(), bp_action_variable( 1 ) ) ) bp_core_add_message( __( 'Connection request withdrawn' , 'buddyboss' ) ); else bp_core_add_message( __( 'Connection request could not be withdrawn' , 'buddyboss' ), 'error' ); bp_core_redirect( trailingslashit( bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action() ) ); } /** * Fires before the loading of template for the friends requests page. * * @since BuddyPress 1.0.0 */ do_action( 'friends_screen_requests' ); /** * Filters the template used to display the My Connections page. * * @since BuddyPress 1.0.0 * * @param string $template Path to the friends request template to load. */ bp_core_load_template( apply_filters( 'friends_template_requests' , 'members/single/home' ) ); } |
Changelog
Version | Description |
---|---|
BuddyPress 1.0.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.