By walker2238 on
This is driving me crazy. For the life of me I can't seem to change the edit tab (user/%/edit) to a MENU_NORMAL_ITEM type.
What am I doing wrong? I figured all that needs to be done is...
function MYMODULE_menu_alter(&$items) {
$items['user/%user_category/edit']['type'] = MENU_NORMAL_ITEM;
}
Can anyone help me please and thank you.
Comments
The user module may be a
The user module may be a heavier weight than your module. You can check the weight of the user module in the systems table.
Contact me to contract me for D7 -> D10/11 migrations.
Nope, that's not it. I can do
Nope, that's not it. I can do already make other changes like the title and such.
I don't have any suggestions
I don't have any suggestions beyond that unfortunately. It may be that Drupal won't allow you to change this particular item as it is fairly integral to the system. I have no idea though. What you are doing looks like it should work.
Contact me to contract me for D7 -> D10/11 migrations.
Cache
Try clearing the Performance Cache after you implement hook_menu_alter().
Hope it works !!!!
Have you rebuild your menu
Have you rebuild your menu after changes ?
I hope you know in place of MYMODULE is name of your custom module right?
Yeah I know, and I did. The
Yeah I know, and I did. The problem I believe might be with the wildcards. Both "user/uid" and "user/uid/edit" uses different argument functions. I'd really be interested to see if someone has done this, because I searched both on here and google and found nothing.
Ok, I'm starting to think
Ok, I'm starting to think that this isn't possible. Perhaps because other modules can add on to to edit menu, which may be the reason that "user/uid" and "user/uid/edit" use different wildcard functions?
As an alternative workaround would is be possible to alter the edit tab type to MENU_CALLBACK which would hide it but still keep the menu path and then some how create a new MENU_NORMAL_ITEM type.
Would this be possible considering I'd be using an already existing path?
I have a feeling that if you
I have a feeling that if you couldn't change it to a normal item, you aren't going to be able to change it to a menu callback either.
Contact me to contract me for D7 -> D10/11 migrations.
See that's the odd part. It
See that's the odd part. It does change. But when I change it to a normal menu item is vanishes so to speak. Pretty much the same as setting it to menu callback. As far as I understand by default the menu should appear in the main navigational menu.
Any other thoughts or
Any other thoughts or suggestions?
I'm trying to do something
I'm trying to do something similar. I want to switch the tab order of my content profile tab. I want my users to see the content profile edit as soon as they click edit, then have the option to change their account.
(Numbers or constants, nothing seems to work)
As soon as I refresh my cache, tabs disappear completely.
I think your tab disappearing was not due to correctly being identified as MENU_CALLBACK, it disappears no matter what you change it to.
In fact, If I specify it to
In fact, If I specify it to match the default (not changing anything) the tabs appear and work as expected.
^This Works
As soon as I change it, the tabs disappear.
^This Kills it
The only solution I have
The only solution I have found is to create a function to embed in the block template.
Hi Walker! Perhaps you could
Hi Walker!
Perhaps you could share your code?
Cheers,
Chris
Sorry Chris I have yet to
Sorry Chris I have yet to write anything for this but it's a fairly simple idea. You have two options. The first option is at the theme layer. you can simply hard code the edit menu link in your block template. Keeping in mind you need to strip the ul tag and then add in yourself using strip_tags(). (Remember to allow the other markup such as li, a and so on).
The problem with this method is that the edit link can only appear as the first or last list item. And if you make use of the first of last classes then you'll have to add a new class for the edit link to enable you to style your menu as normal.
The second option would be to recreate your menu using a module. This option is a cleaner way to do things. So if you know how to create a module then do it this way using hook_menu().
I'm doing stupid home renovations so my time is limited and won't be doing this myself for another week or two. If you have any troubles feel free to ask. And if you don't need this right away I'll be sure to post a solution after the renovations are complete.
Also another less drupal friendly way is to create your own function like I said before and just put it in a block. Remember to use l() to construct your links.
I've accomplished something
I've accomplished something similar doing a navigation link to the tab for the user profile page, not the regular drupal profile page but the one made with cck and content profile modules.
Here's is what i've done, first i've hidden the tab with the MENU_CALLBACK
Then i've created a menu item for the navigation menu with the two callbacks:
I use a drupal_goto to access the tab profile page not in the cleanest way maybe. I guess you can use drupal_goto directly on the page callback but i still have problems passing arguments to the page callback... well go easy on me I'm still quite a noob with Drupal :P