[development] Blocks and page context

Khalid Baheyeldin kb at 2bits.com
Sat Apr 24 05:32:44 UTC 2010


Everett,

I think if the currently logged in user does not have access to this URL,
then the page load will not reach as far as your hook_block() code.

Although, it is 10:31 pm and I am at the airport after 7 continuous days of
Drupaling, so brain is fried (in the microwave).

So better test it with some test code and see if what I said is right or
not.

On Fri, Apr 23, 2010 at 5:30 PM, E.J. Zufelt <lists at zufelt.ca> wrote:

> Good afternoon,
>
> Thanks, this was quite helpful.
>
> I notice that menu_get_item() will tell me if the current user can access
> the current menu item.  Is there a simple method to test if user0 can access
> the current menu item?  That is, regardless who the current user is, I would
> like to see if there is a function to let me know if user0 can access the
> current page, essentially a test to see if the current page is available to
> anonymous users or not.
>
> Thanks again,
>
> Everett Zufelt
> http://zufelt.ca
>
> Follow me on Twitter
> http://twitter.com/ezufelt
>
> View my LinkedIn Profile
> http://www.linkedin.com/in/ezufelt
>
>
>
> On 2010-04-23, at 12:03 PM, Daniel F. Kudwien wrote:
>
> $_GET['q'] holds the current, internal system path.
>
> menu_get_item() provides you the currently active menu router item.
>
> menu_get_object() provides you a dynamic argument context from the menu
> router item, if any.
> http://api.drupal.org/api/function/menu_get_object/6
>
> sun
>
> ________________________________
>
> From: development-bounces at drupal.org
> [mailto:development-bounces at drupal.org] On Behalf Of E.J. Zufelt
> Sent: Friday, April 23, 2010 4:49 PM
> To: development at drupal.org
> Subject: [development] Blocks and page context
>
>
> Good morning,
>
> I am building a module and invoking hook_block.  I am wondering if
> there is a way for my block to gain some context about the page on which it
> will be rendered.  Primarily I would like to know if my block can be aware
> of the URL of the page being displayed (not the http-requested URL in case
> they differ), and the access permissions of the page being displayed (not
> those of the block itself, or of the user accessing the block.
>
> Thanks,
>
>
>
>   Everett Zufelt
>
> http://zufelt.ca
>
> Follow me on Twitter
> http://twitter.com/ezufelt
>
> View my LinkedIn Profile
> http://www.linkedin.com/in/ezufelt
>
>
>
>
>
>
>
>


-- 
Khalid M. Baheyeldin
2bits.com, Inc.
http://2bits.com
Drupal optimization, development, customization and consulting.
Simplicity is prerequisite for reliability. --  Edsger W.Dijkstra
Simplicity is the ultimate sophistication. --   Leonardo da Vinci
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20100424/b79bb467/attachment.html 


More information about the development mailing list