I would like to know if it is possible to automatically register a user who writes a comment so I can send them a coupon as a registration reward, I try few plugins but didn't get any result!

Or maybe if there is a way to send them an email after comment approve contain a free coupon 

  • this might violate privacy and data protection laws in a number of countries, you should seek legal guidance. E.g. in the UK you can't sign people up for mailing lists without their consent, creating an account and emailing the person without their consent, aside from not being very nice, could carry legal consequences
    – Tom J Nowell
    Apr 27 at 11:32
  • I can show them a message that by sending a comment you are agree to register on this website, Apr 27 at 18:25

There are a number of functions you can use:

The first function being the most simple to use and the last function gives you many more options - it depends what you want to do.

You can create the new account when the comment is posted using the comment_post hook. You will first want to get the comment using get_comment(), passing the ID from the comment_post hook, and check to see if the email is already registered on your site,

Just make it very clear to the user that you are creating an account, as per Tom's comment on your question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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