Hi, When i ugraded the token module to the 6.x-1.16 version, I noticed that it removed token_menu_get_mid, so child page created with node relativity module breaks with
Fatal error: Call to undefined function token_menu_get_mid() in /../sites/all/modules/contrib/relativity/relativity.module on line 1331
Please, somebody helps me.

CommentFileSizeAuthor
#9 1168566.patch2.2 KBthreexk

Comments

dave reid’s picture

Title: Token 6.x-1.16 gives some problem to node relativity module » Call to undefined function token_menu_get_mid()
Project: Token » Node Relativity
Version: 6.x-1.16 » 6.x-1.x-dev

The function was removed from Token module because it doesn't actually work in Drupal 6 (there is no global $_menu in core at all), and it was leftover from the D5 version of token. So this Relativity token never actually worked at all. Perfect. Moving this issue to relativity.

dave reid’s picture

modumo’s picture

But i'm on the relativity issues section. Where should i post this issue?

dave reid’s picture

I moved the issue from the Token project to the Relativity project for you.

modumo’s picture

Ah, Ok. Thanks :)

teelmo’s picture

Subscribe!

draxiom’s picture

A temporary fix for the wsod is to comment out that section of the relativity module until they can address the issue.

In /modules/relativity/relativity.module (lines: 1331-1336):
$mid = token_menu_get_mid('node/'. $parent->nid);

while ($mid && $_menu['visible'][$mid]) {
array_unshift($trail, $_menu['visible'][$mid]['title']);
$mid = $_menu['visible'][$mid]['pid'];
}

becomes:
/*$mid = token_menu_get_mid('node/'. $parent->nid);

while ($mid && $_menu['visible'][$mid]) {
array_unshift($trail, $_menu['visible'][$mid]['title']);
$mid = $_menu['visible'][$mid]['pid'];
}*/

modumo’s picture

Thanks, i abbandoned the relativity module and i used another method for doing the same thing.
But i think it should be better write the incompatibility between these two module in token notes.

threexk’s picture

Status: Active » Needs review
StatusFileSize
new2.2 KB

I think the proper fix here is to just remove the code dealing with menu-related tokens. As Dave Reid points out, it never could have been working under D6, so no one using D6 Relativity is dependent on these tokens. Also, I am a former coworker of the person who primarily ported Relativity to D6, and I can attest that they did not ever use menu tokens.

If someone needs menu tokens in D6, they can write the code for them.

jonhattan’s picture

Assigned: modumo » jonhattan

Will try to find a way to still provide those tokens. If no luck I'll drop them per #9.

jonhattan’s picture

Status: Needs review » Fixed

Very easy indeed. Now there's an open option to bring other menu tokens into relativity.

This is the change: http://drupalcode.org/project/relativity.git/commit/18a5be4

threexk’s picture

Status: Fixed » Needs work

Thanks, jonhattan, for attempting a fix on the menu tokens. I now get the following error when trying out the latest dev tarball:

PHP Fatal error:  Call to undefined function menu_token_values() in /var/www/html/[site_name]/sites/all/modules/relativity/relativity.module on line 1353, referer: https://[site_url]/node/add/[node_type]/parent/194

(The parts in brackets are things I redacted that are specific to my site.)

threexk’s picture

Status: Needs work » Fixed

Sorry, I was carelessly still using the previous version of Token when I tested before. The fix works great. Since this bug breaks sites using the latest Token, can we do a release?

jonhattan’s picture

yes I'll release shortly once other issues are fixed.

threexk’s picture

Thanks for your work.

What issues are blocking release? This is a critical bug, so I think we should do a release even if there are still other lower-priority outstanding issues. I checked the tracker, and I don't see any confirmed new bugs marked major or critical.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.