如何使註冊無需郵箱?

  • 該話題包含 3 個回覆,2 人參與,最後由詩語 更新於 4 年前
正在檢視 4 個帖子:1-4 (共 4 個帖子)
  • 作者
    帖子
  • alt
    參與者
    • 文章數量: 2
    @alt
    樓主

    我在網上找的程式碼可以隱藏郵箱輸入框,但不能取消沒填寫郵箱的錯誤,怎麼隱藏這個錯誤?

    提前感謝回覆

    詩語
    管理員
    • 文章數量: 5,933
    @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,933
    @feibisi

    看上去是一樣,只是不用輸入郵箱就可以註冊成功,新增位置沒錯。

正在檢視 4 個帖子:1-4 (共 4 個帖子)
  • 哎呀,回覆話題必需登入。

話題資訊

  • 當前位於:bbPress
  • 3 條回覆
  • 2 個參與人
  • 最後回覆:<a href="https://bbs.weixiaoduo.com/users/feibisi/" title=" 檢視詩語的個人資料" class="bbp-author-link"><span class="bbp-author-name"> 詩語</span></a>
  • 上次活動:<a href="https://bbs.weixiaoduo.com/topic/38730/#post-38749" title=" 回覆至:如何使註冊無需郵箱?">4 年前</a>