• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP wp_logout函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中wp_logout函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_logout函数的具体用法?PHP wp_logout怎么用?PHP wp_logout使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了wp_logout函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: process

 /**
  *	Process the request
  *	@todo Setting for reassigning user's posts
  */
 public function process()
 {
     // Verify the security nonce and die if it fails
     if (!isset($_POST['wp_delete_user_accounts_nonce']) || !wp_verify_nonce($_POST['wp_delete_user_accounts_nonce'], 'wp_delete_user_accounts_nonce')) {
         wp_send_json(array('status' => 'fail', 'title' => __('Error!', 'wp-delete-user-accounts'), 'message' => __('Request failed security check.', 'wp-delete-user-accounts')));
     }
     // Don't permit admins to delete their own accounts
     if (current_user_can('manage_options')) {
         wp_send_json(array('status' => 'fail', 'title' => __('Error!', 'wp-delete-user-accounts'), 'message' => __('Administrators cannot delete their own accounts.', 'wp-delete-user-accounts')));
     }
     // Get the current user
     $user_id = get_current_user_id();
     // Get user meta
     $meta = get_user_meta($user_id);
     // Delete user's meta
     foreach ($meta as $key => $val) {
         delete_user_meta($user_id, $key);
     }
     // Destroy user's session
     wp_logout();
     // Delete the user's account
     $deleted = wp_delete_user($user_id);
     if ($deleted) {
         // Send success message
         wp_send_json(array('status' => 'success', 'title' => __('Success!', 'wp-delete-user-accounts'), 'message' => __('Your account was successfully deleted. Fair well.', 'wp-delete-user-accounts')));
     } else {
         wp_send_json(array('status' => 'fail', 'title' => __('Error!', 'wp-delete-user-accounts'), 'message' => __('Request failed.', 'wp-delete-user-accounts')));
     }
 }
开发者ID:EngageWP,项目名称:wp-delete-user-accounts,代码行数:33,代码来源:process-ajax.php


示例2: process_withdrawal

 public static function process_withdrawal()
 {
     $action = wskl_POST('action');
     if ($action != 'dabory_members_withdrawal') {
         return;
     }
     self::evaluate_and_redirect_if_failed(is_user_logged_in(), __('먼저 로그인 하세요', 'wskl'));
     self::evaluate_and_redirect_if_failed(wp_verify_nonce($_POST['dabory_members_withdrawal'], 'dabory_members_withdrawal'), __('Nonce 인증에 실패했습니다.', 'wskl'));
     $user = wp_get_current_user();
     $password = wskl_POST('password');
     $reason = wskl_POST('reason', 'sanitize_text_field');
     self::evaluate_and_redirect_if_failed(wp_check_password($password, $user->user_pass, $user->ID), __('비밀번호가 일치하지 않습니다.', 'wskl'));
     if (wskl_is_option_enabled('members_delete_after_withdrawal')) {
         if (!function_exists('wp_delete_user')) {
             include_once ABSPATH . 'wp-admin/includes/user.php';
         }
         // 멤버 정말로 삭제
         wp_logout();
         wp_delete_user($user->ID);
     } else {
         // 역할을 바꿔 탈퇴 회원으로 간주
         update_user_meta($user->ID, 'withdrawal_reason', $reason);
         $user->set_role('wskl_withdrawn');
         wp_logout();
     }
     // 탈퇴 완료 메시지
     wp_redirect(add_query_arg(array('status' => 'complete'), $_SERVER['REQUEST_URI']));
     exit;
 }
开发者ID:EricKim65,项目名称:woosym-korean-localization,代码行数:29,代码来源:class-wskl-dabory-members-withdrawal.php


示例3: uf_perform_logout

/**
 * Loads the current user out
 *
 * @wp-hook	uf_logout
 * @return	void
 */
function uf_perform_logout()
{
    wp_logout();
    $url_after_logout = apply_filters('uf_perform_logout_url', '/user-login/?message=loggedout');
    wp_safe_redirect(home_url($url_after_logout));
    exit;
}
开发者ID:WordImpress,项目名称:User-Frontend,代码行数:13,代码来源:action-logout.php


