[Solved] Visitors are bypassing comment moderation by editing comments.  

  RSS

Who
 Who
(@amor)
Member Customer
Joined: 2 years ago
Posts: 20
11/07/2019 5:38 am  

I'm having and issue where certain users are posting comments that passes WordPress comment moderation rules but then they edit their comment and the edited comment is not passed back through the WordPress moderation system. Will this be fixed or is there a workaround, other than disabling editing, that I can use for now?


Quote
Astghik
(@astghik)
Support Team Admin
Joined: 2 years ago
Posts: 3458
11/07/2019 2:43 pm  

Hi @amor,

This cannot be fixed by wpDiscuz side anyway.  wpDiscuz uses Wordpress wp_update_comment() function and the process is handled by the WordPress side. 


ReplyQuote
Who
 Who
(@amor)
Member Customer
Joined: 2 years ago
Posts: 20
11/07/2019 7:06 pm  

@astghik

Okay thank you. I guess I will have to hope there is some sort of hook that I can use to moderate the comment content before it is updated.


ReplyQuote
Who
 Who
(@amor)
Member Customer
Joined: 2 years ago
Posts: 20
11/07/2019 7:50 pm  

@astghik

I think I found a way for you to fix it. I'm testing it now and I will let you know.


ReplyQuote
Who
 Who
(@amor)
Member Customer
Joined: 2 years ago
Posts: 20
11/07/2019 9:37 pm  

@astghik

I believe I have fixed the problem by replacing line number 590 in class.WpdiscuzCore.php with the following:

$commentarr['comment_approved'] = wp_allow_comment( $commentarr );//use the same moderation function that is used when adding a new comment
wp_update_comment(wp_slash($commentarr));
$comment = get_comment($commentId);//update the comment variable with new approved state since it is used in the following lines.

It seems to be working as expected but I don't know if I missed any potential problems that may be caused by doing this.


ReplyQuote
Astghik
(@astghik)
Support Team Admin
Joined: 2 years ago
Posts: 3458
12/07/2019 11:57 am  

@amor

I'll ask the plugin developers and let you know if it may cause some problems. 


ReplyQuote
Who
 Who
(@amor)
Member Customer
Joined: 2 years ago
Posts: 20
12/07/2019 6:57 pm  

@astghik

Thank you. I did some more checking and I don't think there will be any issues so I really hope they can include this fix in the next update. The only thing I noticed was that if a comment gets moderated after being edited, I do not receive the normal email notification for moderated comments. I'm sure they will be able to figure out how to fix this but it's not absolutely necessary. The wp_update_comment() function is basically a database update function so any comment data being passed to it, needs to first be rechecked the same way it is checked when adding a new comment. The line of code $comment = get_comment($commentId); that I added can be eliminated if other changes are made to the saveEditedComment() function.


ReplyQuote
Astghik
(@astghik)
Support Team Admin
Joined: 2 years ago
Posts: 3458
13/07/2019 12:47 pm  

Thank you for the solution @amor!

We probably include the changes in the next version release. 

 


ReplyQuote
Who
 Who
(@amor)
Member Customer
Joined: 2 years ago
Posts: 20
13/07/2019 10:22 pm  

@astghik

That's great. I'm happy I could help.


ReplyQuote
Who
 Who
(@amor)
Member Customer
Joined: 2 years ago
Posts: 20
16/07/2019 11:48 pm  

I just wanted to add that they will need to merge the new commentarr array with the old comment data array before passing it to the wp_allow_comment function so that author name, email and other relevant fields will also be passed for moderation.


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: