Purge followers from one post  

  RSS

eduardorms
(@eduardorms)
Member Customer
Joined: 2 years ago
Posts: 2
17/05/2019 6:03 pm  

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
(@astghik)
Support Team Admin
Joined: 2 years ago
Posts: 3388
20/05/2019 2:38 pm  

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
(@eduardorms)
Member Customer
Joined: 2 years ago
Posts: 2
20/05/2019 9:25 pm  

Thanks. Is there any example code of wpdiscuz_email_notification use?

 


ReplyQuote
Astghik
(@astghik)
Support Team Admin
Joined: 2 years ago
Posts: 3388
22/05/2019 12:54 pm  

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:
Green
Default
Pear
Black Emo
{green}:grinning:
{green}:wink:
{green}:face:
{green}:inlove:
{green}:sweaty:
{green}:surprised:
{green}:lovekiss:
{green}:laugh:
{green}:formalsmile:
{green}:displeased:
{green}:cool:
{green}:resent:
{green}:nerd:
{green}:screaming:
{green}:amazed:
{green}:sad:
{green}:deceitful:
{green}:starryeyes:
{green}:evil:
{green}:shocked:
{green}:tears:
{green}:sulky:
{green}:smile:
{green}:vomited:
{green}:hi:
{green}:afraid:
{green}:crazy:
{green}:rabid:
{green}:fighting:
{green}:nonoise:
{green}:blushed:
{green}:idontknow:
{green}:scared:
{green}:razz:
{green}:kiss:
{green}:eat:
{green}:shutmouth:
{green}:gape:
{green}:suspicious:
{green}:laughingoutloud:
{green}:bruise:
{green}:crying:
{green}:pray:
{green}:serious:
{green}:excitement:
:)
:d
:wink:
:mrgreen:
:neutral:
:twisted:
:arrow:
:shock:
:???:
:cool:
:evil:
:oops:
:razz:
:roll:
:cry:
:eek:
:lol:
:mad:
:sad:
:!:
:?:
:idea:
:hmm:
:beg:
:whew:
:chuckle:
:silly:
:envy:
:shutmouth:
{pear}:happy:
{pear}:smile:
{pear}:laugh:
{pear}:laughingoutloud:
{pear}:crying:
{pear}:exhausted:
{pear}:nerd:
{pear}:surprised:
{pear}:veryhungry:
{pear}:wink:
{blackemo}:laughtertotears:
{blackemo}:gift:
{blackemo}:love:
{blackemo}:inlove:
{blackemo}:shamefaced:
{blackemo}:heart:
{blackemo}:crazy:
{blackemo}:anguished:
{blackemo}:bruise:
{blackemo}:easymoney:
{blackemo}:exhausted:
{blackemo}:vampire:
{blackemo}:shutmouth:
{blackemo}:wink:
{blackemo}:carnival:
{blackemo}:flowers:
{blackemo}:hotdrink:
{blackemo}:party: