Access Callback user_is_anonymous与之相反? [英] What is the opposite of Access Callback user_is_anonymous?

查看:137
本文介绍了Access Callback user_is_anonymous与之相反?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这是用在一个drupal模块来指定只有匿名用户可以看到该模块。什么是回调,仅指定登录用户?



我有一个页面,我只想访问登录的用户。



谢谢

解决方案

这是 user_is_logged_in()功能,它基本上检查用户的ID($ GLOBALS ['user'] - > uid)大于零。



该函数将uid转换为布尔类型,并为任何登录的用户返回TRUE,因为它们的uid为正数。 Drupal将匿名用户分配为0,在转换为布尔值时为FALSE。


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

解决方案

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.

这篇关于Access Callback user_is_anonymous与之相反?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