Notice

The forum is in read only mode.

Support Forum

Welcome! Support Forums have been reactivated
Welcome the Technical Support section. Help us in assisting you by providing us with a concise and descriptive elaboration of your issues. Be specific and if possible, provide us with a step-by-step instruction in replicating your problem.

Modify notifcation email sent to Admin when new users register?

10 years 1 month ago
  • Keith's Avatar
    Topic Author
  • Keith
  • Offline
  • Fresh Boarder
  • Posts: 32
  • Thank you received: 0
Licenses:
JomSocial Expired

I am looking for a template file that would enable me to modify the content of the email sent to an admin when a new user registers. Specifically I want to include some of the data entered into Jomsocial custom profile fields when the user registered in the email sent to the Admin. This will help the Admin decide whether to approve them or not.

So 2 questions:
1: Where is the template file to modify?
2. Can you provide example syntax of how to reference the custom profile fields in the email?

Thanks!

(Joomla 2.5.19, Jomsocial 3.1.0.4)

10 years 1 month ago
  • Dimas Tekad Santosa's Avatar
  • Dimas Tekad Santosa
  • Visitor
  • Thank you received: 0
Licenses:

Hi Keith,

You can modify the text of email notification from this file language/en-GB/en-GB.com_community.ini

COM_COMMUNITY_EMAIL_REGISTRATION_ACCOUNT_DETAILS_REQUIRES_ACTIVATION="Hello %s,\n\nThank you for registering at %s. Your account details are as follows:\n\nUsername: %s\nPassword: %s\n\nOnce you have completed the rest of registration process, you will receive another email with an activation link."

in that code you will see the fields from detail accounts username and password, if you wanna add another you can add them inside this file components/com_community/controllers/register.php :
$message = JText::sprintf('COM_COMMUNITY_EMAIL_REGISTRATION_ACCOUNT_DETAILS_REQUIRES_ACTIVATION', $name, $sitename, $username, $password);

and for getting the value from another user profile data fields, you can use CUser Object.. read here for more information documentation.jomsocial.com/wiki/JomSocial_User_Object

I am sorry, I cannot help you too much for this.. I hope it will help.

10 years 1 month ago
  • Keith's Avatar
    Topic Author
  • Keith
  • Offline
  • Fresh Boarder
  • Posts: 32
  • Thank you received: 0
Licenses:
JomSocial Expired

Thanks for the info Dimas.
In the file you mentioned I have found the following on line 1870:
COM_COMMUNITY_USER_REGISTERED_NEEDS_APPROVAL="Hello %s,\n\nA new user has registered at %s. Another email will be sent for your approval once the user has verified his or her email. \nThis e-mail contains the details:\n\nName: %s\nE-mail: %s\nUsername: %s\n\nPlease do not respond to this message. This message is automatically generated and is sent for your information only."

But I don't see how to insert a custom field from the user's profile. If I have a custom field called CITY then would I do this?
COM_COMMUNITY_USER_REGISTERED_NEEDS_APPROVAL="Hello %s,\n\nA new user has registered at %s. Another email will be sent for your approval once the user has verified his or her email. \nThis e-mail contains the details:\n\nName: %s\nE-mail: %s\nUsername: %s\nCity: $cuser->getInfo('FIELD_CITY');\nPlease do not respond to this message. This message is automatically generated and is sent for your information only."

10 years 1 month ago
  • Dimas Tekad Santosa's Avatar
  • Dimas Tekad Santosa
  • Visitor
  • Thank you received: 0
Licenses:

sample you the code like this (I add location field) :

$message = JText::sprintf('COM_COMMUNITY_EMAIL_REGISTRATION_ACCOUNT_DETAILS_REQUIRES_ACTIVATION', $name, $sitename, $username, $password, $location);
COM_COMMUNITY_EMAIL_REGISTRATION_ACCOUNT_DETAILS_REQUIRES_ACTIVATION="Hello %s,\n\nThank you for registering at %s. Your account details are as follows:\n\nUsername: %s\nPassword: %s\n\n Location: %s\n\nOnce you have completed the rest of registration process, you will receive another email with an activation link."

10 years 1 month ago
  • Keith's Avatar
    Topic Author
  • Keith
  • Offline
  • Fresh Boarder
  • Posts: 32
  • Thank you received: 0
Licenses:
JomSocial Expired

