Zend framework: how to get user id form zend auth to zend form

3.2k views Asked by At

I have a form comment. I want to get the user ID from Zend_Auth to insert into my database. How can I do it?

1

There are 1 answers

0
burntblark On

If Zend_Auth has been instantiated, then:

  1. Get an instance of it:
    $auth = Zend_Auth::getInstance();

  2. Get the identity you must have stored on authentication success:
    $identity = $auth->getIdentity();

  3. Use the identity according to the model of what you stored.