Last active
August 29, 2015 14:25
-
-
Save stevewithington/d157d5fff714fb1cabf1 to your computer and use it in GitHub Desktop.
Mura CMS: How to email user notification after being activated
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
// Mura CMS example of how to send notifications to users after they've been activated | |
public any function onAfterUserCreate($) { | |
user = arguments.$.event('userBean'); | |
// By default, we're going to set all newly created users to 'inactive' ... | |
// you could also add the user to a group, etc. here if you wanted to as well | |
user.set('inActive', 1).save(); | |
} | |
// IMPORTANT: this assumes a custom class extension attribute for 'User/Default' called 'activeNotificationSent' exists and default value is '0' | |
public any function onAfterUserSave($) { | |
user = arguments.$.event('userBean'); | |
if ( !user.get('inActive') && !YesNoFormat(user.get('activeNotificationSent')) ) { | |
user.set('activeNotificationSent', 1).save(); | |
arguments.$.getBean('userUtility').sendActivationNotification(user); | |
} | |
} | |
</cfscript> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment