Send email to user on profile update

Need help with the Administration of your Joomla! 2.5 site? This is the spot for you.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
greaves
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Mon Feb 03, 2014 2:46 pm

Send email to user on profile update

Post by greaves » Mon Feb 03, 2014 2:48 pm

Hello,

I'd like to know if it is possible to send an email to a user each time a user update/modify his profile.

Any help is welcome !

Best regards

User avatar
stutteringp0et
Joomla! Ace
Joomla! Ace
Posts: 1389
Joined: Sat Oct 28, 2006 11:16 pm
Location: Texas
Contact:

Re: Send email to user on profile update

Post by stutteringp0et » Mon Feb 03, 2014 3:04 pm

It's definitely possible, with a plugin.

I don't believe there are any plugins that currently do it though. I've seen one that requires re-confirmation when a user changes their email address.

Fortunately (for me), I'm always cruising the forums looking for good ideas - and I think this is a great idea. One tough thing, knowing what features to incorporate.

In my mind, I envision an email to say that something changed and ask the user if they've authorized this change. Something like that would need to track the changes and that gets complicated (not impossible). And do you allow the changes, or just store them while waiting for an authorization. Weighty concerns when trying to implement such a feature.

How do you envision it working?

I have some paying work to wrap up over the next day or two, but after that I could probably have something like this written in as little as a few days.
My extensions: http://extensions.joomla.org/profile/pr ... ails/18398
Honk if this signature offends you.

User avatar
toivo
Joomla! Master
Joomla! Master
Posts: 17439
Joined: Thu Feb 15, 2007 5:48 am
Location: Sydney, Australia

Re: Send email to user on profile update

Post by toivo » Mon Feb 03, 2014 3:19 pm

This can be done by adding PHP code to send an email to the function onUserAfterSave() of a custom user profile plugin, most of which can be cloned from the relevant parts of the file plugins/user/profile/profile.php.

It is best to create a new plugin because the file plugins/user/profile/profile.php can be overwritten by Joomla updates.

Tutorial: http://docs.joomla.org/Creating_a_profile_plugin
Toivo Talikka, Global Moderator

greaves
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Mon Feb 03, 2014 2:46 pm

Re: Send email to user on profile update

Post by greaves » Mon Feb 03, 2014 3:46 pm

stutteringp0et wrote:It's definitely possible, with a plugin.

I don't believe there are any plugins that currently do it though. I've seen one that requires re-confirmation when a user changes their email address.

Fortunately (for me), I'm always cruising the forums looking for good ideas - and I think this is a great idea. One tough thing, knowing what features to incorporate.

In my mind, I envision an email to say that something changed and ask the user if they've authorized this change. Something like that would need to track the changes and that gets complicated (not impossible). And do you allow the changes, or just store them while waiting for an authorization. Weighty concerns when trying to implement such a feature.

How do you envision it working?

I have some paying work to wrap up over the next day or two, but after that I could probably have something like this written in as little as a few days.
This is exactly the aim : let the user know something has changed and ask them if it is ok or not.

I will look how I can send email to user with the update description

User avatar
dhuelsmann
Joomla! Master
Joomla! Master
Posts: 19659
Joined: Sun Oct 02, 2005 12:50 am
Location: Omaha, NE
Contact:

Re: Send email to user on profile update

Post by dhuelsmann » Mon Feb 03, 2014 3:52 pm

The Community Builder Auto Actions plugin allows you to do this plus many, many more actions. I believe you must be a professional level member to get this plugin for CB so you would want to implement CB in your website to make it worth the expenditure.
Regards, Dave
Past Treasurer Open Source Matters, Inc.
Past Global Moderator
http://www.kiwaniswest.org

User avatar
stutteringp0et
Joomla! Ace
Joomla! Ace
Posts: 1389
Joined: Sat Oct 28, 2006 11:16 pm
Location: Texas
Contact:

Re: Send email to user on profile update

Post by stutteringp0et » Mon Feb 03, 2014 11:47 pm

CB is a heavy solution to a simple problem.

