• Resolved tansk

    (@tansk)


    I am trying to pass on the recipients email in the topic or reply urls in the notification email. for instance, the user with the email, [email protected], should get something like the following in his notification mail

    https://www.testsite.com/forums/topic/for-testing/[email protected]

    I tried this but did not work :

    add_filter( ‘bbpnns_filter_email_body_for_user’, ‘my_filter_email_body_for_user’,10,3 );
    function my_filter_email_body_for_user($body, $user_info, $type, $post_id, $forum_id )
    {
    $this_email= $user_info->user_email;
    $topic_url=$topic_url.”?recipient_email=”.$this_email;
    $body = str_replace( ‘[topic-url]’, $topic_url, $body );
    return $body;
    }

    Any help will be greatly appreciated

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author useStrict

    (@usestrict)

    The problem is that you’re trying to replace [topic-url] after it has already been replaced. Also, you’re appending the recipient email to $topic_url which is not one of the parameters passed.

    This is what you need to do:

    1. Load the topic/reply URL from the database using the $type variable to know which type it is.
    2. Create a copy of the $url you just loaded which you’ll append the email to.
    3. Use add_query_arg() to append the email to the copy
    4. Use the original variable in the str_replace() call, replacing it with the new url.
    5. Cheers,
      Vinny

    Thread Starter tansk

    (@tansk)

    Vinny, Thanks for fast reply. I’ve managed to get it working using a combination of bbpnns_reply_url and bbpnns_filter_email_body_for_user using a placholder.

    • This reply was modified 6 years, 9 months ago by tansk.
    Plugin Author useStrict

    (@usestrict)

    Here’s an idea (which is probably what you did) – ditch bbpnns_reply_url altogether and use a custom tag instead. Say [user-url], and replace it with the right one in bbpnns_filter_email_body_for_user.

    Thread Starter tansk

    (@tansk)

    Yes it worked for both the topics and replies.
    – Topics notification will be email to all subscribers which works wonderfully.
    – However, for replies, I like it to be emailed only to those who either subscribed to the forum, the topic or those who ask to be emailed on replies. How do I do this? Can I filter the list and have it replace those in the subscriber role? There was some earlier discussion but I could not find a solution as yet. Thanks again.

    Plugin Author useStrict

    (@usestrict)

    You don’t need to use any filters, just select the Override Subscriptions option and deselect the role. That’ll make bbpnns work only for those who have subscribed to the topic/forum.

    Thread Starter tansk

    (@tansk)

    That exactly what I’ve been looking for. Many thanks. Super.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Customised Topic and Reply URLs’ is closed to new replies.