/** * Save custom checkbox * * @access public * @since 1.0 * * @param int $user_id * * @return void */ function rc_edit_user_profile_update($user_id) { // Proper authentication if (!current_user_can('edit_users')) { return; } // Do not show on user's own edit screen if (get_current_user_id() == $user_id) { return; } if (empty($_POST['rc_ban'])) { // Unlock rc_unban_user($user_id); } else { // Lock rc_ban_user($user_id); } }
/** * Save custom checkbox * * @access public * @since 1.0 * @return void */ function rc_edit_user_profile_update() { if (!current_user_can('edit_users')) { return; } global $user_id; // User cannot disable itself $current_user = wp_get_current_user(); $current_user_id = $current_user->ID; if ($current_user_id == $user_id) { return; } // Lock if (isset($_POST['rc_ban']) && ($_POST['rc_ban'] = 'on')) { rc_ban_user($user_id); } else { // Unlock rc_unban_user($user_id); } }