I want to replace the user id (user/6/edit) with anything else, just not the number

Created on 2 November 2012, over 12 years ago
Updated 9 December 2024, 5 months ago

Hi all,

Pulling my hair out here :(

What I want to do:
I am looking for a way to change the all the user ids in all urls/paths to something else. Ideally it would be the user's username, but I would be content with just getting rid of the user id in paths alltogether.

Why:
I think by showing the user id to the user I am giving valuable private info about how many users there are ro might be.

What I have tried:
1) I installed Pathauto and thought that by just creating a pattern for user account page paths like so [user:name], it would solve my problem, and magically all the user IDs would change into the username.

For example, I have the normal user tabs in my user/account page:
View|Edit|Orders

And then I have added one more tab via a view - Purchased Files

So my user section looks like this:
View|Edit|Orders|Purchased Files
and the corresponding URLs are: user, user/3/edit, user/3/orders, user/3/files

So I thought that Pathouto would change these paths to: user, user/tommy/edit, user/tommy/orders, user/tommy/files

I thought it would just work, but I have found the following:
-The URL links from my tabs are still the old ones with the path user/3/orders for example
-If I try to navigate to user/tommy/edit for example I get the 'unauthorised' message, this is the same for all of them EXCEPT for user/tommy/files (the tab I created with views), which works at that URL, BUT the user tabs dissappear :|

2) Another problem now is that even If I uninstall Pathauto and clear my cache, this alias still exist at user/tommy/files - that seems very strange :|

3) I have tried so many other modules, Subpathauto, Me alias - but nothing seems to work.

SO NOW THE QUESTION IS:

Is there any way I can get rid of the User ID in my URLs with this module, AND have my site work as before and all links work and updated automatically?

Thanks alot, I love this module and use it quite a lot, I just can't seem to get it to play nice with the user id replacement.

Thanks!

💬 Support request
Status

Active

Version

1.2

Component

Documentation

Created by

🇲🇾Malaysia jackrowe

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇬🇧United Kingdom 2dareis2do

    I wanted to also add alias for user entities. Turns out I was able to do this without using a separate module. Steps to enable:

    1. Make sure user bundle /entity type is enabled from path settings tab.
    2. Once enabled you can also set the patten on existing user entities
    3. You can add pattern on path pattern using token for user entity type. e.g /users/[current-user:account-name]/code>
    4. You now have option to bulk generate user entity paths.

    From what I can tell path aliases are shown instead of users/[userid] inclusing edit paths e.g. users/[current-user:account-name]/edit

Production build 0.71.5 2024