Hi, I am experiencing problem when using user_id token for the menu path, while using fixed title. The result of the issue is that the menu link appear at the end with the menu router title as its title, when link title (entered from the ui) is expected to be the case.
This happens because on editing of the menu link item the default value of the link is expected to be the one, saved in the {menu_link} table, but the loader function is translating it, which leads to its path actually be replaced by the menu_token module itself. In this way the default value is the replaced path, which in my case includes the administrator's user ID. Then this path is saved to the {menu_links}. This leads to an issue when the link is initiating because it has no access by default in _menu_link_translate() and its title is not updated properly.
In this way the result for me is:
1) The link is using its router title, instead of the one that is set through the menu link UI
2) The link is not using title callback if set for the menu_router
More problems can be related, some of them might be reported but will be hard for me to check them all.

I can fix this by letting the module set a new menu_token_uuid (dummy path) on each update of the link, but I can see a comment in the code that there is a check for reusing the old path? My question is, is it necessary to have the same dummy path ? And why there is a need for "unique" dummy path, why just don't use "front" as such?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

SimeonKesmev’s picture

Issue summary: View changes
SimeonKesmev’s picture

Issue summary: View changes
SimeonKesmev’s picture

Status: Active » Needs review
FileSize
1.66 KB

This patch works for me, but has to be reviewed as I am not familiar with the purpose of uuid dummy paths for the links.

m.lebedev’s picture

Thanks. It's work.

RaulMuroc’s picture

Status: Needs review » Reviewed & tested by the community

+1

DevElCuy’s picture

Status: Reviewed & tested by the community » Needs work

Thanks for the patch @SimeonKesmev, btw UUID is required for compatibility with Features. We need to figure out how to fix this issue without breaking compatibility with Features.

abacaba’s picture

Assigned: Unassigned » abacaba
FileSize
1.14 KB

Hi guys. This error is caused due to the fact that when the first administrator for the first time creates a link in the database is written in a fake URL, and when he did something re-edit title.. the path to the database be updated upon .. so for example user/[current-user:uid]/edit writes to the database user/admin:uid/edit. If I look this way as admin all right, but an anonymous user does not have permission to view this route. I made a patch please see his work and he fixes this without affecting the basic logic.

abacaba’s picture

This correct patch.

abacaba’s picture

Status: Needs work » Needs review
DevElCuy’s picture

+++ b/menu_token.module
@@ -317,10 +317,13 @@ function menu_token_form_menu_edit_item_alter(&$form, &$form_state) {
+        $form['link_path']['#default_value'] = 'menutoken/' . uniqid();

I'm worried about this, since a new UUID is being created, is there anyway to pull the original? otherwise it will not be friendly with features.

DevElCuy’s picture

Status: Needs review » Needs work
abacaba’s picture

Status: Needs work » Needs review

This patch is compatible with the features, I have created a test link moved it and it came with no problems and is edited by the administrator or authorized user can be seen in the future. For the test we must not forget to apply a patch to the donor site.

  • develCuy committed fe4802e on 7.x-1.x authored by RaulMuroc
    Issue #2369713 by artmix, SimeonKesmev, RaulMuroc: Menu link path not...
DevElCuy’s picture

Nobody tested the patch but I want to give it a try. Yet, if somebody complains I'll revert it.

DevElCuy’s picture

Just for the record: #2630832: UUID module dependency, UUID module is not a requirement anymore.

abacaba’s picture

_

abacaba’s picture

_

abacaba’s picture

_

abacaba’s picture

_

  • develCuy committed 12f83bf on 7.x-1.x
    Revert "Issue #2369713 by artmix, SimeonKesmev, RaulMuroc: Menu link...
  • develCuy committed 5414aed on 7.x-1.x authored by artmix
    Issue #2369713 by artmix, SimeonKesmev, RaulMuroc: Menu link path not...
DevElCuy’s picture

@artmix, my apologize for the mistake! I reverted the commit and committed your patch again, this time with you as author. Thanks for your contribution!

abacaba’s picture

@develCuy, Thanks.

DevElCuy’s picture

Status: Needs review » Fixed

2 weeks no complains.

Thanks everyone for contributing!

Status: Fixed » Closed (fixed)

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