You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can also get user's fields (if the user is logged in), like email:
echo$this->zfcUserIdentity()->getEmail(); ?>
Controller
ZfcUser provides a Controller Plugin (zfcUserAuthentication) which you can use from any controller in your application. You can check if the user is connected and get his data:
if ($this->zfcUserAuthentication()->hasIdentity()) {
//get the email of the userecho$this->zfcUserAuthentication()->getIdentity()->getEmail();
//get the user_id of the userecho$this->zfcUserAuthentication()->getIdentity()->getId();
//get the username of the userecho$this->zfcUserAuthentication()->getIdentity()->getUsername();
//get the display name of the userecho$this->zfcUserAuthentication()->getIdentity()->getDisplayname();
}
?>
You can get the zfcuser_auth_service in a controller by doing: