Recent Topics

1 May 28, 2008 23:24    

Plugins get to add stuff to a user's profile. When a user updates plugin settings on their profile they get 2 messages:

Your profile has not been changed.

Usersettings of Plugins have been updated.

This doesn't make sense because either the profile is updated or it's not. Seems to me if *anything* on the profile page got updated then it should not say your profile has not been updated ... because it has been!

You can duplicate this with any plugin that has user settings. Smilies for example.

2 Jun 09, 2008 00:24

Difficult.

The message "Your profile has not been changed." depends on $current_User->dbupdate()
The plugin however doesn't store the $current_User in the database but stores it's settings in the Plugins section of the database, so the message is correct: $current_User->dbupdate() didn't happen.

Good luck

3 Jun 09, 2008 02:17

This solves the problem.

1) Add this function to the class Log in /inc/_core/model/_log.class.php:

	/**
	 * Remove a message from the log
	 * Foppe >> This seems the best way to solve a conflict (two seemingly conflicting messages
	 * when changing User profile through a plugin)
	 * 
	 * @param string the message
	 * @param string the category
	 *  
	 */	
	function remove( $message, $category = NULL )
	{
		if( $category === NULL )
		{ // By default, we use the default category:
			$category = $this->defaultcategory;
		}
		$custom_key = array_keys( $this->messages[ $category ], $message );
		unset( $this->messages[ $category ][ $custom_key[0] ] );
		$this->_count[ $category ] = $this->_count[ $category ] -1;
	}

2) Add the second line after the first in /inc/users/users.ctrl.php on lines 451 *and* around line 531:

			if( $any_plugin_settings_updated )
			{
				$Messages->add( T_('Usersettings of Plugins have been updated.'), 'success' );
				$Messages->remove( T_('Your profile has not been changed.'), 'note' );
			}


The lines with the function remove are the new lines.

As said, this works but I can't see if this is the proper or best way to trigger the problem.

Good luck


Form is loading...