function check_form_nonce($field) { $nonce = $_REQUEST['_wpnonce']; if (!wp_verify_nonce($nonce, $field)) { $flash_message = new Flash_Message(); $flash_message->set(__('Cheating?', 'wpcdi'), 'error'); $flash_message->flash_messages(); return; } }
private static function submit_login_form() { $flash_messages = new Flash_Message(); $post = $_POST; $info['user_login'] = array_get($post, 'username'); $info['user_password'] = array_get($post, 'password'); $info['remember'] = array_get($post, 'remember_me'); $user_signon = wp_signon($info, false); if ($user_signon && !is_wp_error($user_signon)) { $user = new WP_User($user_signon->ID); if (!empty($user->roles) && is_array($user->roles)) { foreach ($user->roles as $role) { $user_role = $role; } } wp_redirect(home_url()); die; } else { $flash_messages->set(__('You entered invalid Username and Password. Please try again.', 'wp'), 'error'); return false; } }
private static function submit_login_form() { $flash_messages = new Flash_Message(); $post = $_POST; $info['user_login'] = array_get($post, 'username'); $info['user_password'] = array_get($post, 'password'); $info['remember'] = array_get($post, 'remember_me'); $user_signon = wp_signon($info, false); if ($user_signon && !is_wp_error($user_signon)) { $user = new WP_User($user_signon->ID); if (!empty($user->roles) && is_array($user->roles)) { foreach ($user->roles as $role) { $user_role = $role; } } $flash_messages->set(__('Login successful, redirecting...', 'wp'), 'updated'); #wp_redirect(site_url().'/curator-detail/?id='.$user->ID); wp_redirect(home_url()); die; #return false; } else { $flash_messages->set(__('Wrong username or password.', 'wp'), 'error'); return false; } }