[wp-hackers] action on change of role only
andrew at graymerica.com
Wed Jul 14 00:36:30 UTC 2010
I am working on a plugin to automatically notify users when the admin changes their role from pending to subscriber.
We were having some emails not arrive to activate and this is a way to streamline the activation process.
Everything works fine with the hook in to the following action
add_action('set_user_role', 'change_role_notify' , '' , '2');
change_role_notify is my function, the action was added based on this trac ticket http://core.trac.wordpress.org/changeset/12028
I am able to get the user id and the new role in the function and fire off the email. I can not figure out how to get the previous role to compare.
The issue I am having is the action is fired every time any part of the user information is edited.
For example, if an admin changes the password, the action is fire off, even if the role remains the same.
Does anyone have any idea how to get the previous role to see if it changed before the action in the hook or if there is another action I should attach to,
More information about the wp-hackers