Support

  1. galbur
  2. Support
  3. Tuesday, May 25 2021, 12:11 PM
  4.  Subscribe via email
Hi

How can i show different views for different user groups?
I know how to show lists with a specific usergroup but how can i show a specific Profile view?

We have a list with members. Some of the members have some special Skills.
Now i need 2 views:

A Menulink with a list to all members (including the "special skills";)
When i click on a user it should show me a "simple" Profile. Also for the users with the Special Skills.

A Second Menulink should lead to the Special Skill Members (with Custom SQL WHERE)
And show me a more sophisticated Profile.

Is this possible? And how?

Regards
Christoph
admin Accepted Answer
Admin
Hi,
this is partially possible, but require a small PHP knowledge.

The profile view is the same for all users, but you can customize it to be different for specific users with template override.

For example,
I want a special view for a specific usergroup of users
- Create an template override: copy file from components/com_jsn/views/profile/default.php to /templates/your-theme-folder/html/com_jsn/profile/default.php
- In the new file you can customize the code by adding something like this
if(in_array(8,$this->user->getAuthorisedGroups())) :?>
OUTPUT FOR USERS IN USERGROUP WITH ID 8
<?php else : ?>
OUTPUT FOR OTHER USERS
<?php endif;
  1. 3 weeks ago
  2. Support
  3. # 1
galbur Accepted Answer
Pro
Hi
Thanks a lot for your answer. I will try this but maybe there is a missunderstanding?

You wrote:
I want a special view for a specific usergroup of users

but i need:
I want a special view with a specific usergroup of users

The views should be public. That means, i have a list with all members (including the specialists). When i klick on a user, the "normal" Profile appears.

Then i have another list only with the specialist-members. When i click on a link in this list a Profile-View with a lot more information should appear. Is this possible?

Best regards
Christoph
  1. 3 weeks ago
  2. Support
  3. # 2
admin Accepted Answer
Admin
You wrote:
I want a special view for a specific usergroup of users

but i need:
I want a special view with a specific usergroup of users
My fault, yes my code do this...$this->user contain the displayed user object, so $this->user->getAuthorisedGroups() return the array of usergroups IDs of the displayed user

The views should be public. That means, i have a list with all members (including the specialists). When i klick on a user, the "normal" Profile appears.
mmmh...if this is your need then my solution does not works...my solution allow you to show different informations based on user's group

To make this there are 2 solutions:
1) Use modules and content plugin:
- Create 2 different menu items of type Easy Profile->User Profile (profile and specialist-profile) and set each list to open different profile menu items (set All users list to use "profile" menu item and specialist users list to open "specialist-profile" menu item)
- Go to Extensions->Modules
- Create a module of type "Custom" and set it like this:
Title: Extended informations for specialist
Position: Some position in your template
Menu Assignment: set the "specialist-profile" menu item
In the editor put a code like this: This is a specialist and he is called {user avatar displayed}, I'm a specialist of {user specialization displayed}

strings like {user avatar displayed} and {user specialization displayed} will be replaced with the displayed user, docs with example at http://docs.easy-profile.com/index.php/article/content-plugin

2) - Create 2 different menu items of type Easy Profile->User Profile (profile and specialist-profile) and set each list to open different profile menu items (set All users list to use "profile" menu item and specialist users list to open "specialist-profile" menu item)
- Create an template override: copy file from components/com_jsn/views/profile/default.php to /templates/your-theme-folder/html/com_jsn/profile/default.php
- In the new file you can customize the code by adding something like this

$app = JFactory::getApplication();
$menu = $app->getMenu()->getActive()->id;
if($menu == 756) : /* replace 765 with the id of the specialist-profile menu */?>
OUTPUT FOR SPECIALISTS
<?php else : ?>
OUTPUT FOR OTHER USERS
<?php endif;
  1. 3 weeks ago
  2. Support
  3. # 3
galbur Accepted Answer
Pro
Hi ...

... and thank you very much.
So i will try this and give you a report about my success ;-)

Regards
Christoph
  1. 3 weeks ago
  2. Support
  3. # 4
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.

Request Support

Support is currently Offline

Support Availability

Working days: Monday to Friday. The support staff is not available on weekends; in the most of cases tickets will not be answered during that time.

Reply time: Depending on the complexity of your support issue it's usually between a few minutes and 24 hours for paid members and about one week for free members. When we expect longer delays we will notify you.

Guidelines

Before you post: read the documentation and search the forums for an answer to your question.

When you post: include Site Details if you request a support (you can use the form below the reply in Site Details tab).

Auto Solved Question: If after a week the author of the post does not reply to a request by moderator, the question will be marked as resolved.

Language: only English

Search Users

Easy ProfileĀ® is not affiliated with or endorsed by Open Source Matters or the Joomla Project. Joomla is Free Software released under the GNU/GPL License.