Skip to content

Instantly share code, notes, and snippets.

@ScarletPonytail
Created March 14, 2018 11:46
Show Gist options
  • Save ScarletPonytail/92b525a470ed62aad871393f953e04a7 to your computer and use it in GitHub Desktop.
Save ScarletPonytail/92b525a470ed62aad871393f953e04a7 to your computer and use it in GitHub Desktop.
Drupal - If user logged in
<ul class="menu">
<?php
if (user_is_logged_in()) {
echo "Logged In";
echo '<li class="last leaf"><a href="/drupal-playground-7/user/logout" class="log-out">Log out</a></li>';
}
else {
echo "Not logged in";
echo '<li class="last leaf"><a href="/drupal-playground-7/user" class="log-in">Log in</a></li>';
}
?>
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment