本文整理汇总了PHP中wp_clear_auth_cookie函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_clear_auth_cookie函数的具体用法?PHP wp_clear_auth_cookie怎么用?PHP wp_clear_auth_cookie使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_clear_auth_cookie函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: otl_authenticate_one_time_login
/**
* Process one time login
*
* @since 1.0.0
*
* @return void
*/
function otl_authenticate_one_time_login()
{
// No need to run if not a singular query for the one time login
if (!is_single()) {
return;
}
// No need to run if not a onetimelogin post
global $post;
if ('onetimelogin' !== $post->post_type) {
return;
}
$user_id = get_post_meta(get_the_ID(), 'otl_user', true);
$valid_user = get_userdata($user_id) ? true : false;
$login_uses = get_post_meta(get_the_ID(), 'otl_times_used', true);
// If the one time login is unused and the user is valid, log in
if ('0' === $login_uses && $valid_user) {
// Log in
wp_clear_auth_cookie();
wp_set_current_user($user_id);
wp_set_auth_cookie($user_id);
// Update some meta for logging and to prevent multiple uses
update_post_meta(get_the_ID(), 'otl_times_used', '1');
update_post_meta(get_the_ID(), 'otl_datetime_used', current_time('mysql'));
// Redirect to wp-admin
wp_safe_redirect(user_admin_url());
exit;
} else {
wp_redirect(home_url());
exit;
}
return;
}
开发者ID:ryanduff,项目名称:one-time-login,代码行数:39,代码来源:login-handler.php
示例2: cps_ban_check
function cps_ban_check()
{
if (!is_user_logged_in()) {
return;
}
global $current_user;
if (is_multisite()) {
if (empty($current_user->roles)) {
load_template(dirname(__FILE__) . '/wp_ban_cps_ms_alert.php');
}
foreach ($current_user->roles as $role) {
if ($role == 'banned') {
load_template(dirname(__FILE__) . '/wp_ban_cps_ms_alert.php');
}
}
} else {
foreach ($current_user->roles as $role) {
if ($role == 'banned') {
wp_clear_auth_cookie();
do_action('wp_logout');
wp_redirect(home_url());
exit;
}
}
}
}
开发者ID:Laxiston,项目名称:casepress,代码行数:26,代码来源:wp_ban_cps.php
示例3: synlogout
function synlogout($get, $post)
{
!API_SYNLOGOUT && exit(API_RETURN_FORBIDDEN);
header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"');
wp_clear_auth_cookie();
exit(API_RETURN_SUCCEED);
}
开发者ID:hotmob,项目名称:likedome,代码行数:7,代码来源:uc.php
示例4: awaycheck
/**
* Redirects to homepage if awaymode is active
*
**/
function awaycheck()
{
global $bwps;
if ($bwps->checkaway()) {
wp_redirect(get_option('siteurl'));
wp_clear_auth_cookie();
}
}
开发者ID:ipman3,项目名称:Mediassociates-wp,代码行数:12,代码来源:common.php
示例5: logout
public function logout(StatTracker $app)
{
wp_clear_auth_cookie();
$app['session']->set("agent", null);
session_destroy();
$response = new stdClass();
$response->status = "logged_out";
$this->logger->info(sprintf("%s logged out", $agent->name));
return $response;
}
开发者ID:helifino,项目名称:StatTracker,代码行数:10,代码来源:WordpressProvider.php
示例6: logout_idle_user
function logout_idle_user()
{
if (is_user_logged_in()) {
do_action('uil_before_logout', get_current_user_id());
}
delete_user_meta(get_current_user_id(), 'last_active_time');
wp_clear_auth_cookie();
do_action('uil_after_logout');
die('true');
}
开发者ID:abiralneupane,项目名称:Idle-User-Logout,代码行数:10,代码来源:iul_actions.php
示例7: run_active_check
/**
* Execute away mode functionality
*
* @return void
*/
public function run_active_check()
{
global $itsec_logger;
//execute lockout if applicable
if (self::is_active()) {
$itsec_logger->log_event('away_mode', 5, array(__('A host was prevented from accessing the dashboard due to away-mode restrictions being in effect', 'better-wp-security')), ITSEC_Lib::get_ip(), '', '', '', '');
wp_redirect(get_option('siteurl'));
wp_clear_auth_cookie();
die;
}
}
开发者ID:Garth619,项目名称:Femi9,代码行数:16,代码来源:class-itsec-away-mode.php
示例8: login
/**
* Login existing WP user.
*
* @param $wp_user
*/
public function login($wp_user)
{
// Login procedure.
wp_clear_auth_cookie();
wp_set_current_user($wp_user->ID);
wp_set_auth_cookie($wp_user->ID);
// Hook for changing WP user metadata from Gigya's user.
do_action('gigya_after_social_login', $this->gigya_user, $wp_user);
// Do others login Implementations.
do_action('wp_login', $wp_user->data->user_login, $wp_user);
}
开发者ID:eferrao,项目名称:sp-wordpress,代码行数:16,代码来源:GigyaLoginAjax.php
示例9: login
function login($login, $password)
{
wp_clear_auth_cookie();
$creds = array();
$creds['user_login'] = $login;
$creds['user_password'] = $password;
$creds['remember'] = false;
$user = wp_signon($creds, false);
if (is_wp_error($user)) {
die("Invalid user name or password");
}
}
开发者ID:palbitz1003,项目名称:CMGC,代码行数:12,代码来源:functions.php
示例10: login
/**
* Login existing WP user.
*
* @param $wp_user
*/
public function login($wp_user)
{
// Login procedure.
wp_clear_auth_cookie();
wp_set_current_user($wp_user->ID);
wp_set_auth_cookie($wp_user->ID);
_gigya_add_to_wp_user_meta($this->gigya_account['profile'], $wp_user->ID);
// Hook for changing WP user metadata from Gigya's user.
do_action('gigya_after_raas_login', $this->gigya_account, $wp_user);
// Do other login Implementations.
do_action('wp_login', $wp_user->data->user_login, $wp_user);
}
开发者ID:eferrao,项目名称:sp-wordpress,代码行数:17,代码来源:GigyaRaasAjax.php
示例11: log_user
static function log_user($user_id)
{
$user = get_user_by('id', $user_id);
// Redirect URL //
if (!is_wp_error($user)) {
wp_clear_auth_cookie();
wp_set_current_user($user->ID);
wp_set_auth_cookie($user->ID);
return TRUE;
}
return FALSE;
}
开发者ID:gpsidhuu,项目名称:alphaReputation,代码行数:12,代码来源:xsUTL.php
示例12: user_login
public function user_login()
{
$response = array('redirect' => false, 'request' => $_POST);
//Check for empty fields
if (empty($_POST['email']) || empty($_POST['pwd'])) {
//create new error object and add errors to it.
$error = new WP_Error();
if (empty($email)) {
//No email
$error->add('empty_username', __('<strong>ERROR</strong>: Email field is empty.'));
} else {
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
//Invalid Email
$error->add('invalid_username', __('<strong>ERROR</strong>: Email is invalid.'));
}
}
if (empty($meta['password'])) {
//No password
$error->add('empty_password', __('<strong>ERROR</strong>: Password field is empty.'));
}
$response['errors'] = $error;
}
if (empty($response['errors'])) {
$email = $_POST['email'];
$meta['password'] = $_POST['pwd'];
//Check if user exists in WordPress database
$user = get_user_by('email', $email);
//bad email
if (!$user) {
$error = new WP_Error();
$error->add('invalid', __('<strong>ERROR</strong>: Either the email or password you entered is invalid.'));
$response['errors'] = $error;
} else {
//check password
if (!wp_check_password($meta['password'], $user->user_pass, $user->ID)) {
//bad password
$error = new WP_Error();
$error->add('invalid', __('<strong>ERROR</strong>: Either the email or password you entered is invalid.'));
$response['errors'] = $error;
} else {
wp_clear_auth_cookie();
wp_set_current_user($user->ID);
wp_set_auth_cookie($user->ID);
$response['redirect'] = !empty($_POST['redirect_to']) ? $_POST['redirect_to'] : home_url();
$response['user'] = $user;
}
}
}
echo json_encode($response);
exit;
}
开发者ID:darbymanning,项目名称:Family-Church,代码行数:51,代码来源:UserController.php
示例13: pc_wp_user_login
function pc_wp_user_login($user_login, $user)
{
global $wpdb;
global $pc_wp_user;
// do not execute if is a pvtcontent login
if (!isset($GLOBALS['pc_wps_standard_login'])) {
$user_data = $pc_wp_user->wp_user_is_linked($user->ID);
if ($user_data) {
// PC-FILTER - custom login control for custom checks - passes false and user id - return message to abort login otherwise false
$custom_check = apply_filters('pc_login_custom_check', false, $user_data->id);
// check status
if ((int) $user_data->status !== 1 || $custom_check !== false) {
// Clear cookies -> log user out
wp_clear_auth_cookie();
$error_param = $custom_check !== false ? $custom_check : $user_data->status;
// redirect adding disabling parameter - for pc_wp_user_login_message() function
$login_url = site_url('wp-login.php', 'login');
$login_url = add_query_arg('pc_disabled', $error_param, $login_url);
wp_redirect($login_url);
exit;
} else {
include_once PC_DIR . '/functions.php';
//// login in pvtContent
// setup user session, cookie and global
$_SESSION['pc_user_id'] = $user_data->id;
$GLOBALS['pc_user_id'] = $user_data->id;
// set cookie
$cookie_time = isset($_POST['rememberme']) ? 3600 * 24 * 30 * 6 : 3600 * 6;
// 6 month or 6 hours
setcookie('pc_user', $user_data->id . '|||' . $user_data->psw, time() + $cookie_time, '/');
// update last login date
$wpdb->update(PC_USERS_TABLE, array('last_access' => current_time('mysql')), array('id' => $user_data->id));
//// redirect after login
// check for custom categories redirects
$custom_cat_redirect = pc_user_cats_login_redirect($user_data->categories);
if ($custom_cat_redirect) {
$redirect_url = $custom_cat_redirect;
} else {
if (get_option('pg_logged_user_redirect')) {
$redirect_url = pc_man_redirects('pg_logged_user_redirect');
} else {
$redirect_url = site_url();
}
}
wp_redirect($redirect_url);
exit;
}
}
}
}
开发者ID:jfbelisle,项目名称:magexpress,代码行数:50,代码来源:wp_user_tricks.php
示例14: wppb_autologin_after_password_changed
function wppb_autologin_after_password_changed()
{
if (isset($_POST['action']) && $_POST['action'] == 'edit_profile') {
if (isset($_POST['passw1']) && !empty($_POST['passw1']) && !empty($_POST['form_name'])) {
/* all the error checking filters are defined in each field file so we need them here */
if (file_exists(WPPB_PLUGIN_DIR . '/front-end/default-fields/default-fields.php')) {
require_once WPPB_PLUGIN_DIR . '/front-end/default-fields/default-fields.php';
}
if (file_exists(WPPB_PLUGIN_DIR . '/front-end/extra-fields/extra-fields.php')) {
require_once WPPB_PLUGIN_DIR . '/front-end/extra-fields/extra-fields.php';
}
/* we get the form_name through $_POST so we can apply correctly the filter so we generate the correct fields in the current form */
$form_fields = apply_filters('wppb_change_form_fields', get_option('wppb_manage_fields'), array('form_type' => 'edit_profile', 'form_fields' => array(), 'form_name' => $_POST['form_name'], 'role' => '', 'ID' => Profile_Builder_Form_Creator::wppb_get_form_id_from_form_name($_POST['form_name'], 'edit_profile')));
if (!empty($form_fields)) {
/* check for errors in the form through the filters */
$output_field_errors = array();
foreach ($form_fields as $field) {
$error_for_field = apply_filters('wppb_check_form_field_' . Wordpress_Creation_Kit_PB::wck_generate_slug($field['field']), '', $field, $_POST, 'edit_profile');
if (!empty($error_for_field)) {
$output_field_errors[$field['id']] = '<span class="wppb-form-error">' . $error_for_field . '</span>';
}
}
/* if we have no errors change the password */
if (empty($output_field_errors)) {
$user_id = get_current_user_id();
if (!is_multisite() && current_user_can('edit_users') || is_multisite() && current_user_can('manage_network')) {
if (isset($_GET['edit_user']) && !empty($_GET['edit_user'])) {
$user_id = $_GET['edit_user'];
}
}
if (!isset($_GET['edit_user'])) {
wp_clear_auth_cookie();
/* set the new password for the user */
wp_set_password($_POST['passw1'], $user_id);
// Here we calculate the expiration length of the current auth cookie and compare it to the default expiration.
// If it's greater than this, then we know the user checked 'Remember Me' when they logged in.
$logged_in_cookie = wp_parse_auth_cookie('', 'logged_in');
/** This filter is documented in wp-includes/pluggable.php */
$default_cookie_life = apply_filters('auth_cookie_expiration', 2 * DAY_IN_SECONDS, $user_id, false);
$remember = $logged_in_cookie['expiration'] - time() > $default_cookie_life;
wp_set_auth_cookie($user_id, $remember);
} else {
wp_set_password($_POST['passw1'], $user_id);
}
}
}
}
}
}
开发者ID:aaronfrey,项目名称:PepperLillie-TAT,代码行数:49,代码来源:edit-profile.php
示例15: purge_browser_cookie
/**
* Clear the authentication cookies.
*
* @param array|string $cookie The current authentication cookie.
*/
public static function purge_browser_cookie($cookie)
{
// Remove the action to prevent recursion with some plugins (notably s2member)
remove_action(current_action(), array(__CLASS__, __FUNCTION__));
/*
* Sometimes the cookie is empty because WordPress uses multiple types of auth cookies.
* When one of the cookies is empty, we don't want to purge the cookies because other
* cookies may have us legitimately logged in *and* empty cookies (e.g., unset) aren't
* doing the cache-busting that prompts us to want to purge.
*/
if (empty($cookie)) {
return;
}
wp_clear_auth_cookie();
}
开发者ID:TRPmarketingsite,项目名称:marketingsite,代码行数:20,代码来源:class.cookies.php
示例16: ihc_do_logout
function ihc_do_logout($current_url)
{
$url = get_option('ihc_general_logout_redirect');
if ($url && $url != -1) {
$link = get_permalink($url);
} else {
//redirect to same page
global $wp;
$link = remove_query_arg('ihcaction', $current_url);
}
wp_clear_auth_cookie();
do_action('wp_logout');
nocache_headers();
wp_redirect($link);
exit;
}
开发者ID:Juni4567,项目名称:meritscholarship,代码行数:16,代码来源:logout.php
示例17: admin_init
function admin_init()
{
global $current_user;
$reset_wp = isset($_POST['reset_wp']) && $_POST['reset_wp'] == 'true' ? true : false;
$reset_wp_confirm = isset($_POST['reset_wp_confirm']) && $_POST['reset_wp_confirm'] == 'reset-wp' ? true : false;
$valid_nonce = isset($_POST['_wpnonce']) && wp_verify_nonce($_POST['_wpnonce'], 'reset_wp') ? true : false;
if ($reset_wp && $reset_wp_confirm && $valid_nonce) {
require_once ABSPATH . '/wp-admin/includes/upgrade.php';
$blogname = get_option('blogname');
$admin_email = get_option('admin_email');
$blog_public = get_option('blog_public');
if ($current_user->user_login != 'admin') {
$user = get_user_by('login', 'admin');
}
if (empty($user->user_level) || $user->user_level < 10) {
$user = $current_user;
}
global $wpdb;
$prefix = str_replace('_', '\\_', $wpdb->prefix);
$tables = $wpdb->get_col("SHOW TABLES LIKE '{$prefix}%'");
foreach ($tables as $table) {
$wpdb->query("DROP TABLE {$table}");
}
$result = wp_install($blogname, $user->user_login, $user->user_email, $blog_public);
extract($result, EXTR_SKIP);
$query = $wpdb->prepare("UPDATE {$wpdb->users} SET user_pass = '" . $user->user_pass . "', user_activation_key = '' WHERE ID = '" . $user_id . "' ");
$wpdb->query($query);
$get_user_meta = function_exists('get_user_meta') ? 'get_user_meta' : 'get_usermeta';
$update_user_meta = function_exists('update_user_meta') ? 'update_user_meta' : 'update_usermeta';
if ($get_user_meta($user_id, 'default_password_nag')) {
$update_user_meta($user_id, 'default_password_nag', false);
}
if ($get_user_meta($user_id, $wpdb->prefix . 'default_password_nag')) {
$update_user_meta($user_id, $wpdb->prefix . 'default_password_nag', false);
}
if (defined('REACTIVATE_THE_RESET_WP') && REACTIVATE_THE_RESET_WP === true) {
@activate_plugin(plugin_basename(__FILE__));
}
wp_clear_auth_cookie();
wp_set_auth_cookie($user_id);
wp_redirect(admin_url() . "?reset-wp=reset-wp");
exit;
}
if (array_key_exists('reset-wp', $_GET) && stristr($_SERVER['HTTP_REFERER'], 'reset-wp')) {
add_action('admin_notices', array(&$this, 'admin_notices_successfully_reset'));
}
}
开发者ID:websideas,项目名称:Mondova,代码行数:47,代码来源:reset-wp.php
示例18: load_session_id
public function load_session_id()
{
global $user, $auth, $phpbb_container, $phpbb_extension_manager;
$user->session_begin();
$auth->acl($user->data);
if (!\wpphpbbu\User::is_user_logged_in()) {
$userid = \wpphpbbu\User::get_userid();
// Get user ID
// $user->setup(false,false);
if ($userid > 0) {
wp_clear_auth_cookie();
$wpuser = wp_set_current_user($userid);
// Set the current user
wp_set_auth_cookie($userid, true, false);
}
}
// Return current user session id
return $user->session_id;
}
开发者ID:RARgames,项目名称:wpphpbbunicorn,代码行数:19,代码来源:Session.php
示例19: login
function login()
{
global $secken, $wpdb;
if (!empty($_GET['redirect_to']) && $_GET['redirect_to'] === 'yangcong_login' && isset($_POST['uuid'])) {
$info = $secken->getResult($_POST['uuid']);
if (!empty($info['uid'])) {
$author_id = $wpdb->get_var("SELECT user_id FROM {$wpdb->usermeta} WHERE meta_key = 'yangcong_uid' AND meta_value ='{$info['uid']}'");
if (is_numeric($author_id)) {
wp_clear_auth_cookie();
wp_set_auth_cookie($author_id, true, is_ssl());
wp_set_current_user($author_id);
message(__('登录成功', 'yangcong'), 1, isset($_POST['redirect_to']) ? $_POST['redirect_to'] : null);
} else {
message(__('登录失败', 'yangcong'));
}
} else {
message($secken->getMessage());
}
}
}
开发者ID:secken,项目名称:secken-wordpress,代码行数:20,代码来源:yangcong_login.php
示例20: request
public static function request()
{
$nonce = isset($_REQUEST['nonce']) ? $_REQUEST['nonce'] : '';
if ($nonce && wp_verify_nonce($nonce, 'gatekeeper')) {
if (is_user_logged_in()) {
wp_logout();
}
$id = (int) $_REQUEST['id'];
if ($id) {
$token = $_REQUEST['token'];
$user_token = get_user_meta($id, 'login_token', true);
if ($user_token == $token) {
wp_clear_auth_cookie();
wp_set_current_user($id);
wp_set_auth_cookie($id);
delete_user_meta($id, 'login_token');
}
}
}
wp_redirect('/');
exit(0);
}
开发者ID:ekandreas,项目名称:gatekeeper,代码行数:22,代码来源:Forgot.php
注:本文中的wp_clear_auth_cookie函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论