User

Official Documentation: https://docs.joomla.org/Accessing_the_current_user_object

Get the User

$user = JFactory::getUser();

// eg. details of the user
echo $user->id;
echo $user->email;
echo $user->username;

// check if the user is logged in
if($user->guest){echo "the user is not logged in";}

// get the ids of the user's usergroups
$groups = JUserHelper::getUserGroups($user->id);