Jump to content

Comments approval bug?


adrian
 Share

Recommended Posts

Hi,

Has anyone else come across an issue with the approval link in the comment emails?

The message is: "Invalid comment code or code has already been used" but the problem is that no code or subcode was ever created in the DB table.

I am seeing this on all comments on a new site I am finishing up, but looking back at another site using the comment system I see that sometimes no code was entered there either.

I thought it might be related to logged in users, but even guest users don't get the code and same goes for users without already approved comments.

Anyone also seeing something like this?

 

Link to comment
Share on other sites

1 hour ago, adrian said:

Has anyone else come across an issue with the approval link in the comment emails?

Not on a site, but I have noticed something similar (If I recall correctly), when approving comments sent to me by ProcessWire for approval with respect to comments left on my modules' pages in the modules directory (hope this makes sense...Friday, tired and all that ?).

  • Like 1
Link to comment
Share on other sites

Ok, I went a wandering into the comments fieldtype code and discovered it was because the schemaVersion setting for the field was set to "1" whereas it should be "6". I've made that change and it seems to be working fine now. As to why it was set to 1 and not 6, I have no idea - maybe someone else will come across this and it will help them to solve it as well.

  • Like 3
Link to comment
Share on other sites

  • 4 weeks later...
On 3/15/2021 at 6:26 PM, adrian said:

Ok, I went a wandering into the comments fieldtype code and discovered it was because the schemaVersion setting for the field was set to "1" whereas it should be "6". I've made that change and it seems to be working fine now. As to why it was set to 1 and not 6, I have no idea - maybe someone else will come across this and it will help them to solve it as well.

Can you narrow things down for me adrian? I'm having the same problem but there's a lot of code to go through and I don't know where to look.

Please.

Link to comment
Share on other sites

27 minutes ago, digitex said:

Can you narrow things down for me adrian? I'm having the same problem but there's a lot of code to go through and I don't know where to look.

Please.

Just a matter of changing the value in the field's settings JSON.

image.png.392085ae083a6a56267cd0f1fb8569c1.png

  • Like 1
Link to comment
Share on other sites

Thanks for the hint @adrian. The interface looks very different on my end but I found the settings. Seems my problem is different in more than one way: the schemaVersion is already set to 6.

I don't see a message like you described, the approval email simply does nothing when clicking the approve link i.e. pending comments remain pending. I had hoped your issue and mine may have had a similar solution.

Link to comment
Share on other sites

@digitex - that interface is simply "Adminer" which I include as part of Tracy. Of course you can view this via PHPMyAdmin or a desktop client like SequelAce.

But it sounds like it's no use to you anyway. Hope you can dig in further and figure out what the problem might be.

Link to comment
Share on other sites

5 hours ago, adrian said:

@digitex - that interface is simply "Adminer" which I include as part of Tracy. Of course you can view this via PHPMyAdmin or a desktop client like SequelAce.

But it sounds like it's no use to you anyway. Hope you can dig in further and figure out what the problem might be.

I figured it was tracy, I was just marvelling at how much easier it is to read than phpMyAdmin.

I found a solution here:

This works. It's an odd behaviour for the Approve Now button in the notification email to only work when comments are rendered through the render function. I can work with it though ?

Thanks for your help.

  • Like 1
Link to comment
Share on other sites

Glad you got it sorted - if it's not already, I think this should be posted as an issue on Github. We desperately need to start culling these weird inconsistencies that waste hours of time and make you go grey ?

  • Like 1
Link to comment
Share on other sites

  • 4 weeks later...

While we're on the subject of comments ? I have another question. When notifications come in, I have never seen any actions other than "approve now". Many comments are not useful to the public, to say the least, so an admin won't want to approve but to do anything else requires logging in to manually mark as spam or delete. This kind of defeats the purpose of moderating directly from the notification email and if you do nothing the comments remain pending and clog up the system.

501000328_ScreenShot2021-05-12at10_32_24AM.png.d86abac3b20cd71962fdd5a5392cca4f.png

I found the code in CommentNotifications.php that deals with moderation actions but I'm not certain how to add to it.

if($comment->status == Comment::statusPending) {
            $status = $this->_("Pending Approval");
            $actionURL .= "approve";
            $actionLabel = $this->_('Approve Now');
        } else if($comment->status == Comment::statusApproved) {
            $status = $this->_("Approved");
            $actionURL .= "spam";
            $actionLabel = $this->_('Mark as SPAM');
        } else if($comment->status == Comment::statusSpam) {
            $status = sprintf($this->_("SPAM - will be deleted automatically after %d days"), $field->get('deleteSpamDays'));
            $actionURL .= "approve";
            $actionLabel = $this->_('Not SPAM: Approve Now');
        } else {
            $actionURL = '';
            $actionLabel = '';
            $status = "Unknown";
        }

Having the option to mark as spam on a pending comment seems like it would be very useful.

  • Like 1
Link to comment
Share on other sites

5 hours ago, adrian said:

@digitex - I think this idea is really needed - can you add to PW requests GH repo please?

I'll put that on my to do list. I don't have a GH account yet so I'll have to set that up first.

@adrian done. Thanks for the suggestion. Turns out I did already have GH account, it's just been so long since I logged in I had forgotten.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...