Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to restrict new topic notifications email to excerpt only

  • @jorrit91

    Participant

    Hi there,

    I’ve been looking for way to long to find a piece of code for my problem. Users of my forum can subscribe to a forum so they receive email notifications when a new topic is created. BUT. I’d like the email to contain just an excerpt of the new topic, since I want my users to view the topic on my website.

    I have found this topic, which is almost what I need, but not exactly, and my coding experience isn’t good enough to edit the code provided myself.

    Can anybody help me out?

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • @shanebp

    Moderator

    Your question pertains to bbPress, not BuddyPress.
    The bbPress support forum is here.

    Anyhow…
    The filter hook you want is in bbpress\includes\common\functions.php

    apply_filters( 'bbp_forum_subscription_mail_message', $message, $topic_id, $forum_id, $user_id );

    function jorrit_filter_forum_topic_message_email( $message, $topic_id, $forum_id, $user_id ) {
    
        $message = wp_trim_words( $message, 15 ); // change 15 to however many words you want
    
        return $message;
    }
    add_filter( 'bbp_forum_subscription_mail_message', 'jorrit_filter_forum_topic_message_email', 10, 4 );

    @jorrit91

    Participant

    Hey Shanebp, superduperthanks for the code. Do I just put the code in my themes functions.php? And just this part?

    function jorrit_filter_forum_topic_message_email( $message, $topic_id, $forum_id, $user_id ) {
    
        $message = wp_trim_words( $message, 15 ); // change 15 to however many words you want
    
        return $message;
    }
    add_filter( 'bbp_forum_subscription_mail_message', 'jorrit_filter_forum_topic_message_email', 10, 4 );

    @jorrit91

    Participant

    Ey Shanebp, since it is a live site we’re talking about, I’d like to make sure my interpretation of your reply is correct, can you confirm it?

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to restrict new topic notifications email to excerpt only’ is closed to new replies.
Skip to toolbar