无需确认即可注册用户

时间:2015-05-26 作者:Ariel

我希望注册用户时不需要确认他们的电子邮件(更好的是,注册时不需要密码)。基本上,我希望他们使用wp注册过程订阅邮件,然后重定向到我选择的页面。

我知道我可以用CF7、时事通讯插件或其他什么东西来完成,但我实际上需要使用默认注册过程,因为它连接到另一个使用它的插件,UX流程如下:

user enter mails --> user gets redirected to thank you page with a ref code (provided by plugin). 
就这么简单,但我找不到答案,于是我找了几个小时。

非常感谢您的帮助!

2 个回复
SO网友:Touqeer Shafi

有一个函数叫做wp_new_user_notification() 它是可插入的,您可以更改它以停止用户注册电子邮件:

if ( ! function_exists( \'wp_new_user_notification\' ) ) {
    function wp_new_user_notification( $user_id, $plaintext_pass = \'\' ) {
        return false; // because we don\'t need to send email.
    }
}

SO网友:ALexander Lead

您可以使用不同的插件注册用户。例如,插件用户注册https://wordpress.org/plugins/user-registration/ 不需要任何电子邮件确认。

如果您想自己编写插件,有一个函数wp\\u create\\u user()-https://developer.wordpress.org/reference/functions/wp_create_user/ - 它将帮助您在DB中创建一个具有登录名、密码和电子邮件的用户。您可以添加注册规则。另一个函数register\\u new\\u user()-https://developer.wordpress.org/reference/functions/register_new_user/ - 将在系统中生成密码。

结束

相关推荐