访问回调 user_is_anonymous 的反义词是什么?

发布于 2024-09-06 04:51:47 字数 94 浏览 1 评论 0原文

我知道在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

旧时光的容颜 2024-09-13 04:51:48

它是 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文