Print Page | Close Window

Coloring user name according to level?

Printed From: openElement Website
Category:

openElement


Forum Name: Dynamic OE - Databases, etc
Forum Description: openElement's database management system and Element Packs
URL: https://forums.openelement.uk/en/forum_posts.asp?TID=939
Printed Date: Apr 19 2024 at 8:41pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Coloring user name according to level?
Posted By: djju1029
Subject: Coloring user name according to level?
Date Posted: Jan 12 2017 at 8:11pm
Hi! OE team,

I use Packs #61:'Show User' element: several formants for displaying user name and status.
However, I want to color user name according to user level which is set in user-profile-edit.
For example, if admin is admin level; level 10, then it would be displayed RED such as admin.
or if user1 is customer level; level 1, then it would be displayed BLUE such as user1.

How can I apply this feature using OE?

I always appreciate your kind and prompt help!

DJ



Replies:
Posted By: Dmit OE
Date Posted: Jan 12 2017 at 10:12pm
Hi,

You can use the Pack 70 (in "[Advanced]" branch), delete all except the field element to the right of "Access rights". This field will display the user's acces right: 1 for basic user, 10 for admin, anything else for advanced. You can hide this field (uncheck the property Visible), add a Custom Class "level".
Add a Custom Class "user" onto the element showing the user, then get the level in a Code Block (Source) type JavaScript:

$(function(){
  var level = parseInt($('.level  input').val()); // 1=basic, 10=admin, 4 or 5 = advanced
  $('.user').addClass('user-color user-color' + level);
});

Then add a Code Block Source type CSS position HEader with the code:

.user-color { /* default = advanced user */
   color: green !important;
}
.user-color1 { color: blue !important; } /* basic user */
.user-color10 { color: red !important; } /* admin */

If it does not work I will need the link.


Posted By: djju1029
Date Posted: Jan 13 2017 at 3:46pm
It works! Thank you! You are really my mentor!



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net