示例4: userLogout

 function userLogout()
 {
     $this->verifyNonce('userLogout');
     wp_logout();
     echo "true";
     wp_die();
 }
开发者ID:eralha,项目名称:wp_angular_base,代码行数:7,代码来源:ajax__calls.php


示例5: um_submit_form_errors_hook_logincheck

function um_submit_form_errors_hook_logincheck($args)
{
    global $ultimatemember;
    // Logout if logged in
    if (is_user_logged_in()) {
        wp_logout();
    }
    $user_id = isset($ultimatemember->login->auth_id) ? $ultimatemember->login->auth_id : '';
    um_fetch_user($user_id);
    $status = um_user('account_status');
    // account status
    switch ($status) {
        // If user can't login to site...
        case 'inactive':
        case 'awaiting_admin_review':
        case 'awaiting_email_confirmation':
        case 'rejected':
            um_reset_user();
            exit(wp_redirect(add_query_arg('err', esc_attr($status), $ultimatemember->permalinks->get_current_url())));
            break;
    }
    if (isset($args['form_id']) && $args['form_id'] == $ultimatemember->shortcodes->core_login_form() && $ultimatemember->form->errors && !isset($_POST[$ultimatemember->honeypot])) {
        exit(wp_redirect(um_get_core_page('login')));
    }
}
开发者ID:lytranuit,项目名称:wordpress,代码行数:25,代码来源:um-actions-login.php


示例6: site_router

function site_router()
{
    // Premmière chose : Detection et gestion de l'URL
    $root = str_replace('index.php', '', $_SERVER['SCRIPT_NAME']);
    $url = str_replace($_SERVER['SCRIPT_NAME'], '', $_SERVER['REQUEST_URI']);
    $url = explode('/', $url);
    if (count($url) == 2 && $url[1] == 'login') {
        require 'tpl-login.php';
        die;
    } else {
        if (count($url) == 2 && $url[1] == 'profil') {
            require 'tpl-profil.php';
            die;
        } else {
            if (count($url) == 2 && $url[1] == 'logout') {
                wp_logout();
                header('location:' . $root);
                die;
            } else {
                if (count($url) == 2 && $url[1] == 'register') {
                    require 'tpl-register.php';
                    die;
                } else {
                    if (count($url) == 2 && preg_match("#confirmation#", $url[1])) {
                        require 'tpl-confirmation.php';
                        die;
                    }
                }
            }
        }
    }
}
开发者ID:arthurDNN,项目名称:fondation-manpower,代码行数:32,代码来源:functions.php


示例7: control_login

function control_login($user_login, $user)
{
    if (!in_array('administrator', (array) $user->roles)) {
        //log them out
        wp_logout();
    }
}
开发者ID:CodeForAfrica,项目名称:CitizenReporter.WP.Plugin,代码行数:7,代码来源:control_login.php


示例8: logout

function logout()
{
    wp_logout();
    //TODO: reload actual page
    wp_redirect(home_url());
    exit;
}
开发者ID:patocorrenti,项目名称:educativa_cursos,代码行数:7,代码来源:login_functions.php


示例9: wpu_integrate_login

/**
 * The main login integration routine
 */
function wpu_integrate_login()
{
    global $wpUnited, $phpbbForum, $wpuDebug;
    // cache and prevent recursion
    static $result = -1;
    static $doingLogin = false;
    if (!$doingLogin) {
        // sometimes this gets called early, e.g. for admin ajax calls.
        if (!$wpUnited->is_working()) {
            return;
        }
        $wpuDebug->add('User integration active.');
        $doingLogin = true;
        // If this is a logout request, just do that!
        if ($wpUnited->should_do_action('logout')) {
            wp_logout();
            wp_set_current_user(0);
            $wpuDebug->add('Logged out of WordPress');
            return;
        }
        if (!$phpbbForum->user_logged_in()) {
            $result = wpu_int_phpbb_logged_out();
        } else {
            $result = wpu_int_phpbb_logged_in();
        }
        $doingLogin = false;
    }
    return $result;
}
开发者ID:snitchashor,项目名称:wp-united,代码行数:32,代码来源:user-integrator.php


