views:

131

answers:

1

I can get the username by doing this:

public function indexAction()
{
    $this->view->username = Zend_Auth::getInstance()->getIdentity();
}

"username" is the column in the table that validates the identity. "firstname" is also a column in that table. Does Zend_Auth only store the username? Or is there a way to access other columns from the user's row in the table?

+2  A: 

So you're using a DbTable adapter, right. And are you retrieving the table row after authentication like so:

$authAdapter->getResultRowObject()

Then yes, the whole user-row is available. Just try!

From the manual:

In addition to the availability of the getIdentity() method upon the authentication result object, Zend_Auth_Adapter_DbTable also supports retrieving the table row upon authentication success:

// Print the identity
echo $result->getIdentity() . "\n\n";

// Print the result row
print_r($authAdapter->getResultRowObject());

/* Output:
my_username

Array
(
    [id] => 1
    [username] => my_username
    [password] => my_password
    [real_name] => My Real Name
)
*/

Or see for yourself!

tharkun