Source for file profile_update.php
Documentation is available at profile_update.php
* This file updates the current user's profile!
* This file is part of Quam Plures - {@link http://quamplures.net/}
* See also {@link https://launchpad.net/quam-plures}.
* @copyright (c) 2009 - 2011 by the Quam Plures developers - {@link http://quamplures.net/}
* @copyright (c)2003-2009 by Francois PLANQUE - {@link http://fplanque.net/}
* Parts of this file are copyright (c)2004-2006 by Daniel HAHLER - {@link http://thequod.de/contact}.
* {@internal License choice
* - If you have received this file as part of a package, please find the license.txt file in
* the same folder or the closest folder above for complete license terms.
* - If you have received this file individually (e-g: from http://evocms.cvs.sourceforge.net/)
* then you must choose one of the following licenses before using the file:
* - GNU General Public License 2 (GPL) - http://www.opensource.org/licenses/gpl-license.php
* - Mozilla Public License 1.1 (MPL) - http://www.opensource.org/licenses/mozilla1.1.php
* {@internal Open Source relicensing agreement:
* Daniel HAHLER grants Francois PLANQUE the right to license
* Daniel HAHLER's contributions to this file and the b2evolution project
* under any OSI approved OSS license (http://www.opensource.org/licenses/).
* {@internal Below is a list of authors who have contributed to design/coding of this file: }}
* @author fplanque: Francois PLANQUE
* @author blueyed: Daniel HAHLER
* @todo integrate it into the templates to avoid ugly die() on error and confusing redirect on success.
require_once dirname(__FILE__ ). '/../qp_config/_config.php';
require_once $inc_path. '_main.inc.php';
// Getting GET or POST parameters:
param( 'checkuser_id', 'integer', '' );
param( 'newuser_firstname', 'string', '' );
param( 'newuser_lastname', 'string', '' );
param( 'newuser_nickname', 'string', '' );
param( 'newuser_idmode', 'string', '' );
param( 'newuser_locale', 'string', $default_locale );
param( 'newuser_url', 'string', '' );
param( 'newuser_email', 'string', '' );
param( 'newuser_allow_msgform', 'integer', 0 ); // checkbox
param( 'newuser_notify', 'integer', 0 ); // checkbox
param( 'newuser_showonline', 'integer', 0 ); // checkbox
param( 'pass1', 'string', '' );
param( 'pass2', 'string', '' );
if( $checkuser_id != $current_User->ID )
{ // Can only edit your own profile
bad_request_die( 'You are not logged in under the same account you are trying to modify.' );
if( $demo_mode && ($current_User->ID == 1
|| $current_User->login == 'demouser'
|| $current_User->login == 'demoblogger'
|| $current_User->login == 'demospecial') )
bad_request_die( 'Demo mode: you can\'t edit the admin/demouser profile!<br />[<a href="javascript:history.go(-1)">'
. T_('Back to profile') . '</a>]' );
'nickname' => $newuser_nickname,
'email' => $newuser_email,
'pass_required' => false ), $current_User );
if( $Messages->count('error') )
// TODO: (legacy) dh> these error should get displayed with the profile form itself, or at least there should be a "real HTML page" here (without JS-backlink)
$Messages->display( T_('Cannot update profile. Please correct the following errors:'),
'[<a href="javascript:history.go(-1)">' . T_('Back to profile') . '</a>]' );
$newuser_pass = md5($pass1);
$current_User->set( 'pass', $newuser_pass );
$current_User->set( 'firstname', $newuser_firstname );
$current_User->set( 'lastname', $newuser_lastname );
$current_User->set( 'nickname', $newuser_nickname );
$current_User->set_email( $newuser_email );
$current_User->set( 'url', $newuser_url );
$current_User->set( 'idmode', $newuser_idmode );
$current_User->set( 'locale', $newuser_locale );
$current_User->set( 'allow_msgform', $newuser_allow_msgform );
$current_User->set( 'notify', $newuser_notify );
$current_User->set( 'showonline', $newuser_showonline );
// Set Messages into user's session, so they get restored on the next page (after redirect):
if( $current_User->dbupdate() )
$Messages->add( T_('Your profile has been updated.'), 'success' );
$Messages->add( T_('Your profile has not been changed.'), 'note' );
// redirect Will save $Messages into Session:
|