From 9470f0b9e072cf268ace39ddad7b2807bc8fdc7a Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Sat, 20 Nov 2010 22:13:28 +1300 Subject: [PATCH] Also update displayname if fullname is changed. --- inc/auth-functions.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/inc/auth-functions.php b/inc/auth-functions.php index c71bd0e6..cd090051 100644 --- a/inc/auth-functions.php +++ b/inc/auth-functions.php @@ -124,7 +124,7 @@ function UpdateUserFromExternal( &$usr ) { } else $type = "INSERT"; - + $params = array(); if ( $type != 'INSERT' ) $params[':user_no'] = $usr->user_no; $qry = new AwlQuery( sql_from_object( $usr, $type, 'usr', 'WHERE user_no= :user_no' ), $params ); @@ -141,6 +141,12 @@ function UpdateUserFromExternal( &$usr ) { $qry->Exec('Login',__LINE__,__FILE__); CreateHomeCalendar($usr->username); } + else if ( $usr->fullname != $old->{'fullname'} ) { + // Also update the displayname if the fullname has been updated. + $qry->QDo( 'UPDATE principal SET displayname=:new_display WHERE user_no=:user_no', + array(':new_display' => $usr->fullname, ':user_no' => $usr->user_no) + ); + } }