Notifications
Clear all

Limited Support

Our team is currently on holiday, so support will be limited during this period. Response times may be slower than usual, and some inquiries may be delayed. We appreciate your patience and understanding, and we’ll resume our usual support by the end of August.

 

Purge followers from one post

4 Posts
2 Users
0 Reactions
2,658 Views
(@eduardorms)
Member Customer
Joined: 8 years ago
Posts: 2
Topic starter  

I have a post with 5K+ comment followers and every comment generate a big mail server queue and slow down my server, 2 comments or 3 comments in sequence... doom. So, how can i purge the notifications from this specific post? Thanks.


   
Quote
Astghik
(@astgh)
Illustrious Member Admin
Joined: 8 years ago
Posts: 6450
 

Hi @eduardorms,

I'm sorry, but there is no option for this. You should do it using wpdiscuz_email_notification hook.  I mean that disable the subscription for the current post using the hook.  


   
ReplyQuote
(@eduardorms)
Member Customer
Joined: 8 years ago
Posts: 2
Topic starter  

Thanks. Is there any example code of wpdiscuz_email_notification use?

 


   
ReplyQuote
Astghik
(@astgh)
Illustrious Member Admin
Joined: 8 years ago
Posts: 6450
 

Hi @eduardorms,

Please add the following code in your active theme's functions.php file.  Please change the red marked code before using, set it the current post ID. 

// disable notifications from the specific (X) post
add_filter('wpdiscuz_email_notification', function ($val, $emailData, $comment) {
if ($comment->comment_post_ID == X) {
$val = false;
}
return $val;
}, 1, 3);

// followers
add_filter('wpdiscuz_follow_email_notification', function ($val, $followerData, $comment) {
if ($comment->comment_post_ID == X) {
$val = false;
}
return $val;
}, 1, 3);

   
ReplyQuote
Share:
Scroll to top