why?
because then you can add two menu items to your menu(s),
first one is log in the second one is log out
--> and the user does only see the one which is important for him
without this patch the users sees log in the whole time...
imho this is more consistent than the old approach, which looks a little bit like a hack...
btw. the patch is against drupal 4.7 but the changes are small so it should apply...
| Comment | File | Size | Author |
|---|---|---|---|
| #14 | user_login.patch_drupal5.patch.txt | 2.35 KB | Tobias Maier |
| #9 | user_login.patch_1.txt | 2.03 KB | Tobias Maier |
| #5 | user.patch_9.txt | 1.71 KB | Tobias Maier |
| #1 | user_login.patch_0.txt | 1.25 KB | Tobias Maier |
| user_login.patch.txt | 1.61 KB | Tobias Maier |
Comments
Comment #1
Tobias Maier commented*argh*
Comment #2
drummWhat is the second hunk needed for? I think the form's #action should be fine as is.
Comment #3
Tobias Maier commentedargh - this was a left over, too
such a small patch and such a lot of stupidness (new word ;) ) in my brain...
Comment #4
moshe weitzman commentedcould be even briefer. 'access' => $user->uid is enough though perhaps not as semantically correct?
Comment #5
Tobias Maier commentedtrue, but I read $user->uid == 0 somewhere in the code of the user module so I copy-pasted it...
I replaced the other one with the right one...
shoud work the same way
Comment #6
halkeye commented'access'=> $user->uid would be true for all logged in users, false for logged out
isn't that the reverse of the desiered behavior?
Comment #7
Tobias Maier commentedread again
if you look closely at the sourcecode you can see the
!in front of $userthis means if $user->uid == true, means everything else than 0 then give back the opposite
this means it gives back false...
Comment #8
halkeye commentedsorry, i should have explicitly said so
i was talking about moshe's comment
Comment #9
Tobias Maier commentedI was confused
is needed, because without this drupal tries to go back to /user/login after you hitted login
but this path isn't accessible anymore
so we send him to /user and he sees the same as before, his profile
Comment #10
dries commentedAFAIK, you shouldn't use $user in the $may_cache-section of user_menu().
Also, if it is an invalid menu callback, it is better not to register it. The menu system isn't the fastest thing on earth.
Comment #11
Steven commentedDries: Sure you can use $user... how else would user_access() calls work in hook_menu? The menu cache is done per user:
I don't particularly mind this patch, though I'm not sure I see the benefit. If I point my browser to drupal.org/user/login, I'm just redirected to my own user page.
Comment #12
Tobias Maier commentedsteven:
add a login menu entry and a logout menu entry to your menu, for example the primary menu
then log out, you see the just the log in entry, the log out entry is hidden
then log in. you see both entries, but for what do I need a menu entry called "log in" at this state?
so it needs to be hidden
Comment #13
dries commentedSteven: I think they want the 'login' menu item to automagically disappear from their menus.
Comment #14
Tobias Maier commenteda few months later i ask you to review this patch again.
You can call it a bug, too.
Because it is a menu-definied path which hasn't 'access' set properly.
here comes the drupal 5 version of this patch
not really tested (i got my notebook back from ASUS service yesterday and have to reinstall everything.. - this means I dont have a webserver running on my machine atm)
Comment #15
Tobias Maier commentedComment #16
Tobias Maier commentedPatch for Drupal 5.0 tested - works as expected
Comment #17
killes@www.drop.org commentedmoving to HEAD to get more reviews.
Comment #18
dries commentedCommitted to CVS HEAD. Thanks.
Comment #19
(not verified) commented