Home » Mix » Cakephp check if user is logged or not

Cakephp check if user is logged or not

How to check if user is logged or not in the view or controller in cakephp.Very simple.Look at this function.It will return current logged user details.So you can check this by using user ID or user name to if user logged or not.

In the controller,

In the view,

This is a another way to check this in the view.

Also you can use this simply as following.Before you must set this,

Now check like this,

Tags