|
|
|
|
Member: US-WebDesigner ⋅
Date: August 14, 2010, 09:57 PM
⋅ Subject: "Registration email"
I am testing the registration process when Admin CP > Users > Registration is set to Require Validate > Admin.
I ran a test and the same email was sent both to the user and to the admin:
Hi test user 3,
This message was sent in response to your request for registering at California Narcotic Canine Association. Your account is pending Administrator review and activation. You will receive an e-mail once your account has been approved.
website link.........
I suspect this is an error? and that it should be sending a different email to the admin informing them that Test User 3 with email address... just registered and is pending approval?
Thanks
PS - and as a side note, I think I mentioned this elsewhere but don't remember hearing back on how to fix it - the emails that get sent out all seem to have a double listing of Subject. (I remember now that I sent a sample to you via email so you could see it.)
PPS - I just went into admin and approved the member and an email was sent to the test user (I suspect to inform them that they are approved) but the content and subject are blank. I will forward the email to you.)
Member: Markus ⋅
Date: August 19, 2010, 03:08 AM
⋅ Subject: "Re: Registration email"
There is a difference between them — Copy: prefix on the subject line for Admin. If you want to have a different e-mail template for administrators, do this:
The notification mail to Admin is sent in /core/ajax/members.php at #683:
if ($core['registration']['notify_admin'] === TRUE) { Mailer::send_email($core['init']['incoming_email'], $lang['copy_mail_prefix'] . $lang['mail_reg_confirmation_subject'], $mail_msg); }
The $mail_msg above has been defined earlier in the code — scroll up to #660 about to see how.
Open /languages/en/lang_mail.php — the mail templates are there (#94 onwards). Create a new subject line and body text templates for admin mailing as you wish, following the model of the existing ones.
Before the Mailer:: line in members.php as above, define $mail_msg with your template of choice. Data can be parsed into the template's tags as follows:
$mail_msg = Template::parse_unit($member_data, $lang['mail_reg_confirmation']);
In the above, the member details from $member_data array are parsed into the template tags. You can use whatever tags you wish to include in your mail template — see table w_members in the database to see what data is available.
Member: Markus ⋅
Date: August 19, 2010, 03:38 AM
⋅ Subject: "Re: Registration email"
"E-mails that get sent out all seem to have a double listing of Subject"
Yes I notice this, there are two subject headers. I haven't seen any e-mail client display two though, so this hasn't been caught in the net — guess it's usually filtered out.
Open /core/class_mailer.php, find this (#177), and delete the red portion:
$headers = array ( 'From' => $sender, 'Subject' => $subject);
This should remove it. Bug confirmed & fixed.
Member: Markus ⋅
Date: August 19, 2010, 03:43 AM
⋅ Subject: "Re: Registration email"
"I just went into admin and approved the member and an email was sent to the test user (I suspect to inform them that they are approved) but the content and subject are blank."
There's a missing variable declaration in function users_default() in admin_area_users.php. On line #34, add in the missing $lang variable;
global $core, $lang, $skin;
Then, do the same change at line #132, at the start of function activate_all_pending().
There is an identical bug in the same context in function send_new_password() in /core/ajax/members.php (#960), change to read follows:
global $core, $lang, $skin;
This fixes a blank message on password recovery. Bugs confirmed and fixed.
Member: US-WebDesigner ⋅
Date: August 19, 2010, 09:36 PM
⋅ Subject: "Re: Registration email"
Thanks. Getting there.
2 Requests please:
1. The last fix you provided above in post #4 to have the You are approved email's content fill in did not work for me. I still am receiving empty emails.
2. It took me a while to make sense of how to implement the changes to create separate admin email subject and content but I have it working, all except one component I just can get to work.
Per your comment in post #2 above,
Before the Mailer:: line in members.php as above, define $mail_msg t; with your template of choice. Data can be parsed into the template's tags as follows:
$mail_msg = Template::parse_unit($member_data, $lang['mail_reg_confirmation']);
In the above, the member details from $member_data array are parsed into the template tags. You can use whatever tags you wish to include in your mail template — see table w_members in the database to see what data is available.
I tried that but by swapping out $member_data for $tmp, the [[LINK]] no longer worked in the template.
All I need is to add in the email address of the registrant. I could use [[MEMBER_USERNAME]] in the admin email content as I saw it was already in use, but don't know how to get the email address into the new admin email template that I created in lag_mail.php per above. Can you help with that.
And for what it is worth, although you have a bigger picture on how people may use the system, I think having a separate admin email sent (when the site is set for registration admin approval) that includes the registrants username and email would be a fairly common desire and might be worth considering for future improvements?
Anyways - help on how to get the email in there for now would be great. thanks.
Member: Markus ⋅
Date: August 21, 2010, 11:02 PM
⋅ Subject: "Re: Registration email"
1. The last fix you provided above in post #4 to have the You are approved email's content fill in did not work for me. I still am receiving empty emails.
I have tested this again, and it seems to be working for me as expected. Does this happen when you activate them individually, when you click "Activate All", or in both cases?
I tried that but by swapping out $member_data for $tmp, the [[LINK]] no longer worked in the template.
In that case, use array_merge($member_data, $tmp) — this combines both arrays into one, and parses the tags against both of them. Then, the [[MEMBER_EMAIL]] tag should contain the member's e-mail. Let me know if this solves the issue for you.
Another option for accomplishing the same, while keeping the $tmp variable there, is simply doing this before the mail message is parsed:
$tmp['member_email'] = $member_data['member_email'];
This would similarly add the e-mail address into the data available for the confirmation mail.
And for what it is worth, although you have a bigger picture on how people may use the system, I think having a separate admin email sent (when the site is set for registration admin approval) that includes the registrants username and email would be a fairly common desire and might be worth considering for future improvements?
Agreed, I'll add this in for the next build. There are a number of refinements like this that just haven't been added in yet, where a faster solution was available, and with many more things to add in the pipeline.
Member: Markus ⋅
Date: August 21, 2010, 11:08 PM
⋅ Subject: "Re: Registration email"
Post #4 updated: Then, do the same change at line #132, at the start of function activate_all_pending().
The language files still weren't available under the "activate all" option — which I guess is the option you tried.
Member: US-WebDesigner ⋅
Date: August 25, 2010, 08:30 PM
⋅ Subject: "Re: Registration email"
Thanks. That did it on both accounts for post 6 and 7 above - now the new admin email includes the user's email address, and the approval email is not blank. (I guess I must have been testing with the Approve All button because I just tested using both approaches and the emails work for both.)
|
|
|
|