PDA

View Full Version : Admins and mods have different post backgrounds when posting.


DR AUTONAMUS
01-05-2009, 02:30 AM
When making a post is it possible to have the admins and mods have different post backgrounds when posting... so you can see what level they are(Usergroup)

If you would like pictures to explain what I mean just ask.

Kirk Y
01-05-2009, 02:46 PM
Find the class tag of that td cell in your postbit and use a conditional statement to switch it around depending on usergroup.

<td class="<if condition="is_member_of($post, X)">alt1</else>alt2</if>">...</td>

DR AUTONAMUS
01-06-2009, 08:29 AM
So this would allow me to have the post bits like these:

I know these are phpBB but this is were I got the Idea from.
Admin:
http://www.freeimageups.com/files/1/Misc/admin.jpg
Mod:
http://www.freeimageups.com/files/1/Misc/mod.jpg
User:
http://www.freeimageups.com/files/1/Misc/user.jpg

So I need to make 3 different colors for the post bit dependent on there user group... Maybe more for future groups.

Lynne
01-06-2009, 02:52 PM
Kirby's code is a bit off... it should be <else />, not </else>. But you can use a condition around any of the table column classes you want to change. It may be easier to 'read' if you do it this way:

<if condition="is_member_of($post, X)">
<td class="whatever">
<else />
<if condition="is_member_of($post, Y)">
<td class="whatever2">
<else />
<td class="alt1">
</if>
</if>


You'll need to do that for every td tag you want changed.

TimberFloorAu
01-06-2009, 03:08 PM
Can we alternate colour background on each subsequent post, within same usergroup?

Lynne
01-06-2009, 03:19 PM
I would guess so, but I think you would have to get a plugin involved then.

DR AUTONAMUS
01-06-2009, 03:26 PM
So this would be before every td tag in the postbit template ?

$post, X and $post, y would be the user groups?

and How would I make another alt# so I could have it on different styles

Lynne
01-06-2009, 03:41 PM
You would do that for every td tag that you wish to change. I've seen some users only want to change the post background and that would be here in red:
<if condition="$show['moderated']">
<td class="alt2" id="td_post_$post[postid]">
<else />
<td class="alt1" id="td_post_$post[postid]">
</if>

Make sure when you change it that all your <if> tags have a closing </if> tag.

x and y would be the usergroups.

To add another alt class, you would put it in the Main CSS for the style - at the bottom of that page.

SiK GambleR
01-06-2009, 03:54 PM
now, as a secondary question to this, what if instead of changing the postbit BG I wanted to change just the admin or mod's font color, is that possible?

Lynne
01-06-2009, 04:04 PM
Sure, you can either just change the class or add the css for the color inline there.

If you just want to change the background inline, instead of adding a new class, just go:
<td class="alt2" id="td_post_$post[postid]" style="background: #00ff00 url('smiley.gif') no-repeat fixed center;">(All just a thrown together example - don't use that code cuz I have no idea what you would produce!) Doing so for the font color would be similar.

SiK GambleR
01-06-2009, 06:15 PM
I can't seem to get it to work, any idea of what the code would be exactly? I have been toying for a little while ( I am still a noob with coding =[ )

MrEyes
01-06-2009, 07:50 PM
Not exactly what you wanted but the following might help...

I have added the following code to the end of my headinclude template:

<if condition="in_array($bbuserinfo[userid], array(800,799,773,1))">
<style>
body { background: #870000;}
.page { background: #870000; }
</style>
</if>

What this does is change the background colour for all pages for user ids 800, 799, 773 & 1.

This was done so that mods/admins would know that they were logged into a mod account and therefore prevent accidently posting stuff as an admin/normal user when the opposite is required.

Obviously you can change those user ids to whatever you want

Lynne
01-06-2009, 08:03 PM
I can't seem to get it to work, any idea of what the code would be exactly? I have been toying for a little while ( I am still a noob with coding =[ )
We can't tell what you did if you don't post the code your tried. Please use the code/php/html tags when you post it.

Mike-D
01-06-2009, 08:40 PM
Te easiest way is to use Marco's Post Background Color (https://vborg.vbsupport.ru/showthread.php?t=102339) AddOn. His AddOn is expandable in most ways and can be also added with the vB CSS Color Picker and Color Preview. Also the Permissions are pre-defined and can be used in a proper way :) IMO one of the best AddOns ever ;)

Lynne
01-06-2009, 08:47 PM
Wow, I didn't know that existed. Learn something new every day!

SiK GambleR
01-07-2009, 01:17 AM
OK, so I messed around a little, and I used this code (a friend helped me, as I said, I am a noob to vBulletin code, I have no idea what anything is or what to do/place things in):

<if condition="in_array($bbuserinfo[userid], array(2))">
<style>
body,td,th {
color: #60fffd;

</style>
</if>


I don't know where to place that, because if I put it in the postbit template, then it just edits the actual postbit, which is how it should work.

I, however, want to edit the BODY of the post.

Any ideas?

Lynne
01-07-2009, 02:28 AM
That code is not going to do anything in regards to what the original post in this thread is about - changing the post background depending on who makes the post. That will change the whole *sites* background color based on who is viewing the page.

DR AUTONAMUS
01-22-2009, 10:14 PM
To add another alt class, you would put it in the Main CSS for the style - at the bottom of that page.

What would that need to look like?

Lynne
01-22-2009, 10:27 PM
Something like this depending on what you want:

.whatever {background-color: orange;}

Here's a reference page - CSS Background Properties (http://www.w3schools.com/css/css_background.asp)

DR AUTONAMUS
01-22-2009, 10:30 PM
Thanks :)

Prohibit
01-28-2012, 01:21 PM
Does anyone know of a way to get this working on vb4?

Thank you in advance.

nerbert
01-29-2012, 02:29 AM
In postbit template go down to about line 90 and modify:


<div class="postbody"
<vb:if condition="$post['usergroupid'] == 5">style="background-color:red;"</vb:if>
<vb:if condition="$post['usergroupid'] == 6">style="background-color:blue;"</vb:if>>