- Posts: 101
- Thank you received: 12
[solved] activation mail & include user fields
I'm able to include user and address fields in the email template for "User account" (see code below)
I'd like to show the same information in the mail that the admin gets with the subject of COM_USERS_EMAIL_ACTIVATE_WITH_ADMIN_ACTIVATION_SUBJECT.
This should be the text that shows the name, email and the username and the activation link to approve:
COM_USERS_EMAIL_ACTIVATE_WITH_ADMIN_ACTIVATION_BODY
Hello administrator,\n\nA new user has registered at %s.\nThe user has verified his email, and requests that you approve his account.\nThis email contains their details:\n\n Name : %s \n email: %s \n Username: %s \n\nYou can activate the user by clicking on the link below:\n %s \n
This way the person that gets this email can see all the info and decide whether or not to activate/approve it.
Thanks.
Here is an example of the code for "user account" email template in case someone wants to use it:
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
So that's normal.
If you don't see it, it means that HikaShop is not sending any admin notification after HikaShop user registration so there is nothing to edit...
Please Log in or Create an account to join the conversation.
I installed the latest hikashop and now I see USER_ACCOUNT_ADMIN_NOTIFICATION in the email template.
1) for some reason it doesn't show the name 'User account admin notification" but USER_ACCOUNT_ADMIN_NOTIFICATION.
2) Inside this file I added one more field ($data->user_data->user_company_name) just to test with it:
And in COM_USERS_EMAIL_ACTIVATE_WITH_ADMIN_ACTIVATION_BODY I just added Company: %s
When I did these changes I get the following error when I click on the activation link:
When I remove the last %s it works but I really want to show the other field(s) so the admin has all the info about the user in the mail and approve straight away.
I'm probable missing something. Maybe there is another file that needs to be altered?
Thanks.
Please Log in or Create an account to join the conversation.
HIKA_USER_ACCOUNT_ADMIN_NOTIFICATION_BODY
Please Log in or Create an account to join the conversation.
I'm probably confused cause I'm starting to think that I'm not working in the correct place.
Let me start over.
New user registers on the site. The user get's an email to activate it (subject: Account details for %s at %s)
When the user clicks on the link then a mail is send to the administrator to approve (Registration approval required for account of %s at %s)
It's this mail that the administrator receives that should contain the user and address fields.
This is the string:
COM_USERS_EMAIL_ACTIVATE_WITH_ADMIN_ACTIVATION_BODY
So when I add for example the company name it becomes:
So something is feeding this string and I first thought it was the email template USER_ACCOUNT_ADMIN_NOTIFICATION
But like you said in the last post it has string HIKA_USER_ACCOUNT_ADMIN_NOTIFICATION_BODY
So I can only conclude that this is not the right place to add the field(s) since HIKA_USER_ACCOUNT_ADMIN_NOTIFICATION_BODY is not USER_ACCOUNT_ADMIN_NOTIFICATION. I'm looking for the place where COM_USERS_EMAIL_ACTIVATE_WITH_ADMIN_ACTIVATION_BODY is send with the parameters.
After the upgrade from 2.1.0 to 2.1.3 these are the email templates that I see: (only one is added: USER_ACCOUNT_ADMIN_NOTIFICATION)
Thanks for your patience.
Please Log in or Create an account to join the conversation.
They should be able to help you on that better than us on how to properly modify it.
If you search through the joomla code, you will find that COM_USERS_EMAIL_ACTIVATE_WITH_ADMIN_ACTIVATION_BODY is in the file components/com_users/models/registration.php so I encourage you to look there.
Unfortunately, you won't be able to easily get the user information in that email as it is not a HikaShop email and thus the data of the user added by HikaShop won't be there either. You would have to load it yourself with MySQL queries to the database before being able to add it to the email text.
Please Log in or Create an account to join the conversation.
I did what you suggested and I altered registration.php and I've used the following code;
And
It seems to work.
If you have any suggestion then please feel free to make correction/modification to the code above.
Too bad there wasn't an email template available to begin with.
If you guys are willing to put this on the todo-list that would be great and we won't need to hack the joomla files.
I know it's not a priority so even if it gets done later that would be better than nothing.
Thanks for pointing me in the right direction.
Greets
Please Log in or Create an account to join the conversation.
I would recommend you to use a class override plugin as explained here my.safaribooksonline.com/book/web-develo...plugins/ch05lev1sec8 in order to avoid modifying the joomla core file.
Please Log in or Create an account to join the conversation.
Thank you so much for the information. I will definitely take a look.
I really appreciate it!!!!!
Please Log in or Create an account to join the conversation.