I am trying to set a site with menu token, but I can't get the menu token to show up. I added a normal link in the menu and that link shows up fine. Basically the menu is not showing up at all. I tried changing the weights of the menu like was said in http://drupal.org/node/1138070 , but didn't seem to work for me. Here is a screenshot of the menu setup. The menu item link I am using is as follow "[current-user:field-herbid]/genealogia" (obviously without quotes). Which in turn should bring me to site.com/h100_genealogia (pages that are accessed only by specific users.

Thank you

CommentFileSizeAuthor
menu token issue.jpg93.47 KBnickvda

Comments

dealancer’s picture

Category: bug » support
Status: Active » Fixed

"[current-user:field-herbid]/genealogia" should bring you to 'somewhere/genealogia' and not to 'somwgere_genealogia'so make sure you link is ok. I suggest you yo update link to "[current-user:field-herbid]_genealogia" and see what happens.

There is advice how to test your links. Change Title to "[current-user:field-herbid]/genealogia" and change path to or user and see what happens. Link title should contain url, check if it is correct.

Status: Fixed » Closed (fixed)

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

raulmuroc’s picture

Category: support » bug
Status: Closed (fixed) » Active

Agree it doesn't appear at all. Firstly I thougt it was because of menu_per_role menu, but I deactivated it, created another menu token link and nothing, it just doesn't appear at all.

raulmuroc’s picture

Version: 7.x-1.0-alpha2 » 7.x-1.x-dev
raulmuroc’s picture

I beg your pardon I don't have time and it could be seen a little pretentious but I throw out a request for an active mantainer because it is not any movement in this module since february of 2011! 1 year!

Do you think it is a nice idea to open an issue for this request?

dealancer’s picture

Not sure why dev release is so old. I've made commits there a month ago, see http://drupalcode.org/project/menu_token.git/shortlog/refs/heads/7.x-1.x.

You could try to download dev release from drupalcode website.

I don't see reason why we could open the issue, unless you can provide steps how to reproduce it with a fresh d7 installation.

Please, write down steps I need to do, to reproduce it.

Thanks in advance.

raulmuroc’s picture

Well... at the "master" branch the last commit was in 25-02-2011: http://drupalcode.org/project/menu_token.git or http://drupalcode.org/project/menu_token.git/shortlog

The url which you talk about is another branch "heads", could be there the mistake? :S Trying to help ;) because it is really weird...

Appart from that I cannot download from there all package-in-one, I had to download separately and it broke my page, I had to put again the old version of 2011.

Thx in adv.

dealancer’s picture

We are not using master branch now. The working branches are 6.x-1.x and 7.x-1.x.

raulmuroc’s picture

Priority: Normal » Major

I tried everything, but the problem is not solved. When using a Menu link with tokens, it just remains hide. I used in past menu per role and thought it was that, but i deleted it, uninstalled and tried menu token alone and the same results. :S

Perhaps... could you attach in this issue the last working Menu token module?

raulmuroc’s picture

I am trying to set a site with menu token, but I can't get the menu token to show up. I added a normal link in the menu and that link shows up fine. Basically the menu is not showing up at all. I tried changing the weights like was said in http://drupal.org/node/1138070 , and isolating menu token (so without menu_per_role) but didn't seem to work.

This a really important bug to solve because if not it doesn't have sense to install this module cuz menu just does not appears.

Working on it, but full of other modules bugs. Thanks for help!

raulmuroc’s picture

Priority: Major » Normal
Status: Active » Fixed

Just deleted menu per role and menu token and uninstalled from database. Then I Installed again with the following versions: Menu_token 7.x alpha3 and Menu_per_role 7.x-1.-x-dev. And it just worked.

There's nothing else to do, so solved.

Status: Fixed » Closed (fixed)

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

ruess’s picture

Sadly that fix did not work for me. This is a difficult problem for some reason, even with the latest build. One workaround that I'm having to use for now is to not use a relative path, but enter the link with the full http://mysite.com/[token]/blah as the path. It seems to ensure the menu item's appearance at least, though not the most preferable solutions for sure.

raulmuroc’s picture

Component: Miscellaneous » Code
Status: Closed (fixed) » Active

You are right #14ruess, to me worked for a while but now is again not working. I did your solution, to put absolute path instead of relative path and it works. So the problem is here with something related to paths...

dealancer’s picture

Status: Active » Postponed (maintainer needs more info)

Could you please write steps to reproduce this issue?

raulmuroc’s picture

1) Go to your menu
2) Add link
3) Introduce any link title
4) Introduce a relative path <-- here is the point, with an absolute path it works.
5) Thick "use tokens in title and path". The rest is the same either you fullfill or not.