示例10: check_exists_token

 /**
  * @return void
  */
 public function check_exists_token()
 {
     $user = wp_get_current_user();
     if (!$user->ID) {
         wp_logout();
         return false;
     }
     $token = '';
     $pod = pods('jwt_user_token');
     if ($pod) {
         $record = $pod->find(null, 1, "author.ID = {$user->ID}");
         $data = $record->fetch();
         if ($data) {
             $token = isset($data['token']) ? $data['token'] : '';
         } else {
             $data = self::get_jwt_token($user);
             $token = isset($data['token']) ? $data['token'] : '';
         }
     }
     $current_token = isset($_COOKIE['dln_token']) ? $_COOKIE['dln_token'] : '';
     if (!$current_token || $current_token != $token) {
         self::setToken($token);
     }
     return true;
 }
开发者ID:ltdat287,项目名称:id.nhomdichvu,代码行数:28,代码来源:class-jwt-auth.php


示例11: ngpress_ajax_logout

function ngpress_ajax_logout()
{
    check_ajax_referer('ngpress-ajax-logout-nonce', 'logout_security');
    wp_logout();
    echo json_encode(array('loggedout' => true, 'message' => __('User logged out')));
    die;
}
开发者ID:jaredrethman,项目名称:ngpress,代码行数:7,代码来源:login-register.php


示例12: maybe_log_out

 /**
  * Kicks the user out if their cookies aren't up to date
  */
 public function maybe_log_out()
 {
     if (is_user_logged_in() && (!isset($_COOKIE[self::VERSION_COOKIE]) || self::COOKIE_VERSION != $_COOKIE[self::VERSION_COOKIE])) {
         // The user needs different cookies set, but we need them to log back in to get the values
         wp_logout();
     }
 }
开发者ID:Blueprint-Marketing,项目名称:cache-buddy,代码行数:10,代码来源:plugin.php


示例13: do_logout

 public function do_logout()
 {
     // If we are logged-in and we really are on this page, simply redirect
     if (is_user_logged_in() && get_queried_object_id() == $this->get_page_id()) {
         wp_logout();
         $logout_url = apply_filters('cuar/routing/logout-url', null, 'customer-dashboard', null);
         wp_redirect($logout_url);
     }
 }
开发者ID:joasssko,项目名称:schk,代码行数:9,代码来源:customer-logout-addon.class.php


示例14: demo

 function demo()
 {
     if (isset($_GET['demo']) && $_GET['demo'] == 'true') {
         if (userpro_is_logged_in()) {
             wp_logout();
         }
         userpro_auto_login('test', true);
     }
 }
开发者ID:fritzdenim,项目名称:pangMoves,代码行数:9,代码来源:api.php


示例15: test_nopriv_no_postid

 /**
  * Test as a logged out user with no post id
  * @return void
  */
 public function test_nopriv_no_postid()
 {
     // Log out
     wp_logout();
     // Set up a request
     $_POST = array('autosave' => 1);
     // Make the request
     $this->setExpectedException('WPAjaxDieStopException', '-1');
     $this->_handleAjax('nopriv_autosave');
 }
开发者ID:rmccue,项目名称:wordpress-unit-tests,代码行数:14,代码来源:Autosave.php


示例16: maybe_logout_user

 /**
  * If jetpack_force_logout == 1 in current user meta the user will be forced
  * to logout and reauthenticate with the site.
  **/
 public function maybe_logout_user()
 {
     global $current_user;
     if (1 == $current_user->jetpack_force_logout) {
         delete_user_meta($current_user->ID, 'jetpack_force_logout');
         self::delete_connection_for_user($current_user->ID);
         wp_logout();
         wp_safe_redirect(wp_login_url());
     }
 }
开发者ID:lokenxo,项目名称:familygenerator,代码行数:14,代码来源:sso.php


