Hi,
I'm trying to implement a per usergroup post color for my forums, but running into a wall in the implantation. I have the CSS that appropriately changes the posts' font color, but trying to get it to apply only to a certain role doesn't appear to be working. I Google'd it in an attempt to see if there was a solution, but the only two threads I came across didn't have solutions that worked for me.
.role-administrator .Comment .Meta .Author a { color: #FFC125 !important; }
or similar doesn't seem to do anything. How do I also handle the fact that I've changed the name of the group? I tried referencing it by the role ID number, but I can't get anything to work.
You probably have to write a plugin or go to the helper_functions.php and add a .roletitle class to the discussion. or if you used a plugin - you may be able to modify it there. But since you didn't mention a plug-in I assume it doesn't refer to a plugin.
then add a css rule for it.
factoid: Most questions have been previously answered, try the search box first, please provide your Vanilla version Number!
Peregrine's Addons - donations gladly accepted for "successful solutions" and addons - kind of like tipping a waiter at a restaurant
Answers
You habe to look at how the comment divs are being generated and add the something to uniquely identify them with the role or userid or whatever.
This will require a plugin or a theme that overrides some core files.
Vanilla Wiki, Tastes Great! 31,000 viewers can't be wrong.
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •I figured it out partially, as RoleTitles does append some CSS rules to the .Comment container formatted like: .role-[role-title].
But the problem is this only affects Comments and not the original discussion. I tried modifying RoleTitles to append CSS definitions to the .Item class, but was running into a wall there. If somebody knows how to do that, then please go ahead else if I figure it out I'll post it here!
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •throw up a link to your site, so we can see.
factoid: Most questions have been previously answered, try the search box first, please provide your Vanilla version Number!
Peregrine's Addons - donations gladly accepted for "successful solutions" and addons - kind of like tipping a waiter at a restaurant
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •http://believe-tera.com/index.php/forum#/discussion/5/test-discussion
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •Got it. In discussion.php I replaced
<
div class="Item-Body"> with
<?php $Object = GetValue('Object', $Sender->EventArguments); $CssRoles = $Object ? GetValue('Roles', $Object, array()) : FALSE; foreach ($CssRoles as &$RawRole) $RawRole = 'role-'.str_replace(' ','_', strtolower(Gdn_Format::Url($RawRole))); echo '<div class="Item-Body ' . implode(' ',$CssRoles) . '">'; ?>Works great now.- Spam
- Abuse
- Troll
2 • Off Topic Insightful 2Awesome LOL •thats one for the WIKI
422 Real Estate Australia , now open Check it out
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •It's kind of a cheap workaround. If I had the time, I'd develop it into a full plugin. Maybe I should, I'll look into it.
- Spam
- Abuse
- Troll
2 • Off Topic Insightful 2Awesome LOL •cool thanks for the solution! i once tried to figure out something similar, only difference was that i wanted to set a post color for specific usernames
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •I believe the concept is very similar; you can just append their user ID # in the exact same way that I appended their role title and then theme each individual user.
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •thanks, won't be necessary anymore, because back then i just wanted to give the admins a certain color and i could do that with your solution. but i actually decided to not do that for equality reasons
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •factoid: Most questions have been previously answered, try the search box first, please provide your Vanilla version Number!
Peregrine's Addons - donations gladly accepted for "successful solutions" and addons - kind of like tipping a waiter at a restaurant
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •There is already a 'usergroup' or 'roletitle' plugin or something. Can you see if you can adjust that plugin? (if the plugin hasn't been updated in a while...)
What to do if I get a Bonk Error?
Vanilla Wiki : Join and help edit our Wiki! | View all Vanilla issues on GitHub | Report a new Vanilla issue on GitHub
Deploying a new Forum and adding a Theme | Give thanks to the Vanilla Developers!
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •I finished developing the plugin and I'm currently beta-testing/trying to make sure it doesn't break anything. All the code is based off the RoleTitles plugin and (unfortunately) slightly conflicts if you have both installed, but it doesn't seem to break anything, just sets all .Comment container ID's to "Comment role-admin role-admin". Adjusting the CSS still works though.
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •Which conflicts do you get? Is RoleTitle an old plugin? Show conflicts in the changelog?
What to do if I get a Bonk Error?
Vanilla Wiki : Join and help edit our Wiki! | View all Vanilla issues on GitHub | Report a new Vanilla issue on GitHub
Deploying a new Forum and adding a Theme | Give thanks to the Vanilla Developers!
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •@PewPewK
I looked at your link again. I'm not that great with css, but it seems like you've got lots of extra superfluous div tags to add classes, when you could just throw multiple classes into one or two div tags. Or this could be a result of using the two plugins.
factoid: Most questions have been previously answered, try the search box first, please provide your Vanilla version Number!
Peregrine's Addons - donations gladly accepted for "successful solutions" and addons - kind of like tipping a waiter at a restaurant
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •Right,
<li class="Item ItemComment role-guild-member role-guild-member" id="Comment_11">is caused by RoleTitles and my plugin conflicting as they both run code to affix the role CSS to the Comment container.I'm trying to figure out how to update the CssClass for Item-Body, but the similar code that updates the Comment container doesn't do anything in when changed to the Discussion implementation. I'm better at CSS, I've never touched PHP in my life so I'm just trying to go off my general C/Java programming knowledge here.
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •take a look a ignore user plugin to add to append to classes where Item class exists then try some css
e.g.
li.role-guild-member .Message {
div.role-guild-member .Message {
factoid: Most questions have been previously answered, try the search box first, please provide your Vanilla version Number!
Peregrine's Addons - donations gladly accepted for "successful solutions" and addons - kind of like tipping a waiter at a restaurant
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •