PDA

View Full Version : Code for post background not working


xeenux
01-14-2013, 09:58 PM
I wanted post backgrounds to change based on your rank so I found this.

I created a plug in with this tutorial:

Hey There,

This is a quick & dirty fix.

Add this plugin to your postbit_display_start hook:

PHP Code:
if($this->post->usergroupid == 6) {
$this->post['is_admin'] = true;
}
Find the div in your postbit template with the postrow class, and edit it.

Before:
HTML Code:

<div class="postrow">

After:
HTML Code:

<div class="postrow" <vb:if condition="$post['is_admin']">style="background-color: #ddd"</vb:if>>

Change the #ddd to whatever color you want.

No guarantees, but that should work .

-Nick, SEOvB Developer

However after placing everything in the correct location it still does not work.

The post does not change color like it should, and instead leaves it like it were before.

I've already double checked that my id is 6 and it is. Any other ideas?

kh99
01-14-2013, 10:16 PM
I'm not sure -> works with an array. I think maybe you want:

if($this->post['usergroupid'] == 6) {
$this->post['is_admin'] = true;
}

also, you don't really need the plugin, you could just use this:

<div class="postrow" <vb:if condition="$post[usergroupid] == 6">style="background-color: #ddd"</vb:if>>


Another thing you can do, if you wanted to make different colors for different groups (or whatever) is that you could make a class for each one (in additional.css) where the usergroupid is part of the class name, then add a class using the usergroupid as part of it, like:

<div class="postrow postbg_{vb:raw post.usergroupid}">


and then in the css:

.postbg_6 {
background-color: #ddd
}