Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Vokuro how to get data from actual logged user in view ... using volt

Hi everybody,

I am using vokuro and volt.

The login module is still the vokuro standard, but how can I set the user data into multiple views?

something like:


doesn't work.

public function loginAction()
        $form = new LoginForm();

        try {

            if (!$this->request->isPost()) {

                if ($this->auth->hasRememberMe()) {
                    return $this->auth->loginWithRememberMe();
            } else {

                if ($form->isValid($this->request->getPost()) == false) {
                    foreach ($form->getMessages() as $message) {
                } else {

                        'email' => $this->request->getPost('email'),
                        'password' => $this->request->getPost('password'),
                        'remember' => $this->request->getPost('remember')

                    return $this->response->redirect('users');
        } catch (AuthException $e) {

        $this->view->form = $form;



edited Sep '15

the idea is:

your "auth" inside the controllers is vokuro/app/library/Auth/Auth.php

now.... inside you have getUser() function

it will return instance of Vokuro\Models\Users and i think should be linked with profile model also.

so in your controller view you should be able to call


// i am new to phlacon so please dont curse me if it doesnt work :D

edited Sep '15

If you want user in view first you have to set user in view, you can do it by two ways:

Set it using properties(i dont like it myself) like this:

$this->view->user = $youruser;

or using ->setVar('user',$youruser);

Then it will be available in your view.

If user is stored in form then just access user like {{}}

edited Sep '15

Hi Hristomir, hi Jurigag,

I am new to phalcon and I need an example, do you have one?

The users are not stored in an form, should I do that?

The is not important to display, it is only an example. I need multiple mysql tables to display in different views e.g. region, country, user etc. in sedcard.phtml, gallery.phtml etc.



edited Sep '15

Something like that should work:

$this->view->user = $this->auth->getUser();



if $this->auth not working then try $this->di->get('auth')

edited Sep '15

Hi Jurigag,

damn i was in the totaly wrong controller :-))))))

Now it works ;-) I have lost my overview

I set it in the indexAction of the ProfileController.php for the view profile/index.volt. Is that ok?

public function indexAction(){

Thx Jurigag for your time