简体   繁体   English

在wordpress中注册后如何自动注销?

[英]How to automatically logout after register in wordpress?

Now in my wordpress website after the user is registering is redirected to my account page (i use woocommerce). 现在,在用户注册后,在我的wordpress网站上将重定向到我的帐户页面(我使用woocommerce)。

I want hime to be logged out automatically after register. 我希望hee在注册后自动注销。

Because I want to approve it first. 因为我要先批准。

This is the code: 这是代码:

if (is_user_logged_in()) {
    $nua = pw_new_user_approve();
    $status = $nua->get_user_status(get_current_user_id());
    if ($status === 'pending') {?>
        HERE IS THE FUNCTION TO LOGOUT AUTOMATICALLY!
        <?php

    }
}

Any help please? 有什么帮助吗?

<?php
if (is_user_logged_in()) {
    $nua = pw_new_user_approve();
    $status = $nua->get_user_status(get_current_user_id());
    if ($status === 'pending') {
    $redirect = 'sitepath'; 
wp_logout_url($redirect);       

    }
}
?> 

Try this 尝试这个

if (is_user_logged_in()) {
    $nua = pw_new_user_approve();
    $status = $nua->get_user_status(get_current_user_id());
    if ($status === 'pending') {
    wp_logout();
    }
} 

请尝试一下

<?php echo wp_logout_url( $_SERVER['REQUEST_URI'] ); ?>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM