How to check user logged-in or not in Social engine

For checking the user is logged-in or not in social engine you need to follow these following steps:

1.) First need to get the viewer using the following code

$viewer = Engine_Api::_()->user()->getViewer();

2.) After getting the user you can check the user Identification using the following code

if(!$viewer->getIdentity()) {
   echo "User is not logged-in";
}else {
   echo "User is logged-in";

Post a comment