Skip to Content Skip to Menu

🎃 Happy Halloween! Treat yourself with an awesome discount on memberships! Get 20% off now with code SPOOKY-2024!

Background by User-ID in list and profile view

  • Overtone
  • Overtone
  • OFFLINE
  • Posts: 22
  • Thanks: 0
  • Karma: 0
10 years 11 months ago #237759 by Overtone
Is it possible to set (for example) a blue background for User 203 and a red background for User 207? This settings should be used in any list and profile view!

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48475
  • Thanks: 8281
  • Karma: 1443
10 years 11 months ago #237827 by krileon
Profiles don't have a class that's user id specific. Same for userlist rows. You could use CB Auto Actions to add CSS to a user profile and check for user id in the conditional, but this usage isn't going to work for userlists.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

  • Overtone
  • Overtone
  • OFFLINE
  • Posts: 22
  • Thanks: 0
  • Karma: 0
10 years 11 months ago - 10 years 11 months ago #237862 by Overtone
Replied by Overtone on topic Background by User-ID in list and profile view
I had found an easy workaround:
New Field (field type = Drop down (Single Select)) maybe "Background-Color" with all colors you need!
This small Script in components\com_comprofiler\plugin\templates\default\default.php:
Code:
if ( $user->cb_BackgroundColor ) { echo "\t\t<tr style=\"background:".$user->cb_BackgroundColor.";\" class=\"$class\" ".$style.">\n"; } else { echo "\t\t<tr class=\"$class\" ".$style.">\n"; }

instead of
Code:
echo "\t\t<tr class=\"$class\" ".$style.">\n";

in line 496!

Now every user can choose the color he want in his profile edit area!
Last edit: 10 years 11 months ago by Overtone.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48475
  • Thanks: 8281
  • Karma: 1443
10 years 11 months ago #237912 by krileon
That can be done using CB Auto Actions without having to edit a single line of core code. That also will be completely invalid in next CB release as the templates have been rewritten. Using CB Auto Actions you'll use a Code action on the before profile display trigger then set method to CSS and supply your CSS there (there's a class surrounding the entire CB profile).


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

  • Overtone
  • Overtone
  • OFFLINE
  • Posts: 22
  • Thanks: 0
  • Karma: 0
10 years 11 months ago #237926 by Overtone
Replied by Overtone on topic Background by User-ID in list and profile view
This is only a little problem. I can override the template after every update. But you write in your first message "CB Auto Actions will NOT work for userlists"?

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48475
  • Thanks: 8281
  • Karma: 1443
10 years 11 months ago #237929 by krileon
CB Auto Actions will work fine on userlists, but userlists rows are not unique per user id. They are unique by row index. So for example the first row is #cbU0.

You could use jQuery in a code action to alter the DOM and add to the rows as needed. For example to do this you'd add the color field to the userlist so it outputs the value as a field. You'd then use jQuery to grab the fields value (each field is surrounded by a unique id) looping through each row then adding the value to the row as CSS then removing the field from display.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum