Support

  1. cristianbravo
  2. General
  3. Thursday, November 11 2021, 09:59 PM
Is there a way to assign a class to different user groups?

let me explain.

We run a soccer league where we use JSN for players to register and generate their player ID, however some players submit wrong picture or information, so i need a graphical way to show their inability to play by changing the color of the player's card if they get placed in the "suspended" player group. So when a team filters users by their team, both available players group and suspended players group show up in the team list, but suspended players will have a different color set by the group class.

basically i need a way to separate the groups by color in one single output list.

please let me know

take a look at our example https://bmslsoccer.com/2021ppm
References
  1. https://bmslsoccer.com/2021ppm
cristianbravo Accepted Answer
Pro
I also need a way to display users from 2 or 3 different groups in one list with the color class changing based on group ID. how can i load 3 groups at the same time
  1. more than a month ago
  2. General
  3. # 1
admin Accepted Answer
Admin
Hi,
the only way to achieve this is to use template override feature:
- Copy file from /components/com_jsn/views/list/tmpl/default_user.php to /templates/your-theme-folder/html/com_jsn/list/default_user.php
- add a code like this in the new file (like screenshot)
<?php if(in_array(5,$this->user->getAuthorisedGroups())) echo 'danger'; ?>
Attachments (1)
  1. more than a month ago
  2. General
  3. # 2
cristianbravo Accepted Answer
Pro
what kind of query do i have to place to load 3 user groups at the same time in one list? right now i use "group_id=10" to launch a group list.
  1. more than a month ago
  2. General
  3. # 3
cristianbravo Accepted Answer
Pro
I have added the extra line but the class does not get loaded. Am i doing something wrong?
  1. more than a month ago
  2. General
  3. # 4
cristianbravo Accepted Answer
Pro
here are the attachments
  1. more than a month ago
  2. General
  3. # 5
cristianbravo Accepted Answer
Pro
Never mind, i figure out that the number in the new code would be the user group and if present would add the "danger" class. however, how can i add, in the same line more groups? I need at least 3 groups to display. One with normal class, one with "danger" class and another with "warning" class.

thank you
  1. more than a month ago
  2. General
  3. # 6
admin Accepted Answer
Admin
Never mind, i figure out that the number in the new code would be the user group and if present would add the "danger" class. however, how can i add, in the same line more groups? I need at least 3 groups to display. One with normal class, one with "danger" class and another with "warning" class.

thank you
You can add following code many times
<?php if(in_array(5,$this->user->getAuthorisedGroups())) echo 'danger'; ?> <?php if(in_array(6,$this->user->getAuthorisedGroups())) echo 'secondclassname'; ?> <?php if(in_array(7,$this->user->getAuthorisedGroups())) echo 'anotherclasstoadd'; ?>

NOTE: each code will return the class name, so you need to leave a space like <?php ... ?> <?php ... ?> <?php ... ?>
You can replace the class name

what kind of query do i have to place to load 3 user groups at the same time in one list? right now i use "group_id=10" to launch a group list.
sorry, we forgot about this :D. You can find also this example at docs page: http://docs.easy-profile.com/index.php/article/sql-custom-where
  1. more than a month ago
  2. General
  3. # 7
  • 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.