Print Page | Close Window

Coloring user name according to level?

Printed From: Forum openElement
Category:

openElement


Forum Name: Dynamic OE - Databases, etc
Forum Description: openElement's database management system and Element Packs
URL: http://forum.openelement.com/fr/forum_posts.asp?TID=939
Printed Date: 14 Dec 2019 at 18:54
Software Version: Web Wiz Forums 10.11 - http://www.webwizforums.com


Topic: Coloring user name according to level?
Posted By: djju1029
Subject: Coloring user name according to level?
Date Posted: 12 Jan 2017 at 21:11
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: 12 Jan 2017 at 23:12
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: 13 Jan 2017 at 16:46
It works! Thank you! You are really my mentor!



Print Page | Close Window

Forum Software by Web Wiz Forums® version 10.11 - http://www.webwizforums.com
Copyright ©2001-2012 Web Wiz Ltd. - http://www.webwiz.co.uk