诗语,你好,wordpress 用户注册激活邮件的链接尾部有奇怪的字符,导致无法激活用户

  • 该话题包含 3 个回复,2 人参与,最后由诗语 更新于 5 年前
正在查看 4 个帖子:1-4 (共 4 个帖子)
  • 作者
    帖子
  • talklaw
    参与者
    • 文章数量: 189
    @talklaw
    楼主

    用户注册 wordpress 后,系统会发邮件确认,用户收到邮件后,显示的激活链接如下:

    ZV9VDarKetU7Y5oeG&login=yueliang>

    而实际上点击的链接如下

    ZV9VDarKetU7Y5oeG&login=yueliang&gt

    无论是显示的链接还是实际链接,在用户名 (yueliang) 后都多一些字符,导致用户激活失败,请问这种情况如何处理啊?

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

    那你需要编辑 WordPress 的默认电子邮件模板格式,然后删掉括号。

    < 和 >

    就是符合 < 和 >

     

    talklaw
    参与者
    • 文章数量: 189
    @talklaw
    楼主

    请问在哪里编辑电子邮件模板啊?

     

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

    使用 wp_new_user_notification() 功能发送新的用户电子邮件。你需要修改然后覆盖该函数:

    // Redefine user notification function
    if ( !function_exists('wp_new_user_notification') ) {
        function wp_new_user_notification( $user_id, $plaintext_pass = '' ) {
            $user = new WP_User($user_id);
    
            $user_login = stripslashes($user->user_login);
            $user_email = stripslashes($user->user_email);
    
            $message  = sprintf(__('New user registration on your blog %s:'), get_option('blogname')) . "\r\n\r\n";
            $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";
            $message .= sprintf(__('E-mail: %s'), $user_email) . "\r\n";
    
            @wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), get_option('blogname')), $message);
    
            if ( empty($plaintext_pass) )
                return;
    
            $message  = __('Hi there,') . "\r\n\r\n";
            $message .= sprintf(__("Welcome to %s! Here's how to log in:"), get_option('blogname')) . "\r\n\r\n";
            $message .= wp_login_url() . "\r\n";
            $message .= sprintf(__('Username: %s'), $user_login) . "\r\n";
            $message .= sprintf(__('Password: %s'), $plaintext_pass) . "\r\n\r\n";
            $message .= sprintf(__('If you have any problems, please contact me at %s.'), get_option('admin_email')) . "\r\n\r\n";
            $message .= __('Adios!');
    
            wp_mail($user_email, sprintf(__('[%s] Your username and password'), get_option('blogname')), $message);
    
        }
    }
正在查看 4 个帖子:1-4 (共 4 个帖子)
  • 哎呀,回复话题必需登录。

话题信息

  • 当前位于:疑难杂症
  • 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/35341/#post-35356" title=" 回复至:诗语,你好,wordpress 用户注册激活邮件的链接尾部有奇怪的字符,导致无法激活用户">5 年前</a>