What is the opposite of Access Callback user_is_anonymous?

给你一囗甜甜゛ 提交于 2019-12-13 14:40:49

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/3035132/what-is-the-opposite-of-access-callback-user-is-anonymous

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!