Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I have set up 2 content profiles.
user/name (role=user)
member/name (role=member)
I want to be able redirect to the profile based on the role of the profile being viewed. I think I can do this with rules using load content profile but not sure how to add the role to be viewed.
Thanks in advance
Comments
Comment #1
Dgrey CreditAttribution: Dgrey commentedHelp please?
I want to be able to direct the user to the profile based on the role being viewed. Is there a way to do this?
Thanks,
DGrey
Comment #2
frankcarey CreditAttribution: frankcarey commentedTry using the Rules module. This content_profile rule should get you started #577218: Rule definition to redirect users from profile nodes to user account page. Please export and post back your solution so others can use it.
Comment #3
Dgrey CreditAttribution: Dgrey commentedI am almost there.
I created a rule on content being viewed that triggers the rules set:
Rule 1- If user profile being viewed redirect to user page (created with views attachment)
Rule 2- If member profile being viewed redirect to member page (created with views attachment)
Rule 3- If user account page being viewed redirect to user page (created with views attachment)
Rule 4- If member account page being viewed redirect to member page (created with views attachment)
I accomplished rules 3 and 4 by
1. Action - Load profile author
2. Action - Redirect to member or user page (depending on role - Step 4)
3. Condition - Path has alias - users/[user-raw]
4. Condition - User has role (User of the loaded node profile - Step 1)
5. Condition - Profile Created (User of the loaded node profile - Step 1)
Rules 1-3 are working great.
However Rule 4 is not working.
All roles are being redirected to user page - (Rule 3) except admin who has role member is not being redirected at all.
Please help not sure why Rule 4 is not working.
Thanks,
D.Grey
Comment #4
Dgrey CreditAttribution: Dgrey commentedThanks frankcarey - I had looked at this already but it does the opposite of what I want to accomplish - I figured out another way but it is not there yet. Will keep you posted.
Comment #5
jumpfightgo CreditAttribution: jumpfightgo commentedI wrote a patch that handles redirecting user/profile pages here: http://drupal.org/node/661572#comment-2663766
It does not incorporate roles, but if you can extend that patch to also check roles then it could solve your issue as well.