Drupal hook_user 似乎没有在模块中触发
我有一个自定义模块,我想在其中将一些与使用相关的数据从 profile.module 加载到 $_SESSION 中。
function fps_session_user($op, &$edit, &$account, $category = NULL) {
if ($op == 'login') {
global $user;
profile_load_profile($user);
$_SESSION['branch'] = $user->profile_branch;
watchdog('session', 'User Profile loaded');
}
}
但这似乎永远不会火。有人有什么想法吗?
I have a custom module, in which I want to load some use related data into $_SESSION from the profile.module.
function fps_session_user($op, &$edit, &$account, $category = NULL) {
if ($op == 'login') {
global $user;
profile_load_profile($user);
$_SESSION['branch'] = $user->profile_branch;
watchdog('session', 'User Profile loaded');
}
}
but this never seems to fire. Anyone have any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
同一模块中的其他挂钩是否有效?我对钩子函数的名称有一些奇怪的问题。确保该模块确实已启用。在函数顶部甚至在 if 语句之前尝试看门狗消息,以尽可能简化,看看是否调用了钩子。
are other hooks that you have in the same module working? I've had weird issues with the names of the hook functions. Make sure that the module is actually enabled. at the top of the function even before the if statement try a watchdog message there, to simplify as much as possible, see if the hook is even being called.