Closed (fixed)
Project:
Drupal core
Version:
7.x-dev
Component:
menu system
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
20 Aug 2007 at 20:38 UTC
Updated:
7 Mar 2008 at 22:51 UTC
Jump to comment: Most recent file
Comments
Comment #1
hunmonk commentedhttp://drupal.org/project/login_destination
Comment #2
keenan83 commentedYes I have tried this module befor and it doesn't do what i want.
What I would like is not have to set where they go after logging in but instead have them go to the page they visited before logging in whatever that page may have been. I cannot reproduce that with the login destination module at this time.
Comment #3
hunmonk commentedthere is currently no elegant way to support what you want via drupal core. the problem needs to be addressed there, so reassigning.
in the meantime, you might think about handliing it at the theming level.
Comment #4
pwolanin commentedThis is really a menu system usability bug. We shouldn't have to hack this at the theme level.
The attached patch would enable this for D6 - allows additional callbacks to set the link options (such as the query string).
Comment #5
pwolanin commentedor for those who prefer to have more power still...
Comment #6
pwolanin commentedor use drupal_alter if a flag is set.
Comment #7
pwolanin commentedoops - we already use drupal_alter('menu_link')
Comment #8
hunmonk commentedcode looks good. tested, and works as advertized.
Comment #9
pwolanin commentedsomething closer to the original title - the main nut to crack is the login link. Right now it a link to /user can *never* be added or edited via menu module since the access check is via function user_is_anonymous(), and there is no way to return the user to the page they logged in from.
Comment #10
pwolanin commentedso I think this patch does it.
Comment #11
hunmonk commentedcode looks good. i gave this a pretty thorough workover, testing the editing/enabling/disabling of the menu item, the accessibility of the login item as both an auth and anon user, and the destination functionality. all works flawlessly.
one question: are we creating any attack vectors by bypassing the anon user check like this?
Comment #12
pwolanin commentedI don't see how this could open any general security issues - the function we are bypassing is only the access check for the login and registration links. It's not generally setting the user as anonymous or with a different uid. In addition, only users with "administer menus" permission are bypassing the check in the context of listing the menu links (actually visiting that path should still give "Access denied").
Comment #13
pwolanin commentedchx says it needs more doxygen docs.
Comment #14
pwolanin commentednow with more code comments.
Comment #15
chx commentedChad tested it and I read the code and now I like it. So there.
Comment #16
dries commentedThis is not a regression, so it's a feature request. I'm going to postpone this until D7.
Comment #17
pwolanin commented@Dries - being unable to add or edit a link to the login page is a bug. I'm not sure how 5.x handles this internally, but it *is* possible to create a link to user/login.
Comment #18
chx commentedComment #19
pwolanin commentedSo, I think this is the key 5.x to 6.x difference that caused this regression: In 5.x, the menu module does no access checking or validation for the overview or edit form -
http://api.drupal.org/api/function/menu_overview_tree/5
Apparently you can also set a query string in 5.x, though again I'm not as familiar with it:
http://api.drupal.org/api/function/theme_menu_item_link/5
Comment #20
pwolanin commentedattached patch is more limited - just focuses on fixing the main D5 regression. Allows an admin to add a login link with menu module.
Comment #21
hunmonk commentednot going to re-test, since it's just a reduced version of the exact same code.
this seems like a sensible solution -- doesn't add new API functionality, and will be needed when we do fix the dynamic menu link stuff, anyways.
Comment #22
pwolanin commentedthis is now a pretty minimal patch for 6.x, and still applies cleanly.
Comment #23
dries commentedI can't help but think this looks a bit like a hack. I want to explore this a little bit better before committing this.
Comment #24
pwolanin commented@Dries - yes it's a little bit of a hack, I'll agree.
other options I've thought about:
modules could set a global flag in when presenting a menu overview that any/all access callbacks could look at.
There cold be a global flag to bypass access for all menu links (which then means we potentially lose a the feature of not showing all links to a user with "admin menus" permission)
None of these are totally satisfying.
Comment #25
gábor hojtsyDries said he would like to explore this.
Comment #26
pwolanin commentedok, a different approach suggested by chx: user #1 bypasses all acces checks, so can create/edit these links if desired.
Pro: simple
Con: user 1 will have such a login link dispalyed in their menu. they can also visit pages like user/register.
Comment #27
chx commentedI proposed this because the root user is presumed to see everything. I agree that this will make uid 1 everyday usage a bit harder but that's a good thing as uid 1 should not be used everyday.
Comment #28
catchThis was fixed in a different issue.
Comment #29
pwolanin commented@catch - can you please link to the issue where this is fixed?
Comment #30
catchSorry pwolanin, couldn't find it at the time:
http://drupal.org/node/179695
However the original feature request stands, so marking back to feature and CNW for D7.
Comment #31
pwolanin commentedbump - moshe is crying over the lack of this in 6.x
Comment #32
moshe weitzman commentedyes indeed. the lack of dynamic querystring for menu items is devastating to devel module and og (and surely many others). the functionality i really need is in #14 here. for example, devel.module has a cache clear link that really wants a destination=[back to current page] on the querystring. since that querystring is dynamic per page view, we need the alter hook proposed here. sigh. subscribe.
Comment #33
moshe weitzman commentedChange title. The still relevant part of this patch is the menu.inc hunk in #14. IT is small, but vital.
Comment #34
pwolanin commenteddue to : http://drupal.org/node/215858
you should be altering $item['localized_options'] rather than 'options'
Comment #35
pwolanin commentedhttp://drupal.org/node/218319
Comment #36
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.