drupal的用户登录在很多情况下要根据网站的设计来做调整,那么如何用PHP创建区块来方便的实现呢?下面是关于drupal5,drupal6中修改用户登录表单的代码:
<?php
global $user;
if ($user->uid) {
print l("Log Out " . $user->name,"logout");
} else {
print drupal_get_form('user_login_block');
}
?>
<?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;
?>
1 小时 54 分钟之前
1 小时 55 分钟之前
5 小时 58 分钟之前
5 小时 59 分钟之前
6 小时 41 分钟之前
7 小时 7 分钟之前
7 小时 9 分钟之前
11 小时 7 分钟之前
6 天 9 小时之前
1 周 2 天之前