I have a special profile-type node for each user. It assigns their username in the path. If a user has a single-word name, it comes out as www.domain/profiles/username. If there are spaces, it puts in dashes, so it comes out www.domain.com/profiles/user-name.
The Menu Token module works fine with single-word names, but not names with spaces. Now this may be a Token issue, but I don't know. If so, please tell me.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | Screenshot from 2018-03-06 17-33-23.png | 8.4 KB | ishani.addweb |
| #4 | Screenshot from 2018-03-06 17-27-44.png | 42.33 KB | ishani.addweb |
| #4 | Screenshot from 2018-03-06 17-26-42.png | 31.73 KB | ishani.addweb |
| #4 | Screenshot from 2018-03-06 17-26-19.png | 43.15 KB | ishani.addweb |
| #4 | Screenshot from 2018-03-06 17-25-49.png | 33.28 KB | ishani.addweb |
Comments
Comment #1
shashikant_chauhan commentedHi,
I was also getting the same problem it was working with single word and not working with user-name with '.' or '_'
In my case the url was like example.org/users/username
In menu item edit for menu token i was entering as
"Menu link title" = [current-user:name]
and for
"path" = users/[current-user:name]
Which was wrong
When i set value like this
"Menu link title" = [current-user:name]
and for
"path" = user/[current-user:uid]
Then it started working for all usernames which are having characters like '.' or '_'
users/username is url alias for user/uid
Regards,
Shashikant
Comment #2
deanflory commentedMaybe the Transliteration module to change dashes to how you need them to be?
Comment #3
ikeigenwijs commentedWe have the same issue:
[user:name] does not work and gives:
Notice: Undefined index: menu_token_data in menu_token_form_menu_edit_item_alter() (regel 453 van public_html/sites/all/modules/menu_token/menu_token.module).[user:uid] does work as expected but is not as pretty
We are also using Real name module
Comment #4
ishani.addweb commentedPlease Review below-mentioned steps as the solution which works for me
-> You can use the Pathauto module first enable module
-> Go in Pathauto module configuration in patterns add your token for your content type node in the content path
as shown in the screen shot
-> Now go to setting tab and remove - Separator and add space Separator as shown in the screen shot
-> Now go to bulk generate tab and check on content and click on the update as shown in the screen shot
-> Now go to delete aliases and check the content option and click on delete alias now button
as shown in the screen shot
-> At last, go to list tab and check the new links generated as your requirement of the current user name
Let me know if you have any query about it.
Thanks!..
Comment #5
develcuy commentedPlease somebody test and set the status of this issue to: "Reviewed & tested by community"
Comment #6
tryitonce commentedI don't think #4 solves the problem in general because by removing the seperator we end up with URL paths that are not easy to read on the whole side.
You may also try to add the full path including https://..... into the menu. For me it solved some of the issues of not seeing the menu item.
The problem of no hyphen in [current-user:name] was resolved as in #3 by just using the [user:uid] - it is not ideal.
This was for a more complex path alias relating to nodes that only the current user created and can see.
The intended path alias was [current-user:name]/my-personal-page-[current-user:name] - because the node has automated title and I wanted to include the username in the node title.
- the solution for now is [current-user:uid]/my-personal-page as the path for the menu.
Well, if a better solution comes up I will get back.
Comment #7
develcuy commented