How to remove "authenticated-user" from this [user:roles:join-path]/[user:name] I have these roles:


anonymous user,
authenticated user,
administrator,
members,
partners.


In URL Aliases I changed at USER PATHS with this: [user:roles:join-path]/[user:name]

I created 2 views for user: first for members role and second for partners role (the views contain userpicture and username). The link for these users in both roles are :


www.example.com/authenticated-user/members/username
www.example.com/authenticated-user/partner/username


I know that authenticated user role is default for authenticated users, but it is possible to remove from USER PATH: from „www.example.com/authenticated-user/members/username” to „www.example.com/members/username”?

Thank you.
You can implement hook_pathauto_alias_alter(), which is invoked from pathauto_create_alias(). The function passes the pattern used from the Pathauto module before the tokens are replaced in $context['pattern']. You probably want to check the pattern contains "[user:roles:join-path]" to avoid "authenticated-user" is removed where the pattern explicitly uses "authenticated-user".

The alternatives would be:


Implement hook_tokens_alter() to alter the output of that token, but that would change it in any place the token is used, not only in alias created from the Pathauto module
Implement hook_tokens(), and hook_token_info() to implement a token similar to [user:roles] but that doesn't include the string for the authenticated user role


Notice that it is the Pathauto module that handles the :join-path part of the token, in pathauto_tokens().