访问回调 user_is_anonymous 的反义词是什么?
我知道在 drupal 模块中使用它来指定只有匿名用户才能看到该模块。仅指定登录用户的回调是什么?
我有一个页面,我只想让登录用户访问。
谢谢
I know that is used in a drupal module to specify that only anonymous users can see that module. What would be the callback that specifies only logged in users ?
I have a page that I only want accessible to logged in users.
Thank You
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它是 user_is_logged_in() 函数,它基本上检查用户的 ID ( $GLOBALS['user']->uid) 大于零。
该函数将 uid 转换为布尔类型,并为任何登录的用户返回 TRUE,因为他们的 uid 为正数。 Drupal 为匿名用户分配一个 uid 0,转换为布尔值时为 FALSE。
It is the user_is_logged_in() function, which basically checks that the user's ID ($GLOBALS['user']->uid) is greater than zero.
The function converts the uid into a Boolean type and returns TRUE for any user that is logged in, because they would have a uid that is a positive number. Drupal assigns anonymous users a uid of 0, which is FALSE when converted into a Boolean.