[ Index ] |
PHP Cross Reference of BuddyPress |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Settings: Capabilities action handler. 4 * 5 * @package BuddyPress 6 * @subpackage SettingsActions 7 * @since 3.0.0 8 */ 9 10 /** 11 * Handles the setting of user capabilities, spamming, hamming, role, etc. 12 * 13 * @since 1.6.0 14 */ 15 function bp_settings_action_capabilities() { 16 if ( ! bp_is_post_request() ) { 17 return; 18 } 19 20 // Bail if no submit action. 21 if ( ! isset( $_POST['capabilities-submit'] ) ) { 22 return; 23 } 24 25 // Bail if not in settings. 26 if ( ! bp_is_settings_component() || ! bp_is_current_action( 'capabilities' ) ) { 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 // Only super admins can currently spam users (but they can't spam 37 // themselves). 38 if ( ! is_super_admin() || bp_is_my_profile() ) { 39 return; 40 } 41 42 // Nonce check. 43 check_admin_referer( 'capabilities' ); 44 45 /** 46 * Fires before the capabilities settings have been saved. 47 * 48 * @since 1.6.0 49 */ 50 do_action( 'bp_settings_capabilities_before_save' ); 51 52 /* Spam **************************************************************/ 53 54 $is_spammer = ! empty( $_POST['user-spammer'] ) ? true : false; 55 56 if ( bp_is_user_spammer( bp_displayed_user_id() ) != $is_spammer ) { 57 $status = ( true == $is_spammer ) ? 'spam' : 'ham'; 58 bp_core_process_spammer_status( bp_displayed_user_id(), $status ); 59 60 /** 61 * Fires after processing a user as a spammer. 62 * 63 * @since 1.1.0 64 * 65 * @param int $value ID of the currently displayed user. 66 * @param string $status Determined status of "spam" or "ham" for the displayed user. 67 */ 68 do_action( 'bp_core_action_set_spammer_status', bp_displayed_user_id(), $status ); 69 } 70 71 /* Other *************************************************************/ 72 73 /** 74 * Fires after the capabilities settings have been saved and before redirect. 75 * 76 * @since 1.6.0 77 */ 78 do_action( 'bp_settings_capabilities_after_save' ); 79 80 // Redirect to the root domain. 81 bp_core_redirect( bp_displayed_user_domain() . bp_get_settings_slug() . '/capabilities/' ); 82 } 83 add_action( 'bp_actions', 'bp_settings_action_capabilities' );
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Nov 21 01:00:57 2024 | Cross-referenced by PHPXref 0.7.1 |