drupal技巧:定制登录表单

drupal的用户登录在很多情况下要根据网站的设计来做调整,那么如何用PHP创建区块来方便的实现呢?下面是关于drupal5,drupal6中修改用户登录表单的代码:

drupal5

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

drupal6

<?php
global $user;
//added: redirect to previous page
$redirect = 'destination='.drupal_get_path_alias(substr(urldecode(drupal_get_destination()), 12) );
if ($user->uid) {
$edit_account_link = l(t('Your Account'), 'user/'.$user->uid.'/edit');
//changed this
  $logout_link = l(t('Logout'), 'logout',
               array( 'query' => $redirect, 'alias' => TRUE )
               );
  $user_utilities = t('Welcome back, ') . $user->name. '. 
' . $edit_account_link . t(' | ') . $logout_link; } else { //changed this $login_link = l(t('Login'), 'user', array( 'query' => $redirect, 'alias' => TRUE ) ); //changed this $register_link = l(t('Register'), 'user/register', array( 'query' => $redirect, 'alias' => TRUE ) ); $user_utilities = $login_link . t('/') . $register_link; } $search_link = l(t('Search'), 'search/node'); return $user_utilities . t(' | ') . $search_link; ?>

Syndicate content