[ Index ] |
PHP Cross Reference of BuddyPress |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Settings: Account deletion action handler. 4 * 5 * @package BuddyPress 6 * @subpackage SettingsActions 7 * @since 3.0.0 8 */ 9 10 /** 11 * Handles the deleting of a user. 12 * 13 * @since 1.6.0 14 */ 15 function bp_settings_action_delete_account() { 16 if ( ! bp_is_post_request() ) { 17 return; 18 } 19 20 // Bail if no submit action. 21 if ( ! isset( $_POST['delete-account-understand'] ) ) { 22 return; 23 } 24 25 // Bail if not in settings. 26 if ( ! bp_is_settings_component() || ! bp_is_current_action( 'delete-account' ) ) { 27 return false; 28 } 29 30 // 404 if there are any additional action variables attached 31 if ( bp_action_variables() ) { 32 bp_do_404(); 33 return; 34 } 35 36 // Bail if account deletion is disabled. 37 if ( bp_disable_account_deletion() && ! bp_current_user_can( 'delete_users' ) ) { 38 return false; 39 } 40 41 // Nonce check. 42 check_admin_referer( 'delete-account' ); 43 44 // Get username now because it might be gone soon! 45 $username = bp_get_displayed_user_fullname(); 46 47 // Delete the users account. 48 if ( bp_core_delete_account( bp_displayed_user_id() ) ) { 49 50 // Add feedback after deleting a user. 51 bp_core_add_message( 52 sprintf( 53 /* translators: %s: user username */ 54 __( '%s was successfully deleted.', 'buddypress' ), 55 $username 56 ), 57 'success' 58 ); 59 60 // Redirect to the root domain. 61 bp_core_redirect( bp_get_root_domain() ); 62 } 63 } 64 add_action( 'bp_actions', 'bp_settings_action_delete_account' );
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Dec 22 01:00:54 2024 | Cross-referenced by PHPXref 0.7.1 |