[development] user_roles() at hook_boot()

Lluís enboig at gmail.com
Tue Jan 12 14:37:37 UTC 2010


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 at 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.


More information about the development mailing list