Here's a bit of code you might add that does two things:
First, changes the titles of the login, password recovery, and registration pages from the generic "User Account" to more meaningful titles.
Supports custom login pages by doing the following:
- Adds a template suggestion that allows a page-login.tpl.php file located in a theme to supply a custom login page. E.g. no navbar or other info you don't want to expose to anonymous folks, specific support info, etc.
- Adds a $login_section variable to the template variables to make it easy to have section level customized text. This has three values: login, recovery, and register.
/**
* Implementation of hook_preprocess_page()
*
* Make template suggestion and changes titles on various pages.
*
* @param $variables
* @return unknown_type
*/
function secure_site_preprocess_page( &$variables ) {
global $user;
// log_debug("Preprocess page called with arg0=" . arg(0) . " arg1=" . arg(1) .
// " arg2=" . arg(2) . " uid=" . $user->uid );
if ( ! $user->uid && arg(0) == 'user' &&
(! arg(1) || arg(1) == 'password' || arg(1) == 'register')) {
$variables['template_files'][] = "page-login";
switch ( arg(1) ) {
case 'password':
$variables['title'] = t("Password Recovery");
$variables['login_section'] = "recovery";
break;
case 'register':
$variables['title'] = t("User Registration");
$variables['login_section'] = "register";
break;
default:
$variables['title'] = t("User Login");
$variables['login_section'] = "login";
}
}
}
Quick and dirty sample page-login.tpl.php based on garland's page.tpl.php.
<?php
/**
* All the normal template vars + $login_section available.
*
* $login_section = ( 'login' || 'recovery' || 'register' )
* $content will have the form related to the section.
*/
?>
<html>
<head>
<?php print $head; ?>
<title><?php print $head_title; ?></title>
<?php print $styles; ?>
<?php print $scripts; ?>
<script type="text/javascript"><?php /* Needed to avoid Flash of Unstyled Content in IE */ ?> </script>
</head>
<body class="<?php print $body_classes; ?>">
<div id="page" class="login-page">
<div id="header">
<div id="logo-title">
<?php if (!empty($logo)): ?>
<a href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>" rel="home" id="logo">
<img src="<?php print $logo; ?>" alt="<?php print t('Home'); ?>" />
</a>
<?php endif; ?>
<div id="name-and-slogan">
<?php if (!empty($site_name)): ?>
<h1 id="site-name">
<a href="<?php print $front_page ?>" title="<?php print t('Home'); ?>" rel="home"><span><?php print $site_name; ?></span></a>
</h1>
<?php endif; ?>
<?php if (!empty($site_slogan)): ?>
<div id="site-slogan"><?php print $site_slogan; ?></div>
<?php endif; ?>
</div> <!-- /name-and-slogan -->
</div> <!-- /logo-title -->
<?php if (!empty($header)): ?>
<div id="header-region">
<?php print $header; ?>
</div>
<?php endif; ?>
</div> <!-- /header -->
<div id="container" class="clear-block">
<div id="main" class="column"><div id="main-squeeze">
<div id="content-content" class="clear-block">
<?php if ( $login_section == 'login' ) : ?>
<div class='login-info'>Welcome! Please enter your user id and password below</div>
<?php elseif ( $login_section == 'recovery' ) : ?>
<div class='login-info'>Please enter the e-mail address of your account.</div>
<?php else: ?>
<div class='login-info'>Please fill out the form below to start the registration process.</div>
<?php endif; ?>
<div id="login-form">
<?php print $content; ?>
</div>
</div> <!-- /content-content -->
<?php print $feed_icons; ?>
</div> <!-- /content -->
</div></div> <!-- /main-squeeze /main -->
</div> <!-- /container -->
<div id="footer-wrapper">
<div id="footer">
<?php print $footer_message; ?>
<?php if (!empty($footer)): print $footer; endif; ?>
</div> <!-- /footer -->
</div> <!-- /footer-wrapper -->
<?php print $closure; ?>
</div> <!-- /page -->
</div>
</body>
</html>
Comments
Comment #1
bobooon commentedI like this. In addition to the template suggestion I will add the ability to toggle that functionality on and off. Some may want the full theme to show on there login/register/recovery pages. I'll include a very simple page-login.tpl.php with the module as well.
Comment #2
bobooon commentedDrupal 6 EOL is February 26, 2016. For that reason, Drupal 6.x version of this module is no longer supported.