Have all WordPress user data emailed to site owner on registration
Some sites will have additional user data in the registration form, when users register the site owner is notified by email. Now rather than just getting notified by WordPress that a new user has registered why not have all WordPress user data emailed to site owner on registration, here’s a function that does just that.
function new_user_registered($user_id) { global $wpdb; $admin_email = get_bloginfo('admin_email'); if (!current_user_can( 'administrator' )){// avoid sending emails when admin is updating user profiles $to = $admin_email; $subject = 'Yay! You have a new registered user.'; $message = "The user has registered with the following user meta data:\n"; foreach($_POST as $key => $value){ $message .= $key . ': '. $value . '\n'; } wp_mail( $to, $subject, $message); } } add_action( 'user_register', 'new_user_registered'); function yoursite_wp_mail_from($content_type) { return 'changethis@mydomain.com'; } add_filter('wp_mail_from','yoursite_wp_mail_from'); function yoursite_wp_mail_from_name($name) { return 'From a Nice Name'; } add_filter('wp_mail_from_name','yoursite_wp_mail_from_name');
Hi sir ,
I want to copy this post .
and put in my site .. can i do this ???
please reply me on my mail .
Of course all snippets free to use for your own use.
i want to put in my blog as a blog post .
Nice cheeky little snippet!