我想要一个阻止人们登录的权限。(因此,可以暂时阻止角色 X 的所有用户,同时保持他们的个人资料页面可用。)
Pro Drupal Development 2nd Edition 的登录过程摘录:
- 从登录表单发布
- 用户被屏蔽?
- 用户被访问控制拒绝?
我想在流程的第三步停止用户。我有一个模块:
/**
* Implementation of hook_perm().
*/
function odp_perm() {
return array('log in');
}
/**
* Implementation of hook_user
* lock out without the 'log in' permission
*/
function odp_user($op, &$edit, &$account, $category = NULL) {
if ($op == 'login' && ! user_access('log in')) {
drupal_set_message("You do not have access to log in.", "error");
drupal_goto('logout'); //doesn't work
drupal_goto('content/party-tonight'); //also doesn't work
}
}
也许我使用 drupal_goto 错误。