From 7d32354de2f5c2c8950e84ee21889987a85cafea Mon Sep 17 00:00:00 2001 From: Yannick Warnier Date: Mon, 3 Dec 2007 22:54:45 +0100 Subject: [PATCH] [svn r13895] Added update of openid to admin user_edit interface --- main/admin/user_edit.php | 12 +++++++++++- main/inc/lib/usermanager.lib.php | 14 ++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/main/admin/user_edit.php b/main/admin/user_edit.php index 1de4448a35..46da931325 100644 --- a/main/admin/user_edit.php +++ b/main/admin/user_edit.php @@ -1,4 +1,4 @@ -addElement('text', 'email', get_lang('Email'),array('size' => '40')); $form->addRule('email', get_lang('EmailWrong'), 'email'); $form->addRule('email', get_lang('EmailWrong'), 'required'); +// OpenID +if(api_get_setting('openid_authentication')=='true') +{ + $form->addElement('text', 'openid', get_lang('OpenIDURL'),array('size' => '40')); +} + // Phone $form->addElement('text','phone',get_lang('PhoneNumber')); @@ -265,6 +271,10 @@ if( $form->validate()) $auth_source = $user['auth_source']; } UserManager::update_user($user_id,$firstname,$lastname,$username,$password,$auth_source,$email,$status,$official_code,$phone,$picture_uri,$expiration_date, $active); + if(api_get_setting('openid_authentication')=='true' && !empty($user['openid'])) + { + $up = UserManager::update_openid($user_id,$user['openid']); + } if($user_id != $_SESSION['_uid']) { if($platform_admin == 1) diff --git a/main/inc/lib/usermanager.lib.php b/main/inc/lib/usermanager.lib.php index 438abefcaf..a564c33f67 100644 --- a/main/inc/lib/usermanager.lib.php +++ b/main/inc/lib/usermanager.lib.php @@ -202,6 +202,20 @@ class UserManager return true; } + /** + * Update user information with new openid + * @param int $user_id + * @param string $openid + * @return boolean true if the user information was updated + */ + function update_openid($user_id, $openid) + { + $table_user = Database :: get_main_table(TABLE_MAIN_USER); + $sql = "UPDATE $table_user SET + openid='".Database::escape_string($openid)."'"; + $sql .= " WHERE user_id='$user_id'"; + return api_sql_query($sql,__FILE__,__LINE__); + } /** * Update user information * @param int $user_id