Patch (to be ported)
Project:
Menu Access
Version:
6.x-1.8
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Reporter:
Created:
8 Jun 2010 at 19:37 UTC
Updated:
28 Jan 2011 at 21:06 UTC
Enable per menu access control settings is checked
Enable per menu item access control settings is checked
At the Menu level
Role Access is set to view for the menu.
Username is not placed under Grant for viewing at the menu level
At the Menu Item level
Role access is set to not view
Username is added to the Grant view access
When calling menu_access_menu_tree('custom-menu') it does not show the item.
If Role access is set to view for the item the item shows.
Comments
Comment #1
webternals commentedSo I did some diggin' on my own and so far here is what I have
The above code (Notice I added the echo sprintf so I could see what was happing here) echos the follwing:
SELECT * FROM {menu_item_access_user} WHERE mlid = '854' AND uid = 0
But a quick look in the DB (By the way I only have one user, and one menu item I am trying this with so there is only one DB entry, yes I have several users but for this I have a test user specifically for this test and there id really is 9 not 0 )
SELECT * FROM menu_item_access_user m LIMIT 0,1000
gives me
mlid | uid .......
854 | 9
I'll stop here: I know that I am logged in as the correct user but for some reason the uids are not matching up.
If I had to guess I would say
$account = $user;
is the culprit here.
I'll keep digging but wish I could get some help.
Comment #2
webternals commentedOK so now I am on step closer to solving this issue and I am not even a member, contributor, or co-maintainer to this project. Is this project active? If the project is abandoned? Any way here is what I have found I added some more Debug code and here is what I have come up with the following function yields this result. What I can deduct is that what is being passed in as $account is supposed to be an object because the developer uses $account->uid, but in fact what gets passed in as account is the actual uid of the user and not an object. I am going to devise a quick fix that will work until the developer(s) can solve this in a "more correct fashion".
Result
$account: 9
$user:
$account->uid:
$user->uid:
Function
Comment #3
webternals commentedSo here is what I came up with as a quick fix. I have taken into account the the $account could be an object as the developer wrote the code to start with or $ account not being an object like it is currently being passed into the function for this particular usage. Also by taking both instances into consideration the code should be compatible with both type of usage cases.
Comment #4
emptyvoid commentedThanks for your research I will review and provide feedback and or incorporate it into the next release.
Comment #5
emptyvoid commentedThanks webternals I've committed your changes to the dev branch and if everything checks out I'll add it to the (long overdue) next release.
Comment #6
emptyvoid commented