[wordpress插件] AsynCRONous bbPress Subscriptions异步bbPress订阅

wordpress 插件 文章 2020-02-22 11:50 556 0 全屏看文

AI助手支持GPT4.0

评分
100
描述

Per default, bbPress is sending subscription notification emails as one email with a bunch of BCCs.

默认情况下,bbPress将订阅通知电子邮件作为一封带有一堆密件抄送的电子邮件发送。

There are various reasons why it would make more sense to send individual emails.

有多种原因使发送个人电子邮件更有意义。

This plugin does that, quietly in the background via WP cron, without slowing down page load times.

该插件通过WP cron在后台安静地执行此操作,而不会减慢页面加载时间。

Also increases notification performance and reduces database load on large sites.

还可以提高通知性能并减少大型站点上的数据库负载。

Translations by @mauriciogarofalo and @mechter

@mauriciogarofalo和@mechter的翻译

Defaults

默认值

If you don’t customize this plugin, this is what you’ll get:

如果您不自定义此插件,将获得以下信息:

    • Sends mails from "MyBlog " (with your Blog’s name and admin email)
    • “ MyBlog 发送邮件(带有您博客的名称和管理员电子邮件)

    • Sends mail to "Markus " (with the name being the user’s display name on the forums, not their username)
    • 将邮件发送到“ Markus (名称是用户在论坛上的显示名称,而不是用户名)

    • Subject and Message have more user friendly defaults, use the available filters (see below) to make them your own.
    • 主题和消息具有更多的用户友好默认值,请使用可用的过滤器(如下所示)将其设置为您自己的。

    Customization

    自定义

    You can install and activate this plugin and it just works, but you have full control over the details if you want to.

    您可以安装并激活此插件,并且该插件可以运行,但是如果需要,您可以完全控制其详细信息。

    Below are some filters and code snippets that help you do what you want.

    以下是一些过滤器和代码段,可帮助您完成所需的工作。

    If you’re new to working directly with code, please see the example at the bottom of this page.

    如果您不熟悉直接使用代码,请参阅此页面底部的示例。

    Available filters

    可用的过滤器

    bbp_subscription_email_from( $from ) // $from can be a string or array('name'=>string, 'address'=>string)

      bbp_subscription_email_from($ from)// $ from可以是字符串或数组('name'=> string,'address'=> string)

    bbp_subscription_email_recipients( $recipients ) // $recipients is array of array('name'=>string, 'address'=>string)

    bbp_subscription_email_recipients($ recipients)// $ recipients是由array('name'=> string,'address'=> string)组成的数组

    bbp_subscription_email_headers( $headers )

    bbp_subscription_email_headers($ headers)

    bbp_forum_subscription_email_subject( $subject, $forum_id, $topic_id )

    bbp_forum_subscription_email_subject($ subject,$ forum_id,$ topic_id)

    bbp_forum_subscription_email_message( $message, $forum_id, $topic_id )

    bbp_forum_subscription_email_message($ message,$ forum_id,$ topic_id)

    bbp_topic_subscription_email_subject( $subject, $forum_id, $topic_id, $reply_id )

    bbp_topic_subscription_email_subject($ subject,$ forum_id,$ topic_id,$ reply_id)

    bbp_topic_subscription_email_message( $message, $forum_id, $topic_id, $reply_id )

    bbp_topic_subscription_email_message($ message,$ forum_id,$ topic_id,$ reply_id)

    bbp_bounce_address( $bounce_address )

    bbp_bounce_address($ bounce_address)

    bbp_subscription_disable_async( false )

    bbp_subscription_disable_async(false)

    bbp_forum_subscription_disable_async( false )

    bbp_forum_subscription_disable_async(false)

    bbp_topic_subscription_disable_async( false )

    bbp_topic_subscription_disable_async(false)

    Helpful Snippets

    有用的代码段

    Here are some pointers to get the data you might want in your notifications:

    这里有一些指针来获取您可能需要的通知数据:

    $blog_name = get_bloginfo( 'name' );

      $ blog_name = get_bloginfo('name');

    $forum_title = bbp_get_forum_title( $forum_id );

    $ forum_title = bbp_get_forum_title($ forum_id);

    $topic_author_user_id = bbp_get_topic_author_id( $topic_id );

    $ topic_author_user_id = bbp_get_topic_author_id($ topic_id);

    $topic_author_display_name = bbp_get_topic_author_display_name( $topic_id );

    $ topic_author_display_name = bbp_get_topic_author_display_name($ topic_id);

    $topic_title = wp_specialchars_decode( strip_tags( bbp_get_topic_title( $topic_id ) ), ENT_QUOTES );

    $ topic_title = wp_specialchars_decode(strip_tags(bbp_get_topic_title($ topic_id)),ENT_QUOTES);

    $topic_content = wp_specialchars_decode( strip_tags( bbp_get_topic_content( $topic_id ) ), ENT_QUOTES );

    $ topic_content = wp_specialchars_decode(strip_tags(bbp_get_topic_content($ topic_id)),ENT_QUOTES);

    $topic_url = get_permalink( $topic_id );

    $ topic_url = get_permalink($ topic_id);

    $reply_author_user_id = bbp_get_reply_author_id( $reply_id );

    $ reply_author_user_id = bbp_get_reply_author_id($ reply_id);

    $reply_author_display_name = bbp_get_topic_author_display_name( $reply_id );

    $ reply_author_display_name = bbp_get_topic_author_display_name($ reply_id);

    $reply_content = strip_tags( bbp_get_reply_content( $reply_id ) );

    $ reply_content = strip_tags(bbp_get_reply_content($ reply_id));

    $reply_url = bbp_get_reply_url( $reply_id );

    $ reply_url = bbp_get_reply_url($ reply_id);

    // note that it's not get_permalink()

    //注意,这不是get_permalink()

    Example

    示例

    To have a nice subject line for new topic notifications, add this to your theme’s functions.php.

    要为新主题通知提供一个不错的主题行,请将其添加到主题的 functions.php 中。

    If your theme does not have this file, you can simply create it and it will be loaded automatically.

    如果您的主题没有此文件,则可以简单地创建它并将其自动加载。

    Note how the example is basically just one of the filters above, mixed with some of the snippets and a return statement.

    请注意,示例基本上只是上面的过滤器之一,与一些代码片段和return语句混合在一起。

    It’s that simple.

    就这么简单。

    add_filter( 'bbp_forum_subscription_email_subject', function( $subject, $forum_id, $topic_id ) {    

      add_filter('bbp_forum_subscription_email_subject',function($ subject,$ forum_id,$ topic_id){    

    $blog_name = get_bloginfo( 'name' );    

    $ blog_name = get_bloginfo('name');    

    $topic_author_display_name = bbp_get_topic_author_display_name( $topic_id );    

    $ topic_author_display_name = bbp_get_topic_author_display_name($ topic_id);    

    $topic_title = wp_specialchars_decode( strip_tags( bbp_get_topic_title( $topic_id ) ), ENT_QUOTES );    

    $ topic_title = wp_specialchars_decode(strip_tags(bbp_get_topic_title($ topic_id)),ENT_QUOTES);    

    return "[$blog_name] $topic_author_display_name created a new topic: $topic_title";

    返回“ [[$ blog_name] $ topic_author_display_name创建了一个新主题:$ topic_title”;

    }, 10, 3);

    },10,3);

    // first is priority (10 is default and just fine), second is number of arguments your filter expects

    //第一个是优先级(默认为10,就可以了),第二个是过滤器期望的参数数量

下载地址
https://downloads.wordpress.org/plugin/asyncronous-bbpress-subscriptions.3.6.zip
-EOF-

AI助手支持GPT4.0