0

I have two sets of users, faculty and staff, with corresponding Profile2 profiles.

I can't figure out how to get different paths for users dependent on roles, e.g, staff/userid or faculty/userid.

I've been trying with both Rules and Pathauto. Seems like it should be simple but can't get work it out.

3
  • This should be doable by implementing hook_pathauto_alias_alter in a module.
    – user49
    Sep 8, 2013 at 7:00
  • Thanks, I'll probably try this approach. Was hoping it could be done through UI.
    – paulkeyes
    Sep 8, 2013 at 20:52
  • Another approach would be to use Page Manager (part of ctools).
    – Darvanen
    Nov 18, 2014 at 5:17

1 Answer 1

0

One way would be to create a hidden field on the user account page, and populate that field with Rules during registration. For example, for someone with the Staff role, give it the staff value; for user with the Faculty role, give it the faculty value.

Then, with the Pathauto module, define a pattern for user paths, for example [user:XXXXX]/[user:uid], where XXXXX is the name of the hidden field you created, prefixed with field.

2
  • That seems like it could work. I solved this in a similar way, using tokens in URL Alias config (admin/config/search/path/patterns). Rewrote path as: 'people/[user:profile-faculty][user:profile-staff]/[user:name-raw]'. Your tokens would obviously be different, depending on what fields you're calling. May be sub-optimal, but no user will be both faculty AND staff, so it works well enough.
    – paulkeyes
    Feb 5, 2014 at 0:11
  • 2
    Keep in mind a user can add a value to a hidden element, so don't rely on that method for sensitive operations. Aug 25, 2015 at 2:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.