Send update profile email to admin

This should be pretty easy, but I’m having a hard time finding this in this new version…



When a customer updates their profile and gets an email, I need to basically send that email to the admin as well. So it would send out 2 of the same emails, one to the customer and one to the admin. It would be nice to show which fields were actually updated, but first things first.



Can anyone point me in the right direction? (looked through several skin/view/profile tpls and skin/mail/profile files and can’t seem to find it)



Thanks!

Intressting thing, i need to know the same!

K, my crack at this:



fn.users.php in /core



about line 1052



says:


} else {
fn_send_mail($user_data['email'], Registry::get('settings.Company.company_users_department'), 'profiles/update_profile_subj.tpl', 'profiles/update_profile.tpl', '', $lang_code);
}




Add another line with the copy of fn_send_mail… below, this will DOUBLE the email. However, now change $user_data[‘email’] to ‘blah@myemail’ (keep quotes)



Maybe in $user_data there is a field with admin email, I don’t know…



This will send one email to the user, another copy to you. You might want to add new TPLs for the body and subject to have that email that you will get different than the user, say, if you want to highlight different fields…

Thanks, TexasGuy! Works great.



I tried to replace the ‘profiles/update_profile_subj.tpl’ with some text, for the “subject” of the secondary email to show up as different, but it just comes up as (no subject).



Do you know if I need to make a separate .tpl file to change the subject?



Thanks!

Hello @ TexasGuy,



do you coding for money? If yes, how much money you like per hour?



If you like answer me, you can pm me too if you want.



best regards

I do, I’ll give you my email through PM.



However, here is a free tip (since I was doing the same “research” on this function a few days ago)… The “profiles/update_profile_subj.tpl” CANNOT be replaced by a string. It is a design flaw (or not) where a subject is sent through an array (not for this very email but it is so for other places where this function is used that passes a custom subject text) and a whole template is used to show a simple string of text…



What you can do is assign a new subject text through the NEW template directly or through LANG constant.



If you were to open /skins/your-skin-name/mail/profiles/update_profile_subj.tpl you will see:



```php {$settings.Company.company_name|unescape}: {$lang.update_profile_notification} ```



What you can do is:


  1. Create in that dir a new file “update_profile_subj_newversion.tpl”



    Edit it:


  2. Put in your new LANG constant like:



    ```php {$settings.Company.company_name|unescape}: {$lang.update_profile_notification_newversion} ```

    Where the constant would be update_profile_notification_newversion



    or you can type the text write into the TPL file for less flexibility but less prone to any errors:



    ```php This is blah blah blah ```

    …as text itself for a subject



    If you need a dynamic text, that changes, then it is a bit more complicated… since you need to pass it through an array, apply array to smarty, get the damn subject off smarty and still use your new custom (but different code) template for a subject…

Sweet, That did the trick!



It would be cool if the email could highlight WHAT was actually changed or updated in the profile, but there’s really no log of that. Just a thought.



Thanks!

Why modify the standard files rather than adding a post controller hook for the ‘profiles’ controller and look for a mode of ‘update’ and a POST request? You can then send the email from there with whatever info you want to include.



No upgrade conflicts this way.

texasguy - hoping you can help me out - read your email and have a question - I am adding a fn_send_mail in a /controllers/customer php file - and it never sends the email to me - tried tons of things - initially I was using “my subject” and “my body” in the function call - but changed to a default value to test and still fails - so I call a subject tpl and body tpl to see and still doesnt work. It seems as though the tpl’s are not available at this level - does that make sense.



here is my test line

$result = fn_send_mail($data[‘email’], array(‘email’ => $company[‘company_orders_department’], ‘name’ => $company[‘company_name’]), ‘orders/track_subj.tpl’, ‘orders/track.tpl’, ‘’, $order_info[‘lang_code’]);



To prove this I went into fn.common.php and put this debug line:

$mailer->Subject = trim($mailer->Subject);

fn_print_die($mailer->Subject);



in the function just before the sending to see the value and I get



“: _track_request_subj”



When I do it for another item like password recovery - the debugger shows me values.



Any ideas what I can do? I know the php file is calling the send mail function - the to and from are all accurate - but seems the templates are the issue.



Thanks in advance.

Where are your templates located? They must be in the “mail view”.

tbirn- thanks for your reply - I managed to track the issue down - the tpl were in the default mail location - I think something was corrupted so i deleted the subj and body ones and tried again and worked.