• Resolved Sociality

    (@sociality)


    Is it possible to notify the participants only when the moderator or the keymaster posts something? Actually can I use the checkbox in the backend to send notifications without enabling the notifications also in the front end in bbpress?!

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

    (@usestrict)

    Hi @sociality,

    Not out of the box, no. But you can hook into bbpnns_skip_topic_notification and bbpnns_skip_reply_notification and return true.

    In your functions.php file, add the following (and complete it with the check author and role parts):

    
    function sociality_skip_topic_notification( $bool, $forum_id, $topic_id ) {
        // Fetch author for topic ID
        // Check author forum role
        // Set $bool to true if role matches what you want
    
        return $bool;
    }
    add_filter( 'bbpnns_skip_topic_notification', 'sociality_skip_topic_notification', 10, 3 );
    
    function sociality_skip_reply_notification( $bool, $forum_id, $topic_id, $reply_id ) {
        // Fetch author for reply ID
        // Check author forum role
        // Set $bool to true if role matches what you want
    
        return $bool;
    }
    add_filter( 'bbpnns_skip_reply_notification', 'sociality_skip_topic_notification', 10, 4 );
    

    Cheers,
    Vinny

    Plugin Author useStrict

    (@usestrict)

    I forgot to address the second question. You can disable the front-end notification by removing the hooks. If you have background notifications turned on, you can try this:

    
    function sociality_turn_off_bbpnns_fe() {
        $bbpnns = bbPress_Notify_NoSpam::bootstrap();
        remove_action( 'bbp_new_topic', array( $bbpnns, 'bg_notify_new_topic'), 100 );
        remove_action( 'bbp_new_reply', array( $bbpnns, 'bg_notify_new_reply'), 100 );
    }
    
    add_action( 'plugins_loaded', 'sociality_turn_off_bbpnns_fe', 10 );
    

    But please test it in a staging/dev environment first.

    Thread Starter Sociality

    (@sociality)

    Both seem really helfull! Thanks a lot. I will try them out and let you know!

    Thread Starter Sociality

    (@sociality)

    I tried the second solution. I put it my functions.php but still the front end notification work ?? What I want is only from the wp-admin to be able to send notifications.

    Thanks a lot for your help, really appreciate!

    Plugin Author useStrict

    (@usestrict)

    Hi Sociality,

    I understand what you need. The code should have worked. Can you make sure it’s actually a bbpnns notification that you got and not some other plugin (such as bbPress core notifications)?

    You can do that by turning off bbpnns and testing the notification from the front-end again.

    Plugin Author useStrict

    (@usestrict)

    Hi @sociality,

    Is this still an issue?

    Thread Starter Sociality

    (@sociality)

    Its’s been a while it seemed to work in a way. Not completely sure thought. I decided to do it another way for now and try again another time. Thanks for the effort!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Notify User only from Backend’ is closed to new replies.