【问题标题】:Wordpress buddypress 2.6.1.1 activation email message amendwordpress buddypress 2.6.1.1 激活邮件修改
【发布时间】:2016-12-11 23:50:11
【问题描述】:

我正在尝试更改上述用户激活电子邮件。 搜索并阅读了很多似乎与新版本无关的链接。

我遇到的问题是,对于某些用户,激活链接无法正常工作,并要求他们在被引导到的页面上输入激活密钥。

我目前的修复(如果我可以让它工作,我会更改修复以挂钩相关操作)涉及更改“bp-core-functions.php”文件,修改消息以包含对实际的密钥,用户可以根据需要复制和粘贴。

 'core-user-registration' => array(
        /* translators: do not remove {} brackets or translate its contents. */
        'post_title'   => __( '[{{{site.name}}}] Activate your account', 'buddypress' ),
        /* translators: do not remove {} brackets or translate its contents. */
        'post_content' => __( "Thanks for registering!\n\nTo complete the activation of your account, go to the following link: <a href=\"{{{activate.url}}}\">{{{activate.url}}}</a>. Or enter the following key if prompted: {{{key}}}", 'buddypress' ),
        /* translators: do not remove {} brackets or translate its contents. */
        'post_excerpt' => __( "Thanks for registering!\n\nTo complete the activation of your account, go to the following link: {{{activate.url}}}.  Or enter the following key if prompted: {{{key}}}", 'buddypress' ),
    ),

我还在 .pot 文件中更改了相同的消息...只是因为这些消息也位于它们的...只是为了尝试使此更改生效。

它不工作。有人知道如何更改发送给用户的激活相关消息吗?

谢谢 肖恩

【问题讨论】:

    标签: wordpress email buddypress activation


    【解决方案1】:

    试试这个代码。

        //  Get the slug of the activation page
        $slug = $bp->pages->{"activate"}->slug;
    
        //  Get username from the signup form just posted
        $username = $bp->signup->username;
    
        //  SQL query to get activation key for that username
        $sql = 'select meta_value from wp_usermeta where meta_key="activation_key" and user_id in (select ID from wp_users where user_login="' . $username . '" and user_status=2)';
    
        //  Getting the activation key from the database
        $activation_key = $wpdb->get_var($sql);
    
    
    
        //  Custom message with activation key
        $message = "Yayy! Thanks for signing up! Please confirm your account!\n\n$activation_key";
    
        return $message;
    }
    ?>
    

    将其粘贴到插件文件夹中的 bp-custom.php 中

    【讨论】:

    • 您好,感谢您的回复...您只提供了一些页面代码...您能更具体一点吗?例如...底部的代码是哪种方法,...我会研究 bp-custom 文件的使用,谢谢。
    • 我遇到了同样的问题。我卸载了 Yoast seo,一切都重新开始工作。有buddypress fillter add_filter('bp_core_signup_send_validation_email_message', 'custom_bp_change_activation_email_message');function custom_bp_change_activation_email_message($message) { // 获取一些全局变量 global $bp, $wpdb;
    猜你喜欢
    • 1970-01-01
    • 2014-02-10
    • 2018-03-26
    • 2016-06-01
    • 2013-02-07
    • 2013-01-31
    • 2017-12-07
    • 2017-09-24
    • 2019-07-04
    相关资源
    最近更新 更多