I made the following changes. The change to en-GB.com_community.ini caused the new labels to show up in the email. However, the change to register.php DID NOT cause the custom profile field values to get passed into the email. I am using the Field Code names of the profile fields in register.php.

register.php Line 924:
$message2 = JText::sprintf( JText::_( 'COM_COMMUNITY_USER_REGISTERED_NEEDS_APPROVAL' ), $row->name, $sitename, $name, $email, $username, $street, $city, $state, $postal, $why, $referral);

en-GB.com_community.ini Line 1124:
COM_COMMUNITY_USER_REGISTERED_NEEDS_APPROVAL="Hello %s,\n\nA new user has registered at %s. Another email will be sent for your approval once the user has verified his or her email. \nThis e-mail contains the details:\n\nName: %s\nE-mail: %s\nUsername: %s\nStreet: %s\nCity: %s\nState: %s\nZip: %s\nWhy?: %s\nReferred By: %s\n\nPlease do not respond to this message. This message is automatically generated and is sent for your information only."

The email looks like:
Hello Web Admin,

A new user has registered at My Website. Another email will be sent for your approval once the user has verified his or her email.
This e-mail contains the details:

Name: Paul Smith
E-mail: This email address is being protected from spambots. You need JavaScript enabled to view it.
Username: pauls
Street:
City:
State:
Zip:
Why?:
Referred By:

Please do not respond to this message. This message is automatically generated and is sent for your information only.

10 years 1 month ago
  • Dimas Tekad Santosa's Avatar
  • Dimas Tekad Santosa
  • Visitor
  • Thank you received: 0
Licenses:

$cUser = CFactory::getUser($userId)

you need get the $userId value for getting the CUser Object, you can search how to get the latest ID from the current user register session.. I cant go further for this.. sorry :(

10 years 1 month ago
  • Keith's Avatar
    Topic Author
  • Keith
  • Offline
  • Fresh Boarder
  • Posts: 32
  • Thank you received: 0
Licenses:
JomSocial Expired

That makes sense. However, it doesn't seem to work.
Here is my register.php code:

//Send notification email to administrators
			foreach ($rows as $row)
			{
				if ($row->sendEmail)
				{
					if ($requireApproval)
					{
						$cUser = CFactory::getUser($user->id);
						$street= $cUser->getInfo('street');
						$city = $cUser->getInfo('city');
						$state = $cUser->getInfo('state');
						$postal = $cUser->getInfo('postal');
						$why = $cUser->getInfo('why');
						$referral = $cUser->getInfo('referral');
							$message2 = JText::sprintf( JText::_( 'COM_COMMUNITY_USER_REGISTERED_NEEDS_APPROVAL' ), $row->name, $sitename, $name, $email, $username, $street, $city, $state, $postal, $why, $referral);			

Here is my en-GB.com_community.ini code on line 1870:
COM_COMMUNITY_USER_REGISTERED_NEEDS_APPROVAL="Hello %s,\n\nA new user has registered at %s. Another email will be sent for your approval once the user has verified his or her email. \nThis e-mail contains the details:\n\nName: %s\nE-mail: %s\nUsername: %s\nStreet: %s\nCity: %s\nState: %s\nZip: %s\nWhy?: %s\nReferred By: %s\n\nPlease do not respond to this message. This message is automatically generated and is sent for your information only."

I have attached a screenshot of my custom profile setup as well in case there is a problem with that.
Any suggestions you may have would be helpful. I really need to be able to verify they have registered correctly by having the Admin read the email.

Attachments:
10 years 1 month ago
  • Dimas Tekad Santosa's Avatar
  • Dimas Tekad Santosa
  • Visitor
  • Thank you received: 0
Licenses:

Hi Keith,

I think "$user->id" variable is empty, you need to find way how to get "$user->id" from the newest registration user.. I cant help you too much this.. this is your challange ;)

Good luck!

10 years 1 month ago
  • Keith's Avatar
    Topic Author
  • Keith
  • Offline
  • Fresh Boarder
  • Posts: 32
  • Thank you received: 0
Licenses:
JomSocial Expired

There was not a space in register.php here: $street=
I added a space: $street =
and it is all working now. Just a typo. I wouldn't think it would matter in PHP, but who knows, maybe it was a cache thing.
Hopefully this helps others!

Moderators: Piotr Garasiński
Powered by Kunena Forum

Join 180,000 websites creating Amazing communities

JomSocial is the most complete, easy-to-use addon that turns Joomla CMS into a
full -fledged, social networking site

TRY NOW BUY NOW