I have a client who has requested a dedicated form for managing the user's picture be made available from a local task within the user/#uid/edit context. The following menu item does this for the most part:
Menu item code:
$items['user/%user/edit/picture'] = array(
'title' => 'Picture',
'page callback' => 'drupal_get_form',
'page arguments' => array('tpp_picture_form', 1),
'access callback' => 'user_edit_access',
'access arguments' => array(1),
'type' => MENU_LOCAL_TASK,
);
... but not when visiting the actual "Picture" page. When on the "Picture" page, no local tasks are shown.
Please see account.jpg, athelete.jpg and picture.jpg below for examples if the local tasks showing and not showing.
Many other local tasks successfully appear on different pages. The only difference between the "Pictures" menu item and the rest is the Wildcard Loader Argument used: Pictures uses user_load() whereas the others use user_category_load(). Could this be where the issue is coming from?
| Comment | File | Size | Author |
|---|---|---|---|
| picture.jpg | 8.39 KB | Ryan Palmer | |
| athlete.jpg | 15.9 KB | Ryan Palmer | |
| account.jpg | 14.64 KB | Ryan Palmer |
Comments
Comment #1
vito_a commentedI'm not sure exactly which picture upload form you are using, but trying to guess - shouldn't the url of your form be something like 'user/%user/edit/picture/tpp_picture' ? Probably the 'user/%user/edit/picture' url is already belong to the core user.module or upload.module or something like acidfree gallery module, so it doesn't shows no yours local task on this page. Can you look is there a 'user/%user/edit/picture' local task at 'user/%user/edit' page which is upper one level - which form does it go to?
Comment #2
guypaddock commentedI am seeing a similar bug that is not at all related to pictures or the user or upload modules.
See my comment in the "Wildcard Loader Arguments" section of the "Developing for Drupal" manual:
http://drupal.org/node/224170#comment-1464830
Do local tasks support wildcard paths?
Comment #3
Florent Jousseaume commentedI also have a problem with that.
My edit's tab disappear when I create a new URL like user/%/toto/tata.
user/%/toto works and my edit's tab is always visible, but if I add an argument to toto, the edit's tab disappear. After a little search in user.module, it seems to be the user_category_load (wildcar %user_category on edit item menu) function who breaks my tab. This function is for user/%/edit arguments, because he ignores the second and third arguments for URL, and check the new argument in a list of category, but it also check for other url.
What can I do to keep my edit's tab ?
Comment #4
Ryan Palmer commentedRe: #1
The user/%user/edit/picture path points towards a totally custom form. I don't believe Acidfree albums or any other such modules are in use.
Comment #5
elvis2 commentedDo you have the profile module turned on? If so you may need to use the user_category_load() function...
Do a quick bug test, turn off the profile module and then go back to load your picture tab, it might work...
Comment #6
Ryan Palmer commentedHmm yes that probably has something to do with it. I'll check with the client to see if I can go ahead with such test.
Assuming it does, though.. would that be considered a bug with the profile_menu()? or menu system itself? Shouldn't this type of behaviour be allowed?
Comment #7
coreyp_1 commentedthere is a workaround for this, in case anyone else is having this problem.
whatever arg(3) is must also be listed as a category under hook_user().
For example, if your path is
user/1/edit/foo, then your hook_user() must contain something like this:I hope it saves someone else some time!
Comment #8
johnhanley commentedHas anyone found a proper solution to the mysterious vanishing user "Edit" tab?
My situation is a little different, but the same problem is occurring.
I have 3 sub-tabs appearing under a MENU_LOCAL_TASK menu item called "Ledger":
Condensed (MENU_DEFAULT_LOCAL_TASK)
Expanded (MENU_LOCAL_TASK)
Summary (MENU_LOCAL_TASK)
The user "Edit" tab appears as expected when "Condensed" is shown, but disappears when either "Expanded" or "Summary" is selected.
Here's the actual code. The functionality tied to the menu items works as expected--only the "Edit" tab appears/disappears. I should add that this structure works as expected under Drupal 5 (with the appropriate syntax changes of course.)
Comment #9
johnhanley commentedI spent considerable time today investigating this issue and didn't make any progress. This seems to be a legitimate bug that still exists as of version 6.15.
To recap the issue: the user "Edit" tab appears as expected when the default secondary (MENU_DEFAULT_LOCAL_TASK) menu tab is selected, but disappears when any other secondary (MENU_LOCAL_TASK) menu tab is selected.
Comment #10
rizqi commentedsame problem here, iam using drupal 6.15
anyway solution at #7 is working with my module, thanks!
Comment #11
nagarajugoli commentedif #7 solutions not working you can customize above code like this
Comment #12
nagarajugoli commented#7 is Good solutions , i wasted one day, after seeing u r code , i have fixed my bug . see above my code
Comment #13
extect commentedactually, we do not have a real solution to the problem, just workarounds. Still an issue in 6.16
Comment #14
mr.baileysCan you try adding
'tab_parent' => 'user/%/edit',to your menu item(s)? That should fix the issue, if not please re-open.Comment #15
johnhanley commentedThe issue described in my above previous post seems to have been fixed as of 6.17. Or at least it's no longer a problem for me as of 6.17.
Comment #17
sansui commentedThe code in #7 is the only workaround that worked for me. tab parent did nothing... it seems that under the "edit" tab in the profile area, you MUST go through hook_user or the menu won't function properly.
I do have another issue though... how can I assign multiple items in the categories array. I have a module that needs two menu items created, and trying to do categories[0], categories[1] etc doesn't seem to work
Comment #18
sansui commentedI was incorrect, I was able to assign multiple categories arrays like categories['mybilling'] and categories['myorders'], without issue, and place them in sub menu of the "Edit" tab in the user profile area. Unfortunately, it does seem impossible to include the menu on content that is 'deeper' down than the third argument.
Like user/3/edit/mybilling - this menu system works fine after adding the hook_user kludge
But user/3/edit/mybilling/order/3 - loses the tab menus completely