One of my users has a separate theme chosen other than the default system theme. When going through the site he continually sees this error:
warning: call_user_func(mytheme_menu_item_link) [function.call-user-func]: First argument is expected to be a valid callback in C:\opt\www\ mysite\sites\all\modules\special_menu_items\special_menu_items.module on line 101.
warning: call_user_func(mytheme_menu_item_link) [function.call-user-func]: First argument is expected to be a valid callback in C:\opt\www\ mysite\sites\all\modules\special_menu_items\special_menu_items.module on line 101.
I think the module tries to rely on the default theme. When this user used the Garland theme, special_menu_items tried to call the default theme's menu_item_link function instead of Garland's and it all went downhill.
Comment | File | Size | Author |
---|---|---|---|
#63 | special-menu-items-multiple-themes-bug-491184-63.patch | 2.46 KB | B-Prod |
#59 | smi.patch | 1.36 KB | andremolnar |
#58 | smi.patch | 9.8 KB | andremolnar |
#53 | special_menu_items-multiple-active-themes.patch | 1.36 KB | lourenzo |
#41 | 491184-special_menu_items-callback.patch | 1.63 KB | mrfelton |
Comments
Comment #1
redijedi CreditAttribution: redijedi commentedI forgot to mention that it prevents the rendering of the menu task items on the user-chosen theme. That's a pretty big problem.
Comment #2
jnpWebDeveloper-1 CreditAttribution: jnpWebDeveloper-1 commentedHi,
great module by the way - simple and very usefull. However I have exactly this issue but I use a default theme and garland as admin theme. Now I use _menu_item_link to modify output of the tabs on node edit pages but this causes the same error as above and I don't know how to fix it. Here is the script form template.php:
I really need to get this working. Also tried setting the main theme as the default but still have the problem.
Is there a way around this?
Thanks
J
Comment #3
tamerzg CreditAttribution: tamerzg commentedI will take a look into this. Seems like a major bug.
Comment #4
JosephH CreditAttribution: JosephH commentedI also have this problem, have a different theme as my admin theme and it messes it all up, giving lots of the same error and the menu dissappears!
Comment #5
canen CreditAttribution: canen commentedThe problem lies in the
variable_set('oldtheme_menu_item_link', $theme_overwrite);
call. It's unreliable. To fix this I generated the$theme_overwrite
variable myself. It works for themes that have one base (tested with Zen) and themes that don't use a base. I am not sure how well it works with themes whose base goes more than one up. Replace the start of thespecial_menu_itemsoverwrite_menu_item_link
function with the following and it should work.Comment #6
tamerzg CreditAttribution: tamerzg commentedThank you Canen. I will review your patch and post it with next release.
Comment #7
JosephH CreditAttribution: JosephH commentedFixed it for me!
Comment #8
BrandTim CreditAttribution: BrandTim commentedFixed it for me as well. Thanks canen.
BrandTim
Comment #9
tamerzg CreditAttribution: tamerzg commentedWill be added with next release.
Comment #10
allella CreditAttribution: allella commentedA patch based on canen's fix in #5.
Comment #12
zarudnyi CreditAttribution: zarudnyi commentedHi,
sorry for disturb but I can't start it to work on right way.
Patch from comment #10 don't solved issue.
call_user_func() [<a href='function.call-user-func'>function.call-user-func</a>]: First argument is expected to be a valid callback in /path/to/site/root/sites/all/modules/special_menu_items/special_menu_items.module on line 118.
Thanks for any help.
Comment #13
aleksey.tk CreditAttribution: aleksey.tk commentedFor me patch from comment #10 solve the issue, please commit it (or wait until someone else confirms the patch working, just to be sure)
Comment #14
davepoon CreditAttribution: davepoon commentedThe patch can not solve the issue for me.
I created a zen subtheme for the website, and use admin theme for the admin theme.
This is my error,
warning: call_user_func(zen_menu_item_link) [function.call-user-func]: First argument is expected to be a valid callback in /Applications/MAMP/htdocs/example/sites/all/modules/contrib/special_menu_items/special_menu_items.module on line 125.
Comment #15
bserem CreditAttribution: bserem commentedI have the same problem, zen with Garland as admin theme
if I chose zen as admin theme everything is ok
Comment #16
theunraveler CreditAttribution: theunraveler commented+1
Comment #17
PMatwyuk CreditAttribution: PMatwyuk commentedGetting the same error as #14.
I have a site that uses the page theme module and all pages I use the Inove theme I get the error. Please help/advise. I'm using version 6.x-1.5 of this module.
Comment #18
yul63 CreditAttribution: yul63 commentedThank you.
Just to be more specific, in special_menu_items.module replace :
by the code at # 5.
Comment #19
tdous CreditAttribution: tdous commentedWill that patch be implemented? Still missing as of 1.5.
Comment #20
DarrellDuane CreditAttribution: DarrellDuane commentedThanks for this patch, it worked well for me. I recommend it be implemented.
Comment #21
PMatwyuk CreditAttribution: PMatwyuk commentedThe patch worked perfectly for me.
Comment #22
kreynen CreditAttribution: kreynen commented+1 on this patch
Comment #23
mrfelton CreditAttribution: mrfelton commentedFollowing the instructions in #18 worked for me.
Comment #24
khaled.zaidan CreditAttribution: khaled.zaidan commentedHi guys,
Looks like the patch solved the issue. I will review it soon, and add it in the next release.
Best regards,
Khaled Zaidan
Comment #25
mariano.barcia CreditAttribution: mariano.barcia commentedI can report the patch wasn't working with older versions of the rubik&tao themes (for admin module 2.0-beta2), but now with the latest versions it's working properly. Thanks!
Comment #26
rocketfuel CreditAttribution: rocketfuel commentedI have had the same problem, and none of these fixes helped - I have sub-sub-themes of Zen, which may be why. After tearing my hair out, I finally found an easy workaround, the Menu Firstchild module http://drupal.org/project/menu_firstchild - it does the same job but doesn't cause the problems. You just change the URL of the menu item to instead of .
*Please note that this module doesn't provide the seperator.
This is my first post on a forum like this so apologies if it is in the wrong place. In my defence, I think that the info I supplied will be helpful to Special Menu Items because perhaps the Zen sub-sub-theme thing is a clue that might help solve the problem. Also, it seemed to get worse when I turned on caching, i.e. the site broke when i went live :P
Comment #27
gmclelland CreditAttribution: gmclelland commentedPatch #10 worked for me.
Comment #28
mariano.barcia CreditAttribution: mariano.barcia commentedHi there. Well, it's not working (perhaps the cache tricked me the last time I reported success with the patch).
Using admin module, with rubik/tao as the administration theme, and acquia_marina (latest version of everything), I get error on line 142 of the module.
Sorry I cannot be of help, just reporting the problem as much as I can. BTW, this has become a real "show stopper" for several of our projects :-/
I found a workaround though. I tried setting the admin theme as the system default, while leaving only acquia_marina active (the site's theme), cleared the menu cache, and now the error is gone. I prefer having to use the acquia marina as the admin's theme, than not having the nolink menu items. Any ideas?
Thanks.
Comment #29
bleen CreditAttribution: bleen commentedsubscribing
Comment #30
mshepherd CreditAttribution: mshepherd commentedpatch at #10 worked for me too.
Comment #31
shawngo CreditAttribution: shawngo commentedI ran into the same error as #28 with the Tao theme. The patch in #10 assumes it will find the function THEMENAME_menu_item_link in the foreach loop on (or around) line 97 in special_menu_items.module which Rubik (and probably others) do not.
I rick-rolled the patch (did I say that correctly?) checking for an existing function within $theme_overwrite.
Comment #32
mariano.barcia CreditAttribution: mariano.barcia commentedIt works in my installation now, thanks shawngo! Please commit.
Comment #33
cookiesunshinex CreditAttribution: cookiesunshinex commentedI'm getting this error too (using Zen as user them, and Garland as the admin theme).
I'm using the latest release, is this patch rolled into the dev?
Comment #34
Volx CreditAttribution: Volx commentedI had the same problem with a subtheme of the zen theme, patch #31 fixed it for me. Thanks!
Comment #35
cookiesunshinex CreditAttribution: cookiesunshinex commented#31 works for me too.
I'm using Zen and a custom Zen sub-theme for my main content.
I'm also using Tao and Rubik for administration theme.
Thanks!!!
Comment #36
scottrouse CreditAttribution: scottrouse commentedPatch in #31 solved my problem. I was getting errors with Root Candy.
Edit: I marked a similar issue on the Root Candy queue (http://drupal.org/node/762908) as a duplicate of this issue.
Comment #37
Daniel Norton CreditAttribution: Daniel Norton commentedThe patch at #31 doesn’t seem to match the current version. This one does.
Comment #38
Danny_Joris CreditAttribution: Danny_Joris commented#37 Thanks for the patch. I manually applied it. It looks good. The nature of the error messages is that it seemed to appear quite randomly and would disappear after a refresh, so it is difficult to tell if it actually worked. For now everything looks good. Will let you know when I encounter the error messages again.
I have the same setup as #35: Zen + Zen subtheme as main theme and Tao & Rubik as administration theme.
Thanks again!
Danny
Comment #39
mherchelManually applying the patch worked for me also. I use Rootcandy Dark as my admin theme. Thanks,
Comment #40
timofey CreditAttribution: timofey commentedFor those of you who don't know how to apply patches, open special_menu_items.module,
Replace:
With:
This is based on a patch from Post #37. It works with 6.x-1.5
Comment #41
mrfelton CreditAttribution: mrfelton commentedPatch updated against HEAD
Comment #42
gmclelland CreditAttribution: gmclelland commented#41 worked for me
Comment #43
emmajane CreditAttribution: emmajane commentedPatch at #41 also works for me.
Comment #44
scottiw2000 CreditAttribution: scottiw2000 commentedPatch at #41 worked for me too, though I'm not sure what caused the error since I wasn't using multiple themes.
Comment #45
JamesAn CreditAttribution: JamesAn commented+1 for the patch in #41. Worked for me.
Comment #46
TuFrac CreditAttribution: TuFrac commentedWhat I said in # 18 worked perfect for me rootcandy taken for administration and a theme created by me for the site.
Comment #47
alex.skrypnykCan we please have patch in #41 added to HEAD?
Comment #48
axe312 CreditAttribution: axe312 commented#41 worked finde for me!
(Theme: Zen-Subtheme, Admin-Theme: Rootcandy )
PLEASE add it to the head!
Comment #49
Danny_Joris CreditAttribution: Danny_Joris commentedI must say I tried this patch in another website and the error messages disappeared, but also all my menu links disappeared (except for the special menu items), so I had to revert it...
I have this snippet in my zen 1.0 subtheme template.php
Edit: I replaced "phptemplate" with my theme name and added the patch again. It seems to work without breaking the menu links for now. That's a snippet from the Menu Class module, btw (which is now considered obsolete).
...So yeah, #41 works for me too! :)
Comment #50
pacome CreditAttribution: pacome commented#41 Worked for me too
Thank you !
Comment #51
Maciej Lukianski CreditAttribution: Maciej Lukianski commented#41 works for me as well. Can this be comitted?
Comment #52
joelstein CreditAttribution: joelstein commented#41 works for me.
Comment #53
lourenzo CreditAttribution: lourenzo commentedI had a similar problem, using a custom zen-based frontend theme and rubik as admin theme.
Sometimes, the frontend menu was broken, sometimes the admin tabs would be gone.
Both problems could be temporarily solved by clearing the cache, but I had to put an end in those shameful broken screens.
Debugging the system, I discovered a bug: special menu items module caches only one preprocess function globally.
I just thought of changing the variable from string to an keyed array, in which keys are the theme_key global, that represents the
active theme by the time the hook for registry alteration is called.
That solves the problem for good, adding virtually no overhead and only 4 more lines of code
Comment #54
lourenzo CreditAttribution: lourenzo commentedComment #55
jimmynash CreditAttribution: jimmynash commentedRan into this issue today.
I applied the patch in #53 but after clearing the cache had menu links that said "Array" in the regular navigation menu in Garland.
I also received several other warnings on the page. Apologies, I did not keep them.
Edit:
After applying the patch in #53 I saw the same warnings as well as:
warning: Illegal offset type in isset or empty in /var/www/html/mysite/www/includes/common.inc on line 915.
I rolled that one off and applied the one in #41 and it fixed the issue I had of valid callback warnings.
Using Zen subtheme for main template, Garland as the admin template.
Versions: Drupal 6.22
Zen 6.x-2.1
Special menu Items 6.x-1.5
Comment #56
lourenzo CreditAttribution: lourenzo commented@jimmynash, I forgot to mention that the variable type is changed to array, so it needs to be deleted before applying the patch.
And you need to rebuild the theme cache too.
So, the original funcion names are saved on rebuild and loaded according to the current $theme_key value.
Talking about performance, I still thinking the module overhead should be concentrated at the theme registry rebuild, and not at the rendering function.
Comment #57
joep.hendrix CreditAttribution: joep.hendrix commentedI can confirm that patch #53 works.
Upgrading would mean to first unintstall the module in order to delete the variable "oldtheme_menu_item_link".
Or:
Comment #58
andremolnar CreditAttribution: andremolnar commentedHere is a patch against the 1.5 tag for people applying patches during drush make. - see @patcon http://drupal.org/node/1054616#comment-4152234
Comment #59
andremolnar CreditAttribution: andremolnar commentedOoops that file didn't work -
Comment #60
gagarine CreditAttribution: gagarine commentedI don't have the time to read all the issue... But I post a patch https://github.com/webflo/special_menu_items/pull/3 for D7 than should probably solve that.
Comment #61
btopro CreditAttribution: btopro commentedsub
Comment #62
d3str0y CreditAttribution: d3str0y commentedI've got the same problem.
call_user_func(rootcandy_menu_item_link) [function.call-user-func]: First argument is expected to be a valid callback in /path/to/site/sites/all/modules/special_menu_items/special_menu_items.module on line 125.
Comment #63
B-Prod CreditAttribution: B-Prod commentedThis patch is a fork from #59 but removes the deprecated variable ''oldtheme_menu_item_link" in an update function inside the .install file, then rebuild the theme registry.
Comment #64
gagarine CreditAttribution: gagarine commentedComment #65
gagarine CreditAttribution: gagarine commentedCommitted in 6.x-1.x-dev. I didn't try on 7.x if we also have this issue fee free to reopen in this case.
http://drupalcode.org/project/special_menu_items.git/commit/7008a3a
Comment #66
doublejosh CreditAttribution: doublejosh commentedPatiently awaiting release :)
Comment #67
gagarine CreditAttribution: gagarine commentedI will love if instead you try the dev release to check if it works :). The -dev is ready for a release I just wait than some peoples try it... (backup first so it's 100% safe)
If nobody try, is not going to have a new release because I personally don't use the D6 version.
Comment #68
xeraseth CreditAttribution: xeraseth commentedI was having the same issue as 14 and 62, switching to the lastest dev version has fixed the issue.
EDIT: I am using a custom Zen subtheme on Drupal 6.22
Comment #69
gagarine CreditAttribution: gagarine commentedthanks xeraseth to try the dev. I'm going to release a new stable version when I catch some times.
EDIT: done
Comment #71
ClaireC CreditAttribution: ClaireC commented#31 Thank you for your patch.
Comment #72
bleen CreditAttribution: bleen commentedplease do not reopen this issue unless you feel the bug is not yet completely fixed