Wordpress buddypress 2.6.1.1激活电子邮件修改

时间:2016-08-05 14:10:22

标签: wordpress email buddypress activation

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

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

我目前的解决方法(如果我可以使其正常工作,将错误的修改更改为挂钩到相关操作中)则需要更改'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文件中的相同消息....只是因为消息也位于他们的内...只是为了尝试让这个改变开始。

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

感谢 肖恩

1 个答案:

答案 0 :(得分:0)

试试这段代码  

    //  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中