Target post BG colour

Discussion forum for MOD Writers regarding MOD Development.
Locked
GTFO. snuggles
Registered User
Posts: 42
Joined: Mon Feb 04, 2008 1:53 am
Location: Edinburgh, UK

Target post BG colour

Post by GTFO. snuggles »

Hey,

I'm trying to find out where I can change the colour of the background for posts that the user created.

Anyone know?
xxxopenxxx
Registered User
Posts: 34
Joined: Thu Jan 10, 2008 11:07 pm

Re: Target post BG colour

Post by xxxopenxxx »

Hi, I am currently working on a mod that will do this and more. I assume you do not want to wait for it,so I'll give you the code that will do what you want. Please be warned that there may be a better way of doing this and that my code may be sloppy because I'm still working on it.

WARNING: Please make a backup of all files before doing any of these edits.

Open \includes\functions.php
Find

Code: Select all

'T_STYLESHEET_NAME'		=> $user->theme['theme_name'],
Add After

Code: Select all

'P_USERNAME'			=>$user->data [username],
(I assume you're using the prosilver template, so this will work for prosilver.)

Open \styles\prosilver\templateviewtopic_body.html
Find

Code: Select all

<div id="p{postrow.POST_ID}" class="post <!-- IF postrow.S_ROW_COUNT is odd -->bg1<!-- ELSE -->bg2<!-- ENDIF -->
Replace With

Code: Select all

<div id="p{postrow.POST_ID}" class="post <!-- IF  P_USERNAME == postrow.POST_AUTHOR -->bg5<!-- ELSEIFIF postrow.S_ROW_COUNT is odd -->bg1<!-- ELSE -->bg2<!-- ENDIF -->
In the ACP, under Style > Themes > Prosilver
Find

Code: Select all

.bg3	{ background-color: #ebebeb; }
Add After

Code: Select all

.bg5	{ background-color: #NEWCOLOR; }
I hope this helps, please have a look at my mod when I post it. Also, if you do change or improve the code, or you have suggestions, PLEASE let me know. I will give you full credit :D

EDIT: Also, let me know how things go with this code, TY
GTFO. snuggles
Registered User
Posts: 42
Joined: Mon Feb 04, 2008 1:53 am
Location: Edinburgh, UK

Re: Target post BG colour

Post by GTFO. snuggles »

I sooooo didn't think about doing that.

Good game tbh.
GTFO. snuggles
Registered User
Posts: 42
Joined: Mon Feb 04, 2008 1:53 am
Location: Edinburgh, UK

Re: Target post BG colour

Post by GTFO. snuggles »

Worked a treat bud.

Just incase you were copying and pasting there is an error with:

Code: Select all

'P_USERNAME'         =>$user->data [username],
The single quotes being missing:

Code: Select all

'P_USERNAME'         =>$user->data ['username'],
Only other thing I changed was the name for the new colour, I called it bg_author as that will possibly mean more to someone if they go prodding around my CSS to update the forum once I hand it across.

Other than that (although the above aint exactly major) f'in superb.
User avatar
Brf
Support Team Member
Support Team Member
Posts: 52229
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: Target post BG colour

Post by Brf »

Instead of putting in that new P_USERNAME, you can use the standard S_USERNAME
xxxopenxxx
Registered User
Posts: 34
Joined: Thu Jan 10, 2008 11:07 pm

Re: Target post BG colour

Post by xxxopenxxx »

GTFO. snuggles wrote:Worked a treat bud.

Just incase you were copying and pasting there is an error with:

Code: Select all

'P_USERNAME'         =>$user->data [username],
The single quotes being missing:

Code: Select all

'P_USERNAME'         =>$user->data ['username'],
Only other thing I changed was the name for the new colour, I called it bg_author as that will possibly mean more to someone if they go prodding around my CSS to update the forum once I hand it across.

Other than that (although the above aint exactly major) f'in superb.
Yeah, my fault. Thank you. The lack of a meaningful name was because I needed to clean up the code.
Brf wrote:Instead of putting in that new P_USERNAME, you can use the standard S_USERNAME
Yeah, thank you. Like I said, I need to clean up the code. Thanks though!
Locked

Return to “[3.0.x] MOD Writers Discussion”