Recent Topics

1 Feb 26, 2009 04:08    

AfterUserUpdate and AfterUserDelete exist, but not before. So all I can do in a plugin is say "oops"?

Seems to me hooks should tend to follow a pattern though obviously that's not always going to be the case. But for any BeforeFooBar there should be an AfterFooBar and maybe a PrependFooBar ... and the other way around of course.

Not even really sure where to hack these in at this point because I ran out of coffee (again) and forgot to have a dollar in my pocket when I went up to the store.

3 Feb 26, 2009 09:30

In /inc/users/users.ctrl.php find and modify:

				$Messages->add( T_('You can\'t delete User #1!'), 'error' );
				$action = 'view_user';
				break;
			}

			$Plugins->trigger_event( 'BeforeUserDelete', array( 'delete_User' => & $edited_User ) );

			if( $Messages->count('error') )
			{	// There have been some validation errors:
				// Params we need for tab switching:
				$action = 'view_user';
				break;
			}

			if( param( 'confirm', 'integer', 0 ) )
			{ // confirmed, Delete from DB:


In /inc/plugins/plugin.class.php add this before function AfterUserDelete():

	/**
	 * Event handler: Called at the beginning of the User::dbdelete() process
	 * an user from the database}.
	 *
	 * @param array Associative array of parameters
	 *   - 'User': the related User (by reference)
	 */
	function BeforeUserDelete( & $params )
	{
	}

Still untested though. Seems doing things "the right way" doesn't work so now I gotta go back and redo the wrong way.


Form is loading...