dsvd407787736 2017-01-06 10:57
浏览 24

在wordpress中将新用户状态添加为7或5

I am trying to add a new user status in Wordpress. Right now we have two types of user status in Wordpress database 0 or 1. I need a new user status as 7. While user login through wp-login.php page if the user is registered and user_status in database is 7. Need to alert a message stating as "Account Pending. Please validate your email address by clicking on the link sent to your email".

And for remaining users should be able to login.

Here is the code which I am using in theme functions.php file :

<?php

add_filter('wp_authenticate_user', 'myplugin_auth_login',10,1);
        function myplugin_auth_login ($user) {

            $userstatus=$user->user_status;

            if($userstatus=='7')
            {

            return wp_redirect(get_site_url().'/wp-login.php?action=pending');

            }else{
                return home_url();
            }
        }

?>

Another issue in this code is user with status as 0 are not able to login even after entering right username and password. In my current site we are using Buddypress and BP registration options plugin.

please kindly suggest.

Thanks & Regards,

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
    • ¥15 Vue3地图和异步函数使用
    • ¥15 C++ yoloV5改写遇到的问题
    • ¥20 win11修改中文用户名路径
    • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
    • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
    • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
    • ¥15 帮我写一个c++工程
    • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
    • ¥15 关于smbclient 库的使用