示例17: ie_api_logout

/**
 * Logout for internet·engineering users
 */
function ie_api_logout()
{
    // unset custom user cookie
    setcookie('ie_account', '', strtotime('-30 days'), '/', str_replace('https://', '', get_bloginfo('url')));
    // logout wp
    wp_logout();
    // return something
    $data['redirect'] = site_url();
    $data['logout'] = true;
    return $data;
}
开发者ID:corenominal,项目名称:internet.engineering-wp-api,代码行数:14,代码来源:logout.php


示例18: um_change_password_process_hook

function um_change_password_process_hook($args)
{
    global $ultimatemember;
    wp_set_password($args['user_password'], $args['user_id']);
    delete_user_meta($args['user_id'], 'reset_pass_hash');
    delete_user_meta($args['user_id'], 'reset_pass_hash_token');
    do_action('um_after_changing_user_password', $args['user_id']);
    if (is_user_logged_in()) {
        wp_logout();
    }
    exit(wp_redirect(um_get_core_page('login', 'password_changed')));
}
开发者ID:Ksajikyan,项目名称:poiskuslug,代码行数:12,代码来源:um-actions-password.php


示例19: tja_logout

function tja_logout()
{
    if ($_GET['action'] == 'logout') {
        //lagout of facebook if the plugin is activated and the user is a facebook user
        if (function_exists('fbc_get_fbconnect_user') && fbc_get_fbconnect_user()) {
            fbc_footer_register('FBConnect.logout();');
        } else {
            wp_logout();
            wp_redirect(remove_query_arg('action', $_SERVER['REQUEST_URI']));
        }
    }
}
开发者ID:adamcarlile,项目名称:Alex-Goy,代码行数:12,代码来源:tj-accounts.template-redirect.php


示例20: commsy_auth

function commsy_auth()
{
    global $commsy_auth_commsy_url;
    if (isset($_GET['commsy_session_id'])) {
        // try to authenticate via session
        try {
            if ($GLOBALS['blog_id'] > 1) {
                $options = array();
                if (defined('WP_PROXY_HOST')) {
                    $options['proxy_host'] = WP_PROXY_HOST;
                }
                if (defined('WP_PROXY_PORT')) {
                    $options['proxy_port'] = WP_PROXY_PORT;
                }
                $soapClient = new SoapClient($commsy_auth_commsy_url . '/soap_wsdl.php', $options);
                $user = $soapClient->wordpressAuthenticateViaSession($_GET['commsy_session_id']);
                if (isset($user['login'])) {
                    #$addUserToBlog = (false == get_user_by('login', $user['login']));
                    $user_id = cs_update_user($user);
                    // $blogId ??? (15.11.2010 IJ)
                    $blogId = $GLOBALS['blog_id'];
                    // (12.05.2011 js)
                    $blogusers = get_users(array('blog_id' => $blogId));
                    $addUserToBlog = true;
                    foreach ($blogusers as $bloguser) {
                        if ($bloguser->ID == $user_id) {
                            $addUserToBlog = false;
                        }
                    }
                    if ($addUserToBlog) {
                        add_user_to_blog($blogId, $user_id, get_option('default_role'));
                    }
                }
                if ($user_id) {
                    if (is_user_logged_in()) {
                        wp_logout();
                    }
                    add_filter('authenticate', 'cs_authenticate_hashed', 99, 3);
                    $result = wp_signon(array('user_login' => $user['login'], 'user_password' => $user['password']));
                    if (!is_wp_error($result)) {
                        add_action('get_header', 'commsy_clean_permalink', 0);
                    }
                    remove_filter('authenticate', 'cs_authenticate_hashed');
                    //wp_login();
                }
            }
        } catch (Exception $e) {
            echo $e->getMessage();
            // session not valid, do nothing
        }
    }
}
开发者ID:a2call,项目名称:commsy,代码行数:52,代码来源:commsy_auth.php



注:本文中的wp_logout函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP wp_logout_url函数代码示例发布时间:2022-05-23
下一篇:
PHP wp_loginout函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap