onclick="jQuery.post('', {action: 'updraftplus_user_notice_ajax', subaction: 'admin_only_login', nonce: '', admin_only_login: jQuery(this).is(':checked') });">
ID)) return $user; $admin_login = get_site_option('updraftplus_clone_admin_only_login'); $user_is_admin = user_can($user->ID, 'manage_options'); if (!$user_is_admin && $admin_login) { return new WP_Error('user_login_disabled', 'ERROR: This user account is not allowed to login.'); } return $user; } /** * This function will perform security checks before allowing the ajax calls for the UpdraftPlus clone VPS mu-plugin be processed. * * @return void */ public function updraftplus_user_notice_ajax() { if (is_user_logged_in() && current_user_can('manage_options')) { $this->process_user_notice_ajax(); } } /** * This function will handle the ajax calls for the UpdraftPlus clone user notice mu-plugin. * * @return void */ public function process_user_notice_ajax() { $return = array('code' => 'fail', 'data' => ''); if (!isset($_POST['subaction'])) { $return['code'] = 'error'; $return['data'] = 'Missing subaction'; echo json_encode($return); die(); } if ('admin_only_login' == $_POST['subaction']) { check_ajax_referer('updraftplus_admin_only_login', 'nonce'); if (!isset($_POST['admin_only_login'])) { $return['code'] = 'error'; $return['data'] = 'Missing parameter'; echo json_encode($return); die(); } $admin_only = ('true' === $_POST['admin_only_login']); update_site_option('updraftplus_clone_admin_only_login', $admin_only); $return['code'] = 'success'; $return['data'] = 'Option updated'; echo json_encode($return); die(); } else { $return['code'] = 'error'; $return['data'] = 'Unknown action'; echo json_encode($return); die(); } } } if (defined('UPDRAFTPLUS_THIS_IS_CLONE')) { $updraftplus_temporary_clone_user_notice = new UpdraftPlus_Temporary_Clone_User_Notice(); }