diff options
Diffstat (limited to 'engine/classes/ElggUser.php')
| -rw-r--r-- | engine/classes/ElggUser.php | 23 | 
1 files changed, 13 insertions, 10 deletions
| diff --git a/engine/classes/ElggUser.php b/engine/classes/ElggUser.php index 6c1cdc1de..6163f9b62 100644 --- a/engine/classes/ElggUser.php +++ b/engine/classes/ElggUser.php @@ -40,6 +40,9 @@ class ElggUser extends ElggEntity  		$this->attributes['code'] = NULL;  		$this->attributes['banned'] = "no";  		$this->attributes['admin'] = 'no'; +		$this->attributes['prev_last_action'] = NULL; +		$this->attributes['last_login'] = NULL; +		$this->attributes['prev_last_login'] = NULL;  		$this->attributes['tables_split'] = 2;  	} @@ -65,30 +68,26 @@ class ElggUser extends ElggEntity  					$msg = elgg_echo('IOException:FailedToLoadGUID', array(get_class(), $guid->guid));  					throw new IOException($msg);  				} - -			// See if this is a username  			} else if (is_string($guid)) { +				// $guid is a username  				$user = get_user_by_username($guid);  				if ($user) {  					foreach ($user->attributes as $key => $value) {  						$this->attributes[$key] = $value;  					}  				} - -			// Is $guid is an ElggUser? Use a copy constructor  			} else if ($guid instanceof ElggUser) { +				// $guid is an ElggUser so this is a copy constructor  				elgg_deprecated_notice('This type of usage of the ElggUser constructor was deprecated. Please use the clone method.', 1.7);  				foreach ($guid->attributes as $key => $value) {  					$this->attributes[$key] = $value;  				} - -			// Is this is an ElggEntity but not an ElggUser = ERROR!  			} else if ($guid instanceof ElggEntity) { +				// @todo why have a special case here  				throw new InvalidParameterException(elgg_echo('InvalidParameterException:NonElggUser')); - -			// Is it a GUID  			} else if (is_numeric($guid)) { +				// $guid is a GUID so load entity  				if (!$this->load($guid)) {  					throw new IOException(elgg_echo('IOException:FailedToLoadGUID', array(get_class(), $guid)));  				} @@ -116,7 +115,7 @@ class ElggUser extends ElggEntity  		$this->attributes = $attrs;  		$this->attributes['tables_loaded'] = 2; -		cache_entity($this); +		_elgg_cache_entity($this);  		return true;  	} @@ -133,9 +132,13 @@ class ElggUser extends ElggEntity  		}  		// Now save specific stuff -		return create_user_entity($this->get('guid'), $this->get('name'), $this->get('username'), +		_elgg_disable_caching_for_entity($this->guid); +		$ret = create_user_entity($this->get('guid'), $this->get('name'), $this->get('username'),  			$this->get('password'), $this->get('salt'), $this->get('email'), $this->get('language'),  			$this->get('code')); +		_elgg_enable_caching_for_entity($this->guid); + +		return $ret;  	}  	/** | 
