Support » Plugin: Ultimate Member - User Profile & Membership Plugin » Display profile content based on role of user profile

  • I am looking for a way to display certain content on the /user/ profile page based on the role of the user rather than the role of the person viewing it. Currently I see a way to set certain elements to hide or display based on the role of the viewer but I want to have public profiles that show to an person logged in or not and have different elements show if the user profile being viewed is one role and other elements if they are another role. Possible?

Viewing 15 replies - 1 through 15 (of 17 total)
  • Yes, most of what you require is possible with UM. You need to go to UM > Forms > Profile. Edit privacy settings in fields manager and determine which user roles are allowed to see what field elements on the profile page. Also, the UM access widget in Admin panel > Pages > User > Edit. That would determine how private all profiles will be.

    Boris,
    You are misunderstanding what I asked. I do not want the content to be based on the role of the person viewing the user profile but rather based on the role of the person whose profile it is. I want the public to be able to view the profile but have three different roles that show different content based on the role that is assigned to that user.

    What part did I misunderstand? Since you are elaborating further, have you tried creating 3 roles in user roles? Have you created fields in your profile form fields manager which contain the privacy settings allocated to each of these user roles?

    Let me know,

    Yes. I know that there are current privacy settings. Those apply to the role of the person that is viewing the page, not to the role of the user profile that is being viewed. For instance – Role 1 will have an element on their user profile, Role 2 will have a different element on their user profile. What I want is that difference to be visible to the public not just to those roles when logged in.

    Role 1 will have an element on their user profile, Role 2 will have a different element on their user profile. What I want is that difference to be visible to the public not just to those roles when logged in.

    Have you tried making 2 forms?

    Make/Add another form for role #2 (you can duplicate and edit/remove what you don’t want to display).
    Paste the shortcode in Admin panel > Pages > User >

    Better yet read this.
    http://docs.ultimatemember.com/article/100-unique-profiles-for-different-user-roles

    That document should solve your problem.

    No. This does not solve the issue and you are still not understanding. This solution allows a profile layout and elements to be visible to specific roles, but anyone not logged in cannot see the profiles since it is relying on the logged in session to determine what should display on the profile page.

    I do appreciate your answers and understand that you may have a good working knowledge of UM but I am obviously doing something that is out of the normal convention with this plugin. I could care less what the logged in users see. I want the public who is not logged in to see different things when they go to the user profile for a Role 1 user vs a Role 2 user. I want to provide different affiliate links to the public depending on the referral role. The Role 1 and 2 users will not have control over editing these links. I want to set these and have them be the same on every users profile specific to the role of that user.

    I could care less what the logged in users see. I want the public who is not logged in to see different things when they go to the user profile for a Role 1 user vs a Role 2 user.

    And that’s why I gave you the urls to those 2 test user profiles and told you what you were supposed to see out of each of the user roles. I only gave you access to role 1 so you could confirm that you can’t enter the information that was assigned to role 2.

    Whether you have links or whatever you want to show visitors from user roles 1 and 2 is irrelevant to the discussion.

    I hope this helps.

    Hi,

    Yes, what you want to do with these two user roles is possible. The key setting is in each field that you want to be different (shown or not shown) for a given user role. Click to edit the field and scroll all the way to the bottom. You will see Manage Conditional Fields Support. Click on the plus sign.

    You may then show or hide the field depending on whether the user’s member role equals or does not equal a particular role. Note that this applies to the user him/herself, not the public viewer of the profile, which is what I believe you’re after.

    Using this approach, I have a particular field, accepting referrals (yes/no), that is visible on the user page only of role = Member but not role = Senior on my site. This is because Senior members on my site are supposed to be retired from practice and hence not accepting referrals (and not able to edit the setting to say that they are accepting them).

    Hope this helps!
    Rob

    Rob,
    Thanks for offering your advice. You are correct that I am looking to have the page show to a public viewer but have conditions based on the role of the user that is being viewed. I have tried something based on your suggestion and added a field – Roles (Dropdown) and tried also with Roles (Radio). That worked to display the role that the user being viewed was assigned in their user profile. I then tried to show/hide another element based on this field. It did not work. Even though the conditional logic was referencing this field it still referenced the role of the logged in user when showing/hiding. You can see the sequence in this video clip – https://youtu.be/Wskfj6TuNBo

    Darn, sorry about that. I see now that what I thought was working on one of my sites actually isn’t working in the way I thought.

    Have you tried this approach of creating one user profile form per user role (for those roles that you want to show/hide specific fields)?

    http://docs.ultimatemember.com/article/100-unique-profiles-for-different-user-roles

    Yes. That is the way it is done for if you want users to see a different profile page with options when they are logged in. I am trying to reverse engineer it so that the public sees something different based on the role of the user for the profile they are viewing. I have a developer working on a custom function for this so hopefully will have a resolution soon.

    I have a developer working on a custom function for this so hopefully will have a resolution soon.

    Actually, I am glad you are using a developer person. I would have given you all the steps to do this for free and without the need of pasting a single line of code though. Hopefully you are paying this dev person for his time.

    Regards,

    @borisv,
    I would be more than happy for you to provide a solution. Did my response to verysiberian with the video link help explain what I am trying to accomplish a bit better? The developer I am using is busy and has not been able to work on this yet so if you have a solution that accomplishes the goal, I would be willing to pay you for the solution.

    @pandeboyce this might be a bit late but I was looking for something similar without using a plugin and found this which might be helpful with the correct conditions added:

    ~<?php if( current_user_can(‘wholesale’)) { ?>
    // stuff here for wholesale
    <?php } ?>~

    ‘wholesale’ represents the user role.

    http://wordpress.stackexchange.com/questions/222492/show-or-hide-custom-fields-by-users-role-frontend

    HTH.

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘Display profile content based on role of user profile’ is closed to new replies.