diff options
| author | wjames5 <will@tekimaki.com> | 2010-02-10 20:29:14 +0000 |
|---|---|---|
| committer | wjames5 <will@tekimaki.com> | 2010-02-10 20:29:14 +0000 |
| commit | c167e348d4f0cb787af33a168d147da803233d01 (patch) | |
| tree | 16b4fb02beb2733bbd23b161fedc9290ca10e2d8 | |
| parent | 05767ac39d947a3d66ddbd3e21b4076c21c3d07b (diff) | |
| download | users-PRE_LIBERTYSYS_SERVICE_UPDATE.tar.gz users-PRE_LIBERTYSYS_SERVICE_UPDATE.tar.bz2 users-PRE_LIBERTYSYS_SERVICE_UPDATE.zip | |
virtualize first and last name for people who really really really like first and last name fieldsPRE_LIBERTYSYS_SERVICE_UPDATE
| -rw-r--r-- | BitUser.php | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/BitUser.php b/BitUser.php index 551ae0c..1f7f5b2 100644 --- a/BitUser.php +++ b/BitUser.php @@ -1,6 +1,6 @@ <?php /** - * $Header: /cvsroot/bitweaver/_bit_users/BitUser.php,v 1.251 2010/02/10 20:07:06 wjames5 Exp $ + * $Header: /cvsroot/bitweaver/_bit_users/BitUser.php,v 1.252 2010/02/10 20:29:14 wjames5 Exp $ * * Lib for user administration, groups and permissions * This lib uses pear so the constructor requieres @@ -12,7 +12,7 @@ * All Rights Reserved. See below for details and a complete list of authors. * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details * - * $Id: BitUser.php,v 1.251 2010/02/10 20:07:06 wjames5 Exp $ + * $Id: BitUser.php,v 1.252 2010/02/10 20:29:14 wjames5 Exp $ * @package users */ @@ -42,7 +42,7 @@ define( "ACCOUNT_DISABLED", -6 ); * Class that holds all information for a given user * * @author spider <spider@steelsun.com> - * @version $Revision: 1.251 $ + * @version $Revision: 1.252 $ * @package users * @subpackage BitUser */ @@ -133,6 +133,16 @@ class BitUser extends LibertyMime { $this->mInfo['portrait_path'] = ( !empty( $this->mInfo['portrait_storage_path'] ) ? BIT_ROOT_PATH.$this->mInfo['portrait_storage_path']: NULL); $this->mInfo['logo_path'] = ( !empty( $this->mInfo['logo_storage_path'] ) ? BIT_ROOT_PATH.$this->mInfo['logo_storage_path'] : NULL); + // break the real name into first and last name using the last space as the beginning of the last name + // for people who really want to use first and last name fields + if( preg_match( '/ /', $this->mInfo['real_name'] ) ) { + $this->mInfo['first_name'] = substr( $this->mInfo['real_name'], 0, strrpos($this->mInfo['real_name'], ' ') ); + $this->mInfo['last_name'] = substr( $this->mInfo['real_name'], strrpos($this->mInfo['real_name'], ' ')+1 ); + }else{ + // no spaces assign the real name to the first name + $this->mInfo['first_name'] = $this->mInfo['real_name']; + } + $this->mUserId = $this->mInfo['uu_user_id']; $this->mContentId = $this->mInfo['content_id']; $this->mUsername = $this->mInfo['login']; @@ -239,6 +249,15 @@ class BitUser extends LibertyMime { $pParamHash['user_store']['login'] = $pParamHash['login']; } } + // some people really like using first and last names + // push them into real_name + if( !empty( $pParamHash['first_name'] ) ) { + $pParamHash['real_name'] = $pParamHash['first_name']; + } + if( !empty( $pParamHash['last_name'] ) ) { + $pParamHash['real_name'] = !empty( $pParamHash['real_name'] )?$pParamHash['real_name']." ":''; + $pParamHash['real_name'] .= $pParamHash['last_name']; + } // real_name if( !empty( $pParamHash['real_name'] ) ) { $pParamHash['user_store']['real_name'] = substr( $pParamHash['real_name'], 0, 64 ); @@ -2431,4 +2450,3 @@ function get_user_content_count( $pUserId ) { } /* vim: :set fdm=marker : */ -?> |
