User display name field

Added a "display name" field, which can be NULL. The field can be set
from the user creation form, and is displayed in the list.
This commit is contained in:
Emmanuel BENOîT 2012-02-06 08:36:01 +01:00
parent 1271afd1d8
commit b37265d0eb
4 changed files with 45 additions and 14 deletions
includes/t-basics

View file

@ -18,7 +18,10 @@ class Dao_Users
public function getUsers( )
{
return $this->query( 'SELECT user_id , user_email FROM users ORDER BY LOWER( user_email )' )->execute( );
return $this->query(
'SELECT user_id , user_display_name , user_email '
. 'FROM users '
. 'ORDER BY LOWER( user_email )' )->execute( );
}
@ -48,7 +51,7 @@ class Dao_Users
}
public function addUser( $email , $password )
public function addUser( $email , $password , $name )
{
$iterations = rand( 130 , 160 );
@ -65,8 +68,8 @@ class Dao_Users
$hash = $this->hashPassword( $password , $salt , $iterations );
$result = $this->query( 'SELECT users_add( $1 , $2 , $3 , $4 ) AS error' )
->execute( $email , $salt , $iterations , $hash );
$result = $this->query( 'SELECT users_add( $1 , $2 , $3 , $4 , $5 ) AS error' )
->execute( $email , $salt , $iterations , $hash , $name );
return $result[ 0 ]->error;
}