<?php // Check if the user is logged in if (!Yii::$app->user->isGuest) { // Get the user identity object $identity = Yii::$app->user->identity; // Access the email attribute $userEmail = $identity->email; // Use the email address echo '<ul class="list-group list-group-flush">'; echo '<li class="list-group-item" style="padding: 3px 5px;font-size: 80%;"><span>'. $userEmail.'</span></li>'; echo '<li class="list-group-item text-center " style="padding: 1px 5px;font-size: 80%;"><a href="/default/en-US/nav6h0/s/Logout/?r=site%2Flogout"> Logout </a></li></ul>'; } ?>