That's it, when you fulfill with relative path it never shows up, when you do with absolute then it appears as expected.

karolrybak’s picture

I have a similiar problem to test it i created new site.
Then created 3 nodes in menu one under another like
1 > 2 > 3

Now I enter menu editing and check "use tokens" for node 3
(It is enough to enable the checkbox i'm not entering any tokens)

When i visit the node 3 menu is collapsed and active trail is not set.

When a normal menu item is below the menu item with token in menu structure active trail is set properly, however you cannot really access that node from menu, because node 2 will never get expanded if not set manually to do so.

I have setup a simple test site that shows the problem:

And a link to a node which is otherwise inaccesible from menu

http://testmenutoken.aspp.pl/node/6

Also, set_active_trail does not work on menu items with tokens enabled, so that might be the root of the problem, however i'm not experienced enough in drupal to dig into the core to pinpoint the problem.

I use latest stable ctools and token modules.

Same thing happens with stable and dev versions of menu token.

If you need more info let me know :)

mattdanger’s picture

Very that you have privileges to access the menu route you are trying to create using tokens.

karolrybak’s picture

I have no control access modules installed, also menu items do not have any replacement patterns defined so the path is not modified. Checking the checkbox is all that is reqiured to trigger this behaviour.

GeminiAgaloos’s picture

Status: Postponed (maintainer needs more info) » Needs work

Note:
This issue also occurs in Menu Token 6.x-1.0-alpha2
Tested 27-June-2012

Steps to reproduce:
1) Go to your menu
2) Add a menu item
3) Title: Sample menu title
4) Path: <front> (direct path to the front of page)
5) save and view (menu item is showing up and works as expected)

Now, to introduce bug
6) go back to menu item and edit
7) Check "use tokens in title and path".
8) save and view... (menu item has disappeared)

Either of the following will make the menu item re-appear:
* edit the menu item and change the path from "<front>" to "user"
or
* simply uncheck the "use tokens in title and path"

tajindersingh’s picture

Facing same problem with 6.x-1.0-alpha2 as mentioned by 007g3m1n1

Tested some cases and found that in case of internal path, it is not being validated. So items disapper in case of invalid internal path. Also if path is set to <front>.

Below combinations can be tried for regeneration and verification:

1) Valid front path
Menu link title: Test Site
Path: [site-url]
Use tokens in title and in path: checked
Result: Link will appear

2) Valid front path with token in title
Menu link title: [site-name]
Path: [site-url]
Use tokens in title and in path: checked
Result: Link will appear

3) Token in title and external path
Menu link title: [site-name]
Path: http://www.google.com
Use tokens in title and in path: checked
Result: Link will appear

4) Token in title and any valid internal path
Menu link title: [site-name]
Path: user
Use tokens in title and in path: checked
Result: Link will not appear

5) Token in title and <front> as path
Menu link title: [site-name]
Path: <front>
Use tokens in title and in path: checked
Result: Link will not appear

6) Token in title and '/' as path, here '/' is an invalid path as internal paths don't lead by '/'
Menu link title: [site-name]
Path: /
Use tokens in title and in path: checked
Result: Link will not appear

7) Token in title and invalid internal path as lead by '/'
Menu link title: [site-name]
Path: /user
Use tokens in title and in path: checked
Result: Link will not appear

~~ Internal path Validation can be implemented by placing below lines at line 71 of menu_token.admin.inc ~~
$final_link['link_title'] = token_replace($form_state['values']['menu']['token']['link_title'], 'global');
$final_link['link_path'] = token_replace($form_state['values']['menu']['token']['link_path'], 'global');
if (!menu_valid_path($final_link)) {
form_set_error('link_path', t("The path '@link_path' is either invalid or you do not have access to it.", array('@link_path' => $form_state['values']['menu']['token']['link_path'])));
}

~~ Regarding <front> problem, not found a solution yet and currently using token [site-url] token ~~

Hope above helps :)

dalearyous’s picture

i am experiencing the same thing. i also notice that if you do get the link to show up, hover over the link to see token isn't being translated

DrupalDesigner-1’s picture

I am also getting this. #17 is exactly what happens to me. Using Drupal 7.15

DrupalDesigner-1’s picture

Solved this by typing in the absolute url instead of just the relative path.

reallyordinary’s picture

Running into all the same issues experienced by above commenters. Except I can't get it working even with absolute URLs. Anytime I attempt to use tokens in any menu, the path for the menu item doesn't show up; just defaults back to the home page.

So... this module isn't working at all currently?

raulmuroc’s picture

Status: Needs work » Active

As said before: it works with absolute path. Missing patch for relative paths.

Sherbet’s picture

This issue still exists in the 7.x-1.0-beta3 version. Any word on a patch?

develcuy’s picture

Priority: Normal » Critical

Thanks for the report!

Sherbet’s picture

A temporary workaround for Drupal 7 is to use [site:url] to take into account the base path. I recommend using that until this is fixed.

A link to the user edit page would be [site:url]user/[current-user:uid]/edit for now.

dpatte’s picture

I was having a similar problem with 6.x-1.0-alpha2.

I have a menu and submenus that use the same token such as
team/[user-id]
team/[user-id]/accounts
team/[user-id]/contacts
I set the first menu to expanded, but sometimes the menu appeared collapsed and sometimes expanded

I switched the menus to
[site-url]team/[user-id]
[site-url]team/[user-id]/accounts
[site-url]team/[user-id]/contacts
and now the menu always appears expanded as expected

raulmuroc’s picture

Priority: Critical » Normal

Not critical. With an easy workaround which consistits of writting "Absolute URL's" instead of "Relative URL's" the problem gets solved.

No solution/working patch so far.

rickbcwt’s picture

Version: 7.x-1.x-dev » 7.x-1.0-beta4

I tried using [site:url]user/[current-user:uid]/edit AND my http:mysite.com/user/[current-user:uid]/edit with Version 7.x.1.0.beta4 and still no luck.

Sherbet’s picture

Does it replace anything at all for you?

kingfisher64’s picture

Finally after most of the day researching and trying out solutions including going through https://drupal.org/node/1117760 & https://drupal.org/node/2044945 the solution of using absolute paths instead of relatives worked.

Request
Can a note be made on project page that absolute URL's are needed at present. It might save someone else considerable time.

Thank you.

kingfisher64’s picture

Version: 7.x-1.0-beta4 » 7.x-1.x-dev

Also beta 5 doesn't work but latest dev does so change of version is needed.

develcuy’s picture

@kingfisher64, thanks for your feedback! did you tried beta5?

raulmuroc’s picture

@develCuy, in his message, @kingfisher64 has explicitly written that

Also beta 5 doesn't work

So if -dev version solves this problem this should be moved to a beta 6 version. But before move -dev to beta6 I recommend more testing in dev version and if it is solved then change status to fixed.

thanks!

develcuy’s picture

Missed his second comment, thanks @RaulMuroc!

Everyone: created a new issue related to it: [site-url] #2099623: When do you use [site-url] token?, your feedback is welcome!

akolahi’s picture

An issue with using [site:url] is that it appears to bypass Drupal's check if the user has access of the link. Normally if a user does not have view rights, the link is not displayed.

alauddin’s picture

Issue summary: View changes

Using 7.x-1.0-beta5 - Issue I had was menu was appearing for 'user1' but not for other roles

Tried +8-dev from 2015-Feb-20 with no luck.

Using absolute path worked for me in both beta5 and dev.

Note: the latest dev adds uuid module dependency, so be sure to enable that before the upgrade.

Just a fyi - When browsing through the token replacements.
The [current-page:arg:N] tokens have been renamed to [current-page:url:unaliased:args:value:N]

https://www.drupal.org/node/1265010

nDigitHQ’s picture

Still an issue. Was able to replicate via the steps above.

We were having problems with the [current-user:original:uid] portion which is key. I ended up writing a custom hook in my template.php file to handle the menu replacement. Here is the code:

function themename_menu_tree__menu_dashboard($variables) {
	$vars = explode("\n",$variables['tree']);
	foreach ($vars as $k => $li) {
		//Menu token workaround
		global $user;
		@$li = str_replace("[current-user:original:uid]", $user->uid, $li);
		$vars[$k] = $li;
	}
	
	$variables["tree"] = implode("\n", $vars);
	
	//Build HTML and then return it.
		
	$html = '<ul class="nav navbar-nav">' . $variables['tree'] . '</ul>';
		
	return $html;
}

In this case my menu name is dashboard. You'll want to replace that with whatever your menu name is.

Same thing goes for the themename_ piece. Change that to the name of your theme.

Hope this helps!

hcderaad’s picture

Unfortunately the workaround with an absolute path does not work if this absolute path is set through a Custom token, please also see: https://www.drupal.org/node/2687495

sarikak’s picture

Menus using tokens created with menu token module is now missing in the website. I am able to create new menus and these menus are visible in my website.
What should be the reason for missing the old menus? Whether it repeats again for the newly created menus?
Please provide a solution to this issues.

Thanks.

develcuy’s picture

Status: Active » Closed (outdated)