Inserting custom fields into php files
-
Hi guys,
I’m using the following plugin for a better registration process. It all works great but i want to improve upon the email that is sent to the admin when a new user registers: https://mikevanwinkle.com/simplr-registration-form-plus/
I have used the plugin to create a number of additional registration fields that appear when a user registers. This works great but i want them to now show up in the admin’s notify email whenever a new users appears on the site.
The plugin has let me set some Field Keys so i think i just need to add these to the following code like so:
Original Code …
function simplr_send_notifications($atts, $data, $passw) { $site = get_option('siteurl'); $name = get_option('blogname'); $user_name = @$data['username']; $email = @$data['email']; $notify = @$atts['notify']; $emessage = @$atts['message']; $headers = "From: $name" . ' <' .get_option('admin_email') .'> ' ."\r\n\\"; wp_mail($notify, "A new user registered for $name", "A new user has registered for $name.\rUsername: $user_name\r Email: $email \r",$headers); $emessage = $emessage . "\r\r---\r"; if(!isset($data['password'])) { $emessage .= "You should login and change your password as soon as possible.\r\r"; } $emessage .= "Username: $user_name\r"; $emessage .= (isset($data['fbuser_id']))?'Registered with Facebook':"Password: $passw\rLogin: $site"; wp_mail($data['email'],"$name - Registration Confirmation", apply_filters('simplr_email_confirmation_message',$emessage), $headers); }
My amended code …
function simplr_send_notifications($atts, $data, $passw) { $site = get_option('siteurl'); $name = get_option('blogname'); $user_name = @$data['username']; $email = @$data['email']; $notify = @$atts['notify']; $emessage = @$atts['message']; $headers = "From: $name" . ' <' .get_option('admin_email') .'> ' ."\r\n\\"; wp_mail($notify, "A new user registered for $name", "A new user has registered for $name.\rUsername: $user_name\r Email: $email \r Saver Type: $saver_type \r Telephone: $telephone \r Company: $company \r House Number and Street: $number_street \r Town or City: $town_city \r County: $county \r Post Code: $post_code \r",$headers); $emessage = $emessage . "\r\r---\r"; if(!isset($data['password'])) { $emessage .= "You should login and change your password as soon as possible.\r\r"; } $emessage .= "Username: $user_name\r"; $emessage .= (isset($data['fbuser_id']))?'Registered with Facebook':"Password: $passw\rLogin: $site"; wp_mail($data['email'],"$name - Registration Confirmation", apply_filters('simplr_email_confirmation_message',$emessage), $headers); }
Could anyone give me some pointers? $ just seems to give me a blank result so i know that must be the issue somehow.
Thanks for your help guys.
D
- The topic ‘Inserting custom fields into php files’ is closed to new replies.