displaying all menus regardless of access

View: New views
7 Messages — Rating Filter:   Alert me  

displaying all menus regardless of access

by Ashraf Amayreh :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello all,

I guess my question is pretty simple. I've run into a scenario where a site wants all primary menu items to show up regardless of access rights. When a user clicks on the menu item, he would get a message saying he needs to register to see this page. Is this possible at all? I know that the primary menu items disappear when they're inaccessible.

Thoughts?

I guess the 2nd part of the question is, my module for 5.x used to render the complete menu (honoring menu access rights) to create a DHTML menu. But now in Drupal 6 it seems there's no way to get inside collapsed menu items. Am I missing something? How can I get the full tree rendered regardless of its state (collapsed or not)?

Thanks!
--
Ashraf Amayreh
http://aamayreh.org

Re: displaying all menus regardless of access

by Brian Vuyk-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

With respect to the first part of your post, there is one way I can think of to accomplish this:

If you create each menu item as an absolute link (e.g., http://www.example.com/node/1), it bypasses the access checks. This is technically a bug; it's in the tracker, and will likely be fixed for D7. However, it works for now.

It would be nice to see an option for menus such as 'Hide links unavailable to user' or similar that allowed the access-based showing and hiding of menu items.

--
Brian Vuyk
Web Design & Development
T: 613-534-2916
Skype: brianvuyk
brian@... | http://www.brianvuyk.com

On 06/14/2009 04:32 PM, Ashraf Amayreh wrote:
Hello all,

I guess my question is pretty simple. I've run into a scenario where a site wants all primary menu items to show up regardless of access rights. When a user clicks on the menu item, he would get a message saying he needs to register to see this page. Is this possible at all? I know that the primary menu items disappear when they're inaccessible.

Thoughts?

I guess the 2nd part of the question is, my module for 5.x used to render the complete menu (honoring menu access rights) to create a DHTML menu. But now in Drupal 6 it seems there's no way to get inside collapsed menu items. Am I missing something? How can I get the full tree rendered regardless of its state (collapsed or not)?

Thanks!
--
Ashraf Amayreh
http://aamayreh.org

Re: displaying all menus regardless of access

by Karoly Negyesi :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Going  around the menu system is almost the surefire way too secholes.

Putting up a smart 403 page, however, is the solution for your
problem. Check whether you are on one of the primary links (quick
cheap query, i guess) and act accordingly.

Re: displaying all menus regardless of access

by Arancaytar Ilyaran :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ashraf Amayreh wrote:
> I guess the 2nd part of the question is, my module for 5.x used to
> render the complete menu (honoring menu access rights) to create a DHTML
> menu. But now in Drupal 6 it seems there's no way to get inside
> collapsed menu items. Am I missing something? How can I get the full
> tree rendered regardless of its state (collapsed or not)?

menu_tree_all_data(). I used this same function when I ported
http://drupal.org/project/dhtml_menu to Drupal 6.

--
eternity lies ahead of us, and behind.
have you drunk your fill?
         * * *
PGP:   http://ermarian.net/downloads/0x27CA5C74
XMPP:  arancaytar.ilyaran@...
AOL:   282026638 @icq / RealArancaytar @aim
URL:   http://ermarian.net

Re: displaying all menus regardless of access

by Ken Rickard :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I just want to second the custom 403 handler approach. I have done
that before, and the menu query check would be easy (check the
$_GET['q'] against {menu_links}.link_path and account for aliasing.

And you avoid security risks.


On Mon, Jun 15, 2009 at 3:06 AM, Arancaytar
Ilyaran<arancaytar.ilyaran@...> wrote:

> Ashraf Amayreh wrote:
>> I guess the 2nd part of the question is, my module for 5.x used to
>> render the complete menu (honoring menu access rights) to create a DHTML
>> menu. But now in Drupal 6 it seems there's no way to get inside
>> collapsed menu items. Am I missing something? How can I get the full
>> tree rendered regardless of its state (collapsed or not)?
>
> menu_tree_all_data(). I used this same function when I ported
> http://drupal.org/project/dhtml_menu to Drupal 6.
>
> --
> eternity lies ahead of us, and behind.
> have you drunk your fill?
>         * * *
> PGP:   http://ermarian.net/downloads/0x27CA5C74
> XMPP:  arancaytar.ilyaran@...
> AOL:   282026638 @icq / RealArancaytar @aim
> URL:   http://ermarian.net
>



--
Ken Rickard
agentrickard@...
http://ken.therickards.com

Re: displaying all menus regardless of access

by Karoly Negyesi :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, Jun 15, 2009 at 7:58 AM, Ken Rickard<agentrickard@...> wrote:
> I just want to second the custom 403 handler approach. I have done
> that before, and the menu query check would be easy (check the
> $_GET['q'] against {menu_links}.link_path and account for aliasing.

$_GET['q'] is unaliased during bootstrap and link_path is not aliased
either. I am unsure what you mean by account for aliasing.

Re: displaying all menus regardless of access

by Ken Rickard :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Just that node/6 might be mapped to 'thislink'. If it is not a
concern, then there is no problem.

On Mon, Jun 15, 2009 at 11:46 AM, Karoly Negyesi<karoly@...> wrote:
> On Mon, Jun 15, 2009 at 7:58 AM, Ken Rickard<agentrickard@...> wrote:
>> I just want to second the custom 403 handler approach. I have done
>> that before, and the menu query check would be easy (check the
>> $_GET['q'] against {menu_links}.link_path and account for aliasing.
>
> $_GET['q'] is unaliased during bootstrap and link_path is not aliased
> either. I am unsure what you mean by account for aliasing.
>



--
Ken Rickard
agentrickard@...
http://ken.therickards.com