如何使注册无需邮箱?

如何使注册无需邮箱?


正在查看 4 个帖子:1-4 (共 4 个帖子)
  • 作者
    帖子
  • alt
    参与者
    • 文章数量: 2
    @alt
    楼主

    我在网上找的代码可以隐藏邮箱输入框,但不能取消没填写邮箱的错误,怎么隐藏这个错误?

    提前感谢回复

    诗语
    管理员
    • 文章数量: 5,865
    @feibisi

    你可以尝试使用下面的代码,简单讲就是 JS 实现注册无需邮件地址验证。

    add_action('user_profile_update_errors', 'my_user_profile_update_errors', 10, 3);
    function my_user_profile_update_errors($errors, $update, $user) {
        $errors->remove('empty_email');
    }
    
    add_action('user_new_form', 'my_user_new_form', 10, 1);
    add_action('show_user_profile', 'my_user_new_form', 10, 1);
    add_action('edit_user_profile', 'my_user_new_form', 10, 1);
    function my_user_new_form($form_type) {
        ?>
        <script type="text/javascript">
        jQuery('#email').closest('tr').removeClass('form-required').find('.description').remove();
    
        <?php if (isset($form_type) && $form_type === 'add-new-user') : ?>
            jQuery ('#send_user_notification') .removeAttr('checked');
        <?php endif; ?>
        </script>
        <?php
    }
    alt
    参与者
    • 文章数量: 2
    @alt
    楼主

    是放到functions.php里吗?我看上去和之前一样啊

    诗语
    管理员
    • 文章数量: 5,865
    @feibisi

    看上去是一样,只是不用输入邮箱就可以注册成功,添加位置没错。

正在查看 4 个帖子:1-4 (共 4 个帖子)
  • 哎呀,回复话题必需登录。

未找到对应子版块?请直接在 [疑难杂症] 版块中发帖提问。

收藏纪念品


有奖活动

参与论坛社区问答,有机会获赠文派瓦普(Wapuu.com)手办模型。

产品博客


RSS 错误: http://blog.weixiaoduo.com/feed is invalid XML, likely due to invalid characters. XML error: Invalid document end at line 2, column 1

话题信息

商业系统