user_roles() at hook_boot()
I need to check roles for a permission at hook_boot; but I recive a "Fatal error: Call to undefined function user_roles()". Is it possible that user_roles() is not defined at hook_boot? or am I missing something else? thanks. -- *Les normes hi són perquè hi pensis abans de saltar-te-les *La vida és com una taronja, què esperes a exprimir-la? *Si creus que l'educació és cara, prova la ignorància. *La vida és com una moneda, la pots gastar en el que vulguis però només una vegada. *Abans d'imprimir aquest missatge, pensa en el medi ambient.
Move this check to hook_menu() or is too much later ? Paolo Mainardi CTO Twinbit http://www.paolomainardi.com Il giorno 12/gen/2010, alle ore 13.56, Lluís <enboig@gmail.com> ha scritto:
I need to check roles for a permission at hook_boot; but I recive a "Fatal error: Call to undefined function user_roles()". Is it possible that user_roles() is not defined at hook_boot? or am I missing something else?
thanks.
-- *Les normes hi són perquè hi pensis abans de saltar-te-les *La vida és com una taronja, què esperes a exprimir-la? *Si creus que l'educació és cara, prova la ignorància. *La vida és com una moneda, la pots gastar en el que vulguis però només una vegada. *Abans d'imprimir aquest missatge, pensa en el medi ambient.
user_roles isn't loaded yet, but the global $user is populated and the roles are stored inside of that as an array, so you can do it as hook_boot, but you need to manually check the roles. Jamie Holly http://www.intoxination.net http://www.hollyit.net On 1/12/2010 7:56 AM, Lluís wrote:
I need to check roles for a permission at hook_boot; but I recive a "Fatal error: Call to undefined function user_roles()". Is it possible that user_roles() is not defined at hook_boot? or am I missing something else?
thanks.
at hook_menu is too late; I am implementing a module which give roles to $user depending on $_SESSION and permissions for that role. I copy&pasted user_roles() inside my function, removing the code I don't need, and now it works. Thanks On Tue, Jan 12, 2010 at 2:55 PM, Jamie Holly <hovercrafter@earthlink.net> wrote:
user_roles isn't loaded yet, but the global $user is populated and the roles are stored inside of that as an array, so you can do it as hook_boot, but you need to manually check the roles.
Jamie Holly http://www.intoxination.net http://www.hollyit.net
On 1/12/2010 7:56 AM, Lluís wrote:
I need to check roles for a permission at hook_boot; but I recive a "Fatal error: Call to undefined function user_roles()". Is it possible that user_roles() is not defined at hook_boot? or am I missing something else?
thanks.
-- *Les normes hi són perquè hi pensis abans de saltar-te-les *La vida és com una taronja, què esperes a exprimir-la? *Si creus que l'educació és cara, prova la ignorància. *La vida és com una moneda, la pots gastar en el que vulguis però només una vegada. *Abans d'imprimir aquest missatge, pensa en el medi ambient.
participants (3)
-
Jamie Holly -
Lluís -
Paolo Mainardi