BullGuard Antivirus Sale - 60% Off with openElement !
Forum Home Forum Home >

openElement

> Dynamic OE - Databases, etc
  New Posts New Posts RSS Feed - Coloring user name according to level?
  FAQ FAQ  Forum Search   Register Register  Login Login

Coloring user name according to level?

 Post Reply Post Reply
Author
Message
djju1029 View Drop Down
Senior Member
Senior Member
Avatar

Joined: Aug 02 2016
Location: the US
Status: Offline
Points: 126
Post Options Post Options   Thanks (0) Thanks(0)   Quote djju1029 Quote  Post ReplyReply Direct Link To This Post Topic: Coloring user name according to level?
    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


Edited by djju1029 - Jan 13 2017 at 2:25pm
Back to Top
Dmit OE View Drop Down
Admin Group
Admin Group


Joined: May 31 2012
Status: Offline
Points: 5283
Post Options Post Options   Thanks (2) Thanks(2)   Quote Dmit OE Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
djju1029 View Drop Down
Senior Member
Senior Member
Avatar

Joined: Aug 02 2016
Location: the US
Status: Offline
Points: 126
Post Options Post Options   Thanks (0) Thanks(0)   Quote djju1029 Quote  Post ReplyReply Direct Link To This Post Posted: Jan 13 2017 at 3:46pm
It works! Thank you! You are really my mentor!
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.063 seconds.