Log in

View Full Version : Help changing post background of currently logged in user


Azum
06-25-2013, 07:11 PM
In vB 4.2.0:

Can anyone tell me how I can change the background of any posts made by the currently logged in user? I think I need to do it in postbit.css, as I can get the desired outcome there... but the vb:if statement I'm using isn't working. I'm sure it's something trivial that I don't know about.

I've been trying various conditionals in the:
.postbitlegacy .postbody, .eventbit .eventdetails .eventbody

Lynne
06-25-2013, 11:17 PM
And what is the if statement you have been trying to use?

Azum
06-26-2013, 12:00 AM
And what is the if statement you have been trying to use?

Various ones such as

<vb:if condition="$threadinfo['postuserid'] == $bbuserinfo['userid']">stuff here</vb:if>

<vb:if condition="$userinfo['userid'] == $bbuserinfo['userid']">stuff here</vb:if>

Lynne
06-26-2013, 12:49 AM
Those aren't variables available in the .css templates. You'll need to do something in the postbit template to give the <div> another class if the post userid is the same as the viewer userid ($post['userid'] == $bbuserinfo['userid']) and then you can add some CSS to the additional.css template to set that class background to a certain color.

Azum
06-26-2013, 02:15 AM
Those aren't variables available in the .css templates. You'll need to do something in the postbit template to give the <div> another class if the post userid is the same as the viewer userid ($post['userid'] == $bbuserinfo['userid']) and then you can add some CSS to the additional.css template to set that class background to a certain color.

Could you possibly elaborate a little more on the "give the <div> another class" part?

--------------- Added 1372223285 at 1372223285 ---------------

Okay so I tried adding a div class to postbit_legacy

<vb:if condition="$post['userid'] == $bbuserinfo['userid']"><div class="postme"></vb:if>
<div class="postrow<vb:if condition="$show['postedited'] || $post['signature']"> has_after_content</vb:if>">
{vb:raw template_hook.postbit_messagearea_start}
<vb:if condition="$post['title'] OR $show['messageicon']">
<h2 class="title icon">
<vb:if condition="$show['messageicon']"><img src="{vb:raw post.iconpath}" alt="{vb:raw post.icontitle}" /> </vb:if>{vb:raw post.title}
</h2>
</vb:if>

<vb:if condition="$post['isfirstshown']">
{vb:raw ad_location.ad_showthread_firstpost_start}
{vb:raw ad_location.thread_first_post_content}
</vb:if>
<vb:if condition="$post['islastshown']">
{vb:raw ad_location.thread_last_post_content}
</vb:if>
<div class="content<vb:if condition="$show['first_ad'] OR $show['last_ad']"> hasad</vb:if>">
<div id="post_message_{vb:raw post.postid}">
<blockquote class="postcontent restore ">
{vb:raw post.message}
</blockquote>
</div>

and the opposite condition for div class="postbody"

<vb:if condition="!$post['userid'] == $bbuserinfo['userid']">

Then I added the postme to the postbit.css

Result was double posts in every single thread! Pretty funny, but not what I was aiming for.

Amaury
06-26-2013, 02:27 PM
To change the background, simply edit the postbit_background style variable.

Azum
06-26-2013, 06:08 PM
To change the background, simply edit the postbit_background style variable.

Right, but what I'm trying to do is when John Doe logs in and views a thread, only the background of his posts in that thread are a different color. I'll keep at it as time permits. My lack of web/programming background is killing me.