0

This question is very similar but not exactly the same as this.. One comment per user per post but be able to reply to existing comments

I'd like a js solution so it doesn't need to modify any of my theme files.

I'd like a commentor to be able post 1 comment only and then only be able to reply to that comment they posted.

2
  • 1
    If you would like a JS solution then the answer is that it is impossible Commented Apr 10, 2016 at 15:23
  • Just write a custom plugin instead.
    – kaiser
    Commented Apr 11, 2016 at 0:04

1 Answer 1

0

Just with JS there is no way, because the visitor can reload the page or close window and reopen and reset everything.

You can create a table in your wordpress database where the user's name will be saved with 0 (if no comments was done) and the id of the post (if commented). So in one more column, you create the replies number, starting with 0 and go increasing up to 3.

With JS you can access the database via AJAX requisitions, and add one more count of replies and when it's 3, return a negative message.

This is the "JS way" that I see.

I Hope to help you.

1
  • there is no need for additional table, should be very easy to use the comments api to query the comments for the required conditions Commented Apr 10, 2016 at 17:42

Not the answer you're looking for? Browse other questions tagged or ask your own question.