Created
March 10, 2014 16:05
-
-
Save stevewithington/9467954 to your computer and use it in GitHub Desktop.
Mura CMS: These are examples of how to register an event handler/listener for when a user is being saved or updated, and then access the old user bean along with the new user bean.
This file contains 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> | |
// Place these methods in your Site, Theme, or Plugin's eventHandler.cfc | |
public any function onBeforeUserSave($) { | |
var newUserBean = arguments.$.event('userBean'); | |
var oldUserBean = arguments.$.getBean('user').loadBy(userid=arguments.$.event('userid')); | |
// if you want to stuff the oldUserBean in the event | |
// $.event('oldUserBean', oldUserBean); | |
// here you could run any comparison logic between the oldUserBean and the newUserBean | |
} | |
public any function onBeforeUserUpdate($) { | |
var newUserBean = arguments.$.event('userBean'); | |
var oldUserBean = arguments.$.getBean('user').loadBy(userid=arguments.$.event('userid')); | |
} | |
</cfscript> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment