BullGuard Antivirus Sale - 60% Off with openElement !
Forum openElement Homepage
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: 02 Août 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: 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


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

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

Joined: 02 Août 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: 13 Jan 2017 at 16:46
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 10.11
Copyright ©2001-2012 Web Wiz Ltd.

This page was generated in 0,016 seconds.