0

I've created a custom registration form which accepts extra fields like mobile number, address etc and stored into user meta values. This is working fine, now I have to add a functionality of sending email to admin with all the meta value details whenever a new user registers on the site.

  • What have you done so far? – Laxmana Apr 5 '17 at 10:03
1

You can get the last inserted id at the time of registration and with this id get the user meta by meta keys you assign and send mail with details.

  • I've tried the same, but blank space is going ti the mailbox. – Akshat Apr 5 '17 at 13:39
  • Is your data saved or not in the table . Please check in database in user meta table by meta key and user id – Abhishek Pandey Apr 5 '17 at 13:54
  • Yes data is saved in database, I can access the meta values for other functionalities. – Akshat Apr 5 '17 at 20:38
  • did you check that you are not accessing data out side of the function and please check at the time of registration that you are getting data by meta keys using die before send mail. – Abhishek Pandey Apr 6 '17 at 5:42
0

The function wp_send_new_user_notifications automatically sends the registration info of new users to admin. Just try this line of code and it should do the needful.

add_action('register_new_user','wp_send_new_user_notifications');
  • This is not working, and I need to send all the meta values as well. – Akshat Apr 5 '17 at 13:38
  • In that case you'll have to go with the solution proposed by Abhishek Pandey. That's the only way to fetch and present custom meta fields. – Shivanand Sharma Apr 5 '17 at 14:19

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.