Changeset 11931
- Timestamp:
- 04/02/2018 04:43:02 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 6 added
- 1 deleted
- 2 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-friends/classes/class-bp-friends-component.php
r11360 r11931 48 48 $includes = array( 49 49 'cache', 50 'actions',51 'screens',52 50 'filters', 53 51 'activity', … … 63 61 64 62 parent::includes( $includes ); 63 } 64 65 /** 66 * Late includes method. 67 * 68 * Only load up certain code when on specific pages. 69 * 70 * @since 3.0.0 71 */ 72 public function late_includes() { 73 // Bail if PHPUnit is running. 74 if ( defined( 'BP_TESTS_DIR' ) ) { 75 return; 76 } 77 78 // Friends. 79 if ( bp_is_user_friends() ) { 80 // Authenticated actions. 81 if ( is_user_logged_in() && 82 in_array( bp_current_action(), array( 'add-friend', 'remove-friend' ), true ) 83 ) { 84 require $this->path . 'bp-friends/actions/' . bp_current_action() . '.php'; 85 } 86 87 // User nav. 88 require $this->path . 'bp-friends/screens/my-friends.php'; 89 if ( is_user_logged_in() && bp_is_user_friend_requests() ) { 90 require $this->path . 'bp-friends/screens/requests.php'; 91 } 92 } 93 94 // Settings. 95 if ( bp_is_user_settings_notifications() ) { 96 require $this->path . 'bp-friends/screens/settings-email.php'; 97 } 65 98 } 66 99 -
trunk/src/bp-friends/screens/settings-email.php
r11930 r11931 1 1 <?php 2 2 /** 3 * BuddyPress Friends Screen Functions. 4 * 5 * Screen functions are the controllers of BuddyPress. They will execute when 6 * their specific URL is caught. They will first save or manipulate data using 7 * business functions, then pass on the user to a template file. 3 * Friends: Integration into user's "Settings > Email" screen 8 4 * 9 5 * @package BuddyPress 10 6 * @subpackage FriendsScreens 11 * @since 1.5.07 * @since 3.0.0 12 8 */ 13 14 // Exit if accessed directly.15 defined( 'ABSPATH' ) || exit;16 17 /**18 * Catch and process the My Friends page.19 *20 * @since 1.0.021 */22 function friends_screen_my_friends() {23 24 /**25 * Fires before the loading of template for the My Friends page.26 *27 * @since 1.0.028 */29 do_action( 'friends_screen_my_friends' );30 31 /**32 * Filters the template used to display the My Friends page.33 *34 * @since 1.0.035 *36 * @param string $template Path to the my friends template to load.37 */38 bp_core_load_template( apply_filters( 'friends_template_my_friends', 'members/single/home' ) );39 }40 41 /**42 * Catch and process the Requests page.43 *44 * @since 1.0.045 */46 function friends_screen_requests() {47 if ( bp_is_action_variable( 'accept', 0 ) && is_numeric( bp_action_variable( 1 ) ) ) {48 // Check the nonce.49 check_admin_referer( 'friends_accept_friendship' );50 51 if ( friends_accept_friendship( bp_action_variable( 1 ) ) )52 bp_core_add_message( __( 'Friendship accepted', 'buddypress' ) );53 else54 bp_core_add_message( __( 'Friendship could not be accepted', 'buddypress' ), 'error' );55 56 bp_core_redirect( trailingslashit( bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action() ) );57 58 } elseif ( bp_is_action_variable( 'reject', 0 ) && is_numeric( bp_action_variable( 1 ) ) ) {59 // Check the nonce.60 check_admin_referer( 'friends_reject_friendship' );61 62 if ( friends_reject_friendship( bp_action_variable( 1 ) ) )63 bp_core_add_message( __( 'Friendship rejected', 'buddypress' ) );64 else65 bp_core_add_message( __( 'Friendship could not be rejected', 'buddypress' ), 'error' );66 67 bp_core_redirect( trailingslashit( bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action() ) );68 69 } elseif ( bp_is_action_variable( 'cancel', 0 ) && is_numeric( bp_action_variable( 1 ) ) ) {70 // Check the nonce.71 check_admin_referer( 'friends_withdraw_friendship' );72 73 if ( friends_withdraw_friendship( bp_loggedin_user_id(), bp_action_variable( 1 ) ) )74 bp_core_add_message( __( 'Friendship request withdrawn', 'buddypress' ) );75 else76 bp_core_add_message( __( 'Friendship request could not be withdrawn', 'buddypress' ), 'error' );77 78 bp_core_redirect( trailingslashit( bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action() ) );79 }80 81 /**82 * Fires before the loading of template for the friends requests page.83 *84 * @since 1.0.085 */86 do_action( 'friends_screen_requests' );87 88 /**89 * Filters the template used to display the My Friends page.90 *91 * @since 1.0.092 *93 * @param string $template Path to the friends request template to load.94 */95 bp_core_load_template( apply_filters( 'friends_template_requests', 'members/single/home' ) );96 }97 9 98 10 /** -
trunk/tests/phpunit/includes/loader.php
r11928 r11931 24 24 * loaded at the same time to prevent weird load order issues. 25 25 */ 26 $components = array( 'activity', ' groups', 'members', 'messages', 'settings', 'xprofile' );26 $components = array( 'activity', 'friends', 'groups', 'members', 'messages', 'settings', 'xprofile' ); 27 27 foreach ( $components as $component ) { 28 28 add_action( "bp_{$component}_includes", function() use ( $component ) {
Note: See TracChangeset
for help on using the changeset viewer.