webadmin's picture

Drupal 6 Custom Login in block PHP Code

Drupal

This is a very simple block to display a link to the login page when the user is not logged in and to display a logout link when the user is logged in. Create a custom block and set the input filter to php.

<?php
global $user;
if ($user->uid) {
print l("Log Out " . $user->name,"logout");
} else {
print drupal_get_form('user_login_block');
}
?>