<?php

class Xoops_User extends Abstract_User {

	var $mHandler;

	function Xoops_User()
	{
		$this->mHandler =& xoops_gethandler('member');
	}

	function loadByUid($uid) {

		$user =& $this->mHandler->getUser($uid);
		$this->uid             = $uid;
		$this->username        = $user->getVar('uname');
		$this->password        = $user->getVar('pass');
		$this->isAdmin         = (!$user->isAdmin()) ? 0 : 1;
		$this->canCreateAlbums = $this->isAdmin;
		$this->fullname        = ($user->getVar('name') != '') ? $user->getVar('name') : $this->username;
		$this->email           = $user->getVar('email');
	}

	function loadByUserName($uname) {
		
		$user =& $this->mHandler->getUsers(new Criteria('uname', $uname));

		$this->uid             = $user[0]->getVar('uid');
		$this->username        = $uname;
		$this->password        = $user[0]->getVar('pass');
		$this->isAdmin         = (!$user[0]->isAdmin()) ? 0 : 1;
		$this->canCreateAlbums = $this->isAdmin;
		$this->fullname        = ($user[0]->getVar('name') != '') ? $user[0]->getVar('name') : $uname;
		$this->email           = $user[0]->getVar('email');
	}

}
?>