Changeset 11928 for trunk/src/bp-xprofile/screens/settings-profile.php
- Timestamp:
- 04/02/2018 04:32:31 AM (7 years ago)
- Location:
- trunk/src/bp-xprofile/screens
- Files:
-
- 1 added
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-xprofile/screens/settings-profile.php
r11927 r11928 1 1 <?php 2 2 /** 3 * BuddyPress XProfile Actions. 4 * 5 * Action functions are exactly the same as screen functions, however they do not 6 * have a template screen associated with them. Usually they will send the user 7 * back to the default screen after execution. 3 * XProfile: User's "Settings > Profile Visibility" screen handler 8 4 * 9 5 * @package BuddyPress 10 * @subpackage XProfile Actions11 * @since 1.5.06 * @subpackage XProfileScreens 7 * @since 3.0.0 12 8 */ 13 9 14 // Exit if accessed directly. 15 defined( 'ABSPATH' ) || exit; 10 /** 11 * Show the xprofile settings template. 12 * 13 * @since 2.0.0 14 */ 15 function bp_xprofile_screen_settings() { 16 16 17 /** 18 * This function runs when an action is set for a screen: 19 * example.com/members/andy/profile/change-avatar/ [delete-avatar] 20 * 21 * The function will delete the active avatar for a user. 22 * 23 * @since 1.0.0 24 * 25 */ 26 function xprofile_action_delete_avatar() { 27 28 if ( ! bp_is_user_change_avatar() || ! bp_is_action_variable( 'delete-avatar', 0 ) ) { 29 return false; 17 // Redirect if no privacy settings page is accessible. 18 if ( bp_action_variables() || ! bp_is_active( 'xprofile' ) ) { 19 bp_do_404(); 20 return; 30 21 } 31 22 32 // Check the nonce. 33 check_admin_referer( 'bp_delete_avatar_link' ); 34 35 if ( ! bp_is_my_profile() && ! bp_current_user_can( 'bp_moderate' ) ) { 36 return false; 37 } 38 39 if ( bp_core_delete_existing_avatar( array( 'item_id' => bp_displayed_user_id() ) ) ) { 40 bp_core_add_message( __( 'Your profile photo was deleted successfully!', 'buddypress' ) ); 41 } else { 42 bp_core_add_message( __( 'There was a problem deleting your profile photo. Please try again.', 'buddypress' ), 'error' ); 43 } 44 45 bp_core_redirect( wp_get_referer() ); 23 /** 24 * Filters the template to load for the XProfile settings screen. 25 * 26 * @since 2.0.0 27 * 28 * @param string $template Path to the XProfile change avatar template to load. 29 */ 30 bp_core_load_template( apply_filters( 'bp_settings_screen_xprofile', '/members/single/settings/profile' ) ); 46 31 } 47 add_action( 'bp_actions', 'xprofile_action_delete_avatar' );48 32 49 33 /**
Note: See TracChangeset
for help on using the changeset viewer.