1

I was wondering if I could make it so that if I approve a user account via "Users" UI that an automatic email is sent to the user saying something like "Hey, your account on www.website.com has been approved, thanks for your patience!"

Is this possible in WordPress core, or is this something that has to be added manually?

Thanks in advance.

3
  • WordPress core doesn't even have a method for 'approving' users at all, so the answer would depend entirely on how you'd implemented that functionality. Are you using a plugin? Commented Feb 14, 2019 at 12:19
  • Hello there, I just found out that WP Forms (plugin) adds this functionality, so I'll probably have to contact them. Commented Feb 14, 2019 at 12:31
  • I found that WP Forms add a field wpforms-pending to the wp_user_meta table, so this is probably the field I'm looking for. This issue is not solved as it not a WordPress core issue. Thanks for your help. Commented Feb 14, 2019 at 12:42

1 Answer 1

0

What you are trying to do - approve a user in the admin and send an email - must be done using action and filter hooks, either by a plugin you're using or your own code in your child theme or a plugin.

To approve a user, take a look at the user_register, edit_user_profile, edit_user_profile_update and load-user-edit.php hooks to get started. In your own approval code, you would then structure your email and send it with the wp_mail() function.

Try searching the net for detailed solutions, you should be able to find blog posts with ready code.

1
  • I found out how it works, it's the plugin WPForms that stores a wpforms-peding status in the db. I'm checking if I can watch for changes to this value and trigger an email when it happens! Thank for you explanation! Very helpful if I ever need to construct this myself from scratch! Commented Feb 14, 2019 at 13:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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