• Resolved Toengel

    (@toengel)


    Hi Stefano,

    I want to adapt the email notification text (I don’t want to have the “xxx wrote:” part). Also it would be great, if I could adapt the pre-defind text language (or a possibility to change the text by myself). Is there any way? functions.php?

    Toengel@Alex

    The page I need help with: [log in to see the link]

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author Stefano

    (@ste_95)

    Hi Toengel,

    with the filter bbp_subscription_mail_message you can tweak the message content as you wish.

    Thread Starter Toengel

    (@toengel)

    Hi,

    can you post an example, please?

    Toengel@Alex

    Plugin Author Stefano

    (@ste_95)

    Not tested, but something like this should work

    add_filter( 'bbp_subscription_mail_message', 'custom_subscription_message', 10, 3 );
    function custom_subscription_message($message, $reply_id, $topic_id) {
    $message = "your message";
    return $message;
    }

    If you need to use dynamic pieces (author name, topic title, etc), see how it’s currently done in the plugin’s code https://github.com/TheCrowned/bbPress—Anonymous-Subscriptions/blob/master/bbp-anonymous-subscriptions.php#L193

    Thread Starter Toengel

    (@toengel)

    Hi,

    add_filter( 'bbp_subscription_mail_message', 'custom_subscription_message', 10, 3 );

    the $reply_id = 10, $topic_id =3 …

    How can I get the corresponding values?

    I mean, if I’m using this filter, I also need to generate the unsubscribe link again and also the link to the post…

    Any help is appreciated!

    Toengel@Alex

    Plugin Author Stefano

    (@ste_95)

    No, 10 and 3 are priority and number of arguments the callback will receive, as my example callback shows $message, $reply_id, $topic_id. I’d recommend looking at the source for the plugin to see how to handle reply and topic ids.

    Thread Starter Toengel

    (@toengel)

    Hi,

    ok – I understand a lot of things from your code… However, the

    return $message;

    of my custom function should also contain the unsubscribe link, which does contain the email address. Is there some kind of placeholder? Cause your source loops through the emails and send the mails correspondingly. My custom function should only generate the message including the unsubscribe link.

    But maybe I’m wrong in my understanding. Any hints?

    Toengel@Alex

    Plugin Author Stefano

    (@ste_95)

    Ah I see your point, I think you’re right! $user_email should also be passed to the filter. Do you feel like there’s something else that you are missing, that should be passed?

    Thread Starter Toengel

    (@toengel)

    Hi,

    good ??

    I need only the Post-URL and everything for the unsubscribe link…

    Thanks a lot,

    Toengel@Alex

    Plugin Author Stefano

    (@ste_95)

    I’ve just pushed an update as version 1.3.9 which contains the recipient’s email address as 4th argument to the filter. For the post URL, you can fetch that through the post ID (see plugin’s code as example, again).

    Thread Starter Toengel

    (@toengel)

    Hi,

    perfect! It’s working. However, a small update to your previous posts (as we have now 4 argument):

    add_filter( 'bbp_subscription_mail_message', 'custom_subscription_message', 10, 4 );

    Thanks again for your support!

    Toengel@Alex

    PS: is this priority “10” something related to your plugin or a general WordPress thing?

    Plugin Author Stefano

    (@ste_95)

    Yes, it takes 4 arguments now.

    No, priority is a WP argument. Check docs for add_filter if you want to know more.

Viewing 11 replies - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.