kwickcut Posted February 28, 2018 Share Posted February 28, 2018 i have installed this free extension and it works great. below is the code and i was wondering if it was possible to add the registered user name and also to add the store logo. i am not really that good when it comes to editing php i do have Dreamweaver installed but i am just learning. <?php $GLOBALS['gui']->setNotify('Thank you for registering.'); mail($_POST['email'], 'Thank you for registering', 'Thank you for registering with '.$GLOBALS['config']->get('config', 'store_name').'.', 'From: '.$GLOBALS['config']->get('config', 'email_address')); ?> thanks in advance kwick Link to comment Share on other sites More sharing options...
bsmither Posted February 28, 2018 Share Posted February 28, 2018 We can enhance that code a bit so that it uses the Email Template. The Email Template has your store's logo. And we can add more data to the template's inner content. Link to comment Share on other sites More sharing options...
kwickcut Posted February 28, 2018 Author Share Posted February 28, 2018 thanks if its a paid add please let me know Link to comment Share on other sites More sharing options...
bsmither Posted February 28, 2018 Share Posted February 28, 2018 Try this. In admin, Manage Hooks, Code snippets tab, click the edit icon of the "Send registration confirmation email" snippet. In the Code box, replace all of it with: <?php $GLOBALS['gui']->setNotify('Thank you for registering.'); $registration_mailer = new mailer(); $content = array( 'subject' => "Thank you for registering", 'content_html' => "$_POST['title'] $_POST['first_name'] $_POST['last_name'],<br>\n Thank you for registering with " . $GLOBALS['config']->get('config', 'store_name') . ".", 'content_text' => "$_POST['title'] $_POST['first_name'] $_POST['last_name']\nThank you for registering with " . $GLOBALS['config']->get('config', 'store_name') . ".", ); $registration_mailer->sendEmail($_POST['email'], $content); // mail($_POST['email'], 'Thank you for registering', 'Thank you for registering with '.$GLOBALS['config']->get('config', 'store_name').'.', 'From: '.$GLOBALS['config']->get('config', 'email_address')); Save. You can play with the strings for the Subject, HTML Content and Text Content. These are strings, so keep in mind about escaping quotes, using apostophes, and concatenating strings. (We can help with that.) Link to comment Share on other sites More sharing options...
kwickcut Posted February 28, 2018 Author Share Posted February 28, 2018 17 hours ago, bsmither said: Try this. In admin, Manage Hooks, Code snippets tab, click the edit icon of the "Send registration confirmation email" snippet. In the Code box, replace all of it with: <?php $GLOBALS['gui']->setNotify('Thank you for registering.'); $registration_mailer = new mailer(); $content = array( 'subject' => "Thank you for registering", 'content_html' => "$_POST['title'] $_POST['first_name'] $_POST['last_name'],<br>\n Thank you for registering with " . $GLOBALS['config']->get('config', 'store_name') . ".", 'content_text' => "$_POST['title'] $_POST['first_name'] $_POST['last_name']\nThank you for registering with " . $GLOBALS['config']->get('config', 'store_name') . ".", ); $registration_mailer->sendEmail($_POST['email'], $content); // mail($_POST['email'], 'Thank you for registering', 'Thank you for registering with '.$GLOBALS['config']->get('config', 'store_name').'.', 'From: '.$GLOBALS['config']->get('config', 'email_address')); Save. You can play with the strings for the Subject, HTML Content and Text Content. These are strings, so keep in mind about escaping quotes, using apostophes, and concatenating strings. (We can help with that.) thank you for the reply. i have added the code above and i am getting a syntax error on lines 6 if i delete line 6 i thin get one on line 7 'content_html' => "$_POST['title'] $_POST['first_name'] $_POST['last_name'],<br>\n Thank you for registering with " . $GLOBALS['config']->get('config', 'store_name') . ".", 'content_text' => "$_POST['title'] $_POST['first_name'] $_POST['last_name']\nThank you for registering with " . $GLOBALS['config']->get('config', 'store_name') . ".", now i did notice that the <?php did not have a closing so i added ?> to the end and it did nothing. i tested the code with the error. i registered a test user no email was sent and i was taken to a blank white page, the user was listed in the admin area under clients. if i hit F5 the site loaded and everything works but no email thanks again kwick Link to comment Share on other sites More sharing options...
bsmither Posted February 28, 2018 Share Posted February 28, 2018 What does the syntax error say is wrong? I'm wondering if PHP is not liking the variables. Try this: 'content_html' => $_POST['title'] . " " . $_POST['first_name'] . " " . $_POST['last_name'] . ",<br>\n Thank you for registering with " . $GLOBALS['config']->get('config', 'store_name') . ".", 'content_text' => $_POST['title'] . " " . $_POST['first_name'] . " " . $_POST['last_name'] . "\nThank you for registering with " . $GLOBALS['config']->get('config', 'store_name') . ".", Link to comment Share on other sites More sharing options...
kwickcut Posted March 1, 2018 Author Share Posted March 1, 2018 2 hours ago, bsmither said: What does the syntax error say is wrong? I'm wondering if PHP is not liking the variables. Try this: 'content_html' => $_POST['title'] . " " . $_POST['first_name'] . " " . $_POST['last_name'] . ",<br>\n Thank you for registering with " . $GLOBALS['config']->get('config', 'store_name') . ".", 'content_text' => $_POST['title'] . " " . $_POST['first_name'] . " " . $_POST['last_name'] . "\nThank you for registering with " . $GLOBALS['config']->get('config', 'store_name') . ".", this worked like a charm thank you very much!!!! Link to comment Share on other sites More sharing options...
RossF1984 Posted November 3, 2019 Share Posted November 3, 2019 Hi, Sorry for the thread resurrection but have used the above code and it works perfectly @bsmither. However I would like to add some additional text that is sent out in the email. Could you please guide me on where I need to add this into the two content strings as everytime I put the text/HTML where I think it should go it shows errors. I would like to add: <p>If you have not done so please register for a Trade Card <a href="http://www.defaultwebsite.com/trade-card.html">here</a>.</p> Any help would be greatly appreciated as usual! Link to comment Share on other sites More sharing options...
bsmither Posted November 3, 2019 Share Posted November 3, 2019 The errors are probably relating to the use of quotes within quotes. In PHP, creating a string by enclosing the characters in quotes means that the other type of quote (aka apostrophe) won't cause a problem. Same that with using an apostrophe to start and stop strings means that the other type of quote (aka double-quote) won't cause a problem. So, knowing that your content you want to add will be inside double-quotes, make sure to use apostrophes in the content itself. Incidentally, if you really, really need to use the same type of quote within a string that starts and stops with that type of quote, then put a backslash in front of it. Link to comment Share on other sites More sharing options...
RossF1984 Posted November 3, 2019 Share Posted November 3, 2019 Thanks @bsmither! Will give it a go, although I am sure I will be back... Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.