I think I'll write it anyway.
My extensions: http://extensions.joomla.org/profile/pr ... ails/18398
Honk if this signature offends you.

drfb
Joomla! Apprentice
Joomla! Apprentice
Posts: 31
Joined: Mon Feb 02, 2009 10:04 am

Re: Send email to user on profile update

Post by drfb » Tue Feb 21, 2017 10:24 am

Hi All,
Sorry for re-visiting an old thread.
Can anyone advise if this plugin was made in the end?
I would like the admin (or super users) to get a notification when a user updates their profile.
We need to know when email addresses are updated so that we can manually update some other databases in our organisation.

Thanks

User avatar
stutteringp0et
Joomla! Ace
Joomla! Ace
Posts: 1389
Joined: Sat Oct 28, 2006 11:16 pm
Location: Texas
Contact:

Re: Send email to user on profile update

Post by stutteringp0et » Sun Mar 26, 2017 6:13 am

I never wrote it, but I still might.

I've got to re-release almost all of my extensions for the latest changes in 3.x
My extensions: http://extensions.joomla.org/profile/pr ... ails/18398
Honk if this signature offends you.

User avatar
stutteringp0et
Joomla! Ace
Joomla! Ace
Posts: 1389
Joined: Sat Oct 28, 2006 11:16 pm
Location: Texas
Contact:

Re: Send email to user on profile update

Post by stutteringp0et » Mon May 22, 2017 5:20 am

OK, so I have an extension awaiting approval in the JED. It tracks changes to profile settings and logs them for viewing in /administrator

I *could* alter it to offer options to send an email, but I'd like some feedback on how that should work first.

People are weird about linking in the JED (I've been censored a few times for linking to my own site and even to my JED profile), so I'll describe how to find it. It's available from my website - get there by any means you can, search for "Profile History"
My extensions: http://extensions.joomla.org/profile/pr ... ails/18398
Honk if this signature offends you.

drfb
Joomla! Apprentice
Joomla! Apprentice
Posts: 31
Joined: Mon Feb 02, 2009 10:04 am

Re: Send email to user on profile update

Post by drfb » Sun May 28, 2017 12:39 pm

stutteringp0et wrote:OK, so I have an extension awaiting approval in the JED. It tracks changes to profile settings and logs them for viewing in /administrator

I *could* alter it to offer options to send an email, but I'd like some feedback on how that should work first.

People are weird about linking in the JED (I've been censored a few times for linking to my own site and even to my JED profile), so I'll describe how to find it. It's available from my website - get there by any means you can, search for "Profile History"
Awesome.. The plugin looks good on your site, i've watched the quick demo you put together..
Is there anyway to get an email to selected persons or group sent when a user updates their profile?
My main thing is to get an email when a user updates a custom field and/or another field within their profile.
Would this plugin pick up if custom fields are updated with J3.7.x?

Thanks

User avatar
stutteringp0et
Joomla! Ace
Joomla! Ace
Posts: 1389
Joined: Sat Oct 28, 2006 11:16 pm
Location: Texas
Contact:

Re: Send email to user on profile update

Post by stutteringp0et » Sun May 28, 2017 8:11 pm

Yes, I wrote it to examine all fields, including any custom fields. The output is ugly for custom fields, mainly because I can't know the data format of unknown plugins... It is possible to make it pretty.

So, I was thinking something like an option to specify a change that would trigger an email, and then choose a recipient for that trigger. That way you could have different changes notify different people. For example, username/password/email change notifies the user - custom field could notify the admin.
My extensions: http://extensions.joomla.org/profile/pr ... ails/18398
Honk if this signature offends you.

drfb
Joomla! Apprentice
Joomla! Apprentice
Posts: 31
Joined: Mon Feb 02, 2009 10:04 am

Re: Send email to user on profile update

Post by drfb » Sun May 28, 2017 10:49 pm

That's fair by saying that, it would be hard knowing or predicting the layouts.

The email option would be great to go that way if possible.

User avatar
stutteringp0et
Joomla! Ace
Joomla! Ace
Posts: 1389
Joined: Sat Oct 28, 2006 11:16 pm
Location: Texas
Contact:

Re: Send email to user on profile update

Post by stutteringp0et » Sun Aug 06, 2017 9:51 pm

Before I start writing anything to enable email to users - I'm hesitant to enable it for all fields, as many times - fields are created for admin use only - things users may never see or even know about.

So, I was thinking something like an option to choose which available field types are enabled for email upon change. Nothing emails by default.
My extensions: http://extensions.joomla.org/profile/pr ... ails/18398
Honk if this signature offends you.

Marvin_Martiano
Joomla! Intern
Joomla! Intern
Posts: 92
Joined: Fri Sep 09, 2011 12:36 pm

Re: Send email to user on profile update

Post by Marvin_Martiano » Fri Sep 22, 2017 7:58 pm

stutteringp0et wrote:OK, so I have an extension awaiting approval in the JED. It tracks changes to profile settings and logs them for viewing in /administrator
So... what event are you listening for?

Reading https://docs.joomla.org/Plugin/Events/User, it seems I need OnUserBeforeSave, but there is [with OnUserAfterSave] the little remark that I should use OnBeforeStoreUser instead? But I find so little info about that event, that I'm starting to think it's a deprecated/removed or even renamed event. But then I don't get the remark; except possibly if the remark was from before changing/renaming event (then it should be pointing to OnUserBeforeSave).

Any clarity welcome!

[My situation is similar; namely upon change of user's email I must un-subscribe the old email address from a mailing list (with cURL), and re-subscribe with the user's (possibly changed) name + new email.]

EDIT: Am I correct in thinking, this only gets executed if all data are correct? Specifically, if the user mis-types one of the email addresses (so the change gets rejected), and I add at the end of OnUserBeforeSave a line like

Code: Select all

if($user['email']!==$data['email']){//code for unsubscribe+resubscribe}
then my code won't run? So it's "OnUserBeforeSaveButAfterVerifyingConsistency" to use its full name?

User avatar
stutteringp0et
Joomla! Ace
Joomla! Ace
Posts: 1389
Joined: Sat Oct 28, 2006 11:16 pm
Location: Texas
Contact:

Re: Send email to user on profile update

Post by stutteringp0et » Sat Sep 23, 2017 2:34 am

I'm doing the change detection in onUserAfterSave after grabbing the current data in onUserBeforeSave.

Once it gets accepted in the JED, I'll make the necessary changes to provide notification capability. If I submit those changes now, it puts me to the back of the line with my submission - and I've already been waiting a month.
My extensions: http://extensions.joomla.org/profile/pr ... ails/18398
Honk if this signature offends you.

Marvin_Martiano
Joomla! Intern
Joomla! Intern
Posts: 92
Joined: Fri Sep 09, 2011 12:36 pm

Re: Send email to user on profile update

Post by Marvin_Martiano » Sat Sep 23, 2017 1:01 pm

stutteringp0et wrote:I'm doing the change detection in onUserAfterSave after grabbing the current data in onUserBeforeSave.
Ah, genius. Yes, that's exactly what I have to do.

This went wrong in a silly way for me: I didn't get that OnUserBeforeSave has only the old userdata, but the new userdata PLUS profiledata. You can see that (if the 'profile' plugin is activated) when inserting

Code: Select all

		JFactory::getApplication()->enqueueMessage('Oldstuff: '. print_r($user,true));
		JFactory::getApplication()->enqueueMessage('Newstuff: '. print_r($data,true));
just before the end of it!
So it always seemed the "full name" (="name" plus profile's "surname" field) was changed, as I was comparing the full name (in $data) with only the name (in $user).

EDIT: AND this is where I discovered PHP variable scope isn't inherited like in say C... They inexplicably kept getting lost from onUserBeforeSave to onUserAfterSave, but that's the way PHP is.
Once it gets accepted in the JED
Wait, aren't you speaking of the "profile history" plugin in the JED, version 1.2, added April 28 and updated June 04?
Last edited by Marvin_Martiano on Sat Sep 23, 2017 1:44 pm, edited 1 time in total.

User avatar
stutteringp0et
Joomla! Ace
Joomla! Ace
Posts: 1389
Joined: Sat Oct 28, 2006 11:16 pm
Location: Texas
Contact:

Re: Send email to user on profile update

Post by stutteringp0et » Sat Sep 23, 2017 1:31 pm

What the hell are they doing over there? Those dates aren't right.....

Looks like it got approved though. Sweet. I'll start on the email feature tonight then.
My extensions: http://extensions.joomla.org/profile/pr ... ails/18398
Honk if this signature offends you.

Marvin_Martiano
Joomla! Intern
Joomla! Intern
Posts: 92
Joined: Fri Sep 09, 2011 12:36 pm

Re: Send email to user on profile update

Post by Marvin_Martiano » Sat Sep 23, 2017 1:53 pm

stutteringp0et wrote:I'll start on the email feature tonight then.
Sorry to fill your weekend! I only read this thread yesterday for the first time, I saw your "pending JED extension" remark from May 22 and saw it in the JED with release date in June so that made sense.

With dates in the first 12days of the month, US-vs.-EU style date change can give weird results [ 04/06/2017 is April 6 in America but June 4 in Europe], but it's April 28 in your case so that's no explanation [unless a 28 overflows as 12+12+4 and becomes April; but that'd be the opposite direction].

Anyways, all the best and thanks for your hints --- it all works well now (see edit, I got scope wrong).

User avatar
stutteringp0et
Joomla! Ace
Joomla! Ace
Posts: 1389
Joined: Sat Oct 28, 2006 11:16 pm
Location: Texas
Contact:

Re: Send email to user on profile update

Post by stutteringp0et » Sat Sep 23, 2017 10:05 pm

Maybe I've got my dates and extensions confused. I just checked and I still have 2 pending.
My extensions: http://extensions.joomla.org/profile/pr ... ails/18398
Honk if this signature offends you.

dc_Griz
Joomla! Apprentice
Joomla! Apprentice
Posts: 42
Joined: Sat Oct 04, 2008 5:03 pm

Re: Send email to user on profile update

Post by dc_Griz » Fri Oct 20, 2017 12:09 am

stutteringp0et wrote:Looks like it got approved though. Sweet. I'll start on the email feature tonight then.
Your extension looks great. Thank you for putting that together. How is the email notifications piece coming along?

dc_Griz
Joomla! Apprentice
Joomla! Apprentice
Posts: 42
Joined: Sat Oct 04, 2008 5:03 pm

Re: Send email to user on profile update

Post by dc_Griz » Thu Oct 26, 2017 5:51 am

Hey stutteringp0et, just following up to see if you still have plans to add email notifications to your Profile History plugin.

User avatar
stutteringp0et
Joomla! Ace
Joomla! Ace
Posts: 1389
Joined: Sat Oct 28, 2006 11:16 pm
Location: Texas
Contact:

Re: Send email to user on profile update

Post by stutteringp0et » Fri Oct 27, 2017 2:30 pm

Not yet. I've been working on integrating custom fields into the plugin, which seemed to me to be more closely related to the core functionality of my plugin. Before I release the new version, it will include an email notification option.
My extensions: http://extensions.joomla.org/profile/pr ... ails/18398
Honk if this signature offends you.

dc_Griz
Joomla! Apprentice
Joomla! Apprentice
Posts: 42
Joined: Sat Oct 04, 2008 5:03 pm

Re: Send email to user on profile update

Post by dc_Griz » Fri Oct 27, 2017 5:21 pm

Sorry, I'm not trying to be pushy, but do you have an idea of when that new version might be released? I have a project that I am working on right now that is a week or so away from going live. My client would like the functionality you offer in your plugin, but the email notification would be essential.

User avatar
stutteringp0et
Joomla! Ace
Joomla! Ace
Posts: 1389
Joined: Sat Oct 28, 2006 11:16 pm
Location: Texas
Contact:

Re: Send email to user on profile update

Post by stutteringp0et » Sat Oct 28, 2017 4:55 pm

In my best Professor Farnsworth voice:

GOOD NEWS EVERYONE!

I had multiple feature requests, including this for email on field change. The more important one on my list was to capture custom field changes. So in the past 2 days I've tackled both and will be releasing a new version this afternoon or tomorrow.

The notification feature is built to send notification on selected field changes. So, as an admin, you can use a dotpath identifier to specify which fields trigger notification. I'm making a tutorial video on how to identify the dotpath of a field (it's super easy).

Here's a preview of the email that the plugin sends. Of course, I'm building it with translations in mind - so you can use the language overrides to change these values:

Your account details and/or user profile has been altered on our website. The administrators have chosen to notify users of certain changes to their accounts. If you did not make these changes, please contact us immediately.

The following changes were recorded.

[com_fields][mobile-number]:
The original field value was:
555-1212asdf
The field value was changed to:
555-1212

[profile][address1]:
The original field value was:
fu dog
The field value was changed to:
PO Box 301
My extensions: http://extensions.joomla.org/profile/pr ... ails/18398
Honk if this signature offends you.

User avatar
stutteringp0et
Joomla! Ace
Joomla! Ace
Posts: 1389
Joined: Sat Oct 28, 2006 11:16 pm
Location: Texas
Contact:

Re: Send email to user on profile update

Post by stutteringp0et » Sat Oct 28, 2017 8:53 pm

It's done - visit my signature link and you'll see my list of extensions. Somewhere near the last page will be the Profile History plugin.

It now supports Joomla custom fields (com_fields) and user notifications for selected field changes.
My extensions: http://extensions.joomla.org/profile/pr ... ails/18398
Honk if this signature offends you.

dc_Griz
Joomla! Apprentice
Joomla! Apprentice
Posts: 42
Joined: Sat Oct 04, 2008 5:03 pm

Re: Send email to user on profile update

Post by dc_Griz » Mon Oct 30, 2017 4:14 pm

That's great. Congratulations!

I hope I have misunderstood on one point; however. You say you have added user notifications, but does it not have admin notifications? That is the key feature I am looking for so that site admins know that users have updated their profile and what they updated.

User avatar
stutteringp0et
Joomla! Ace
Joomla! Ace
Posts: 1389
Joined: Sat Oct 28, 2006 11:16 pm
Location: Texas
Contact:

Re: Send email to user on profile update

Post by stutteringp0et » Mon Oct 30, 2017 5:38 pm

Interesting

I will look into that
My extensions: http://extensions.joomla.org/profile/pr ... ails/18398
Honk if this signature offends you.

dc_Griz
Joomla! Apprentice
Joomla! Apprentice
Posts: 42
Joined: Sat Oct 04, 2008 5:03 pm

Re: Send email to user on profile update

Post by dc_Griz » Mon Oct 30, 2017 6:05 pm

Thanks, I appreciate that!

User avatar
stutteringp0et
Joomla! Ace
Joomla! Ace
Posts: 1389
Joined: Sat Oct 28, 2006 11:16 pm
Location: Texas
Contact:

Re: Send email to user on profile update

Post by stutteringp0et » Mon Oct 30, 2017 7:30 pm

I had an hour drive home from the airport to think about this, and the solution I came up with took only a dozen or so lines of code to implement.

So, each item identified as a trigger to notification offers a choice of "User", "Administrator" or "Both". When an item triggers notification, the destination is added to an array and when all items have been compared and all differences found - the specified users are notified. It worked out really well and didn't require any refactoring of the core functionality.

I need to go through final testing - but I'll have that up on my site (probably) this evening along with a demo video on [youtube].
My extensions: http://extensions.joomla.org/profile/pr ... ails/18398
Honk if this signature offends you.

dc_Griz
Joomla! Apprentice
Joomla! Apprentice
Posts: 42
Joined: Sat Oct 04, 2008 5:03 pm

Re: Send email to user on profile update

Post by dc_Griz » Mon Oct 30, 2017 7:33 pm

You rock! Thank you so much. I'm looking forward to trying it out.


Locked

Return to “Administration Joomla! 2.5”