How to change the color of First post of the topic

Looking for an Extension? Have an Extension request? Post your request here for help. (Note: This forum is community supported; while there is an Extensions Development Team, said team does not dedicate itself to handling requests in this forum)
Get Involved
Post Reply
User avatar
KhurramMunawar
Registered User
Posts: 534
Joined: Tue Mar 25, 2014 2:20 am
Location: Islamabad, Pakistan
Name: Khurram Munawar
Contact:

How to change the color of First post of the topic

Post by KhurramMunawar »

Is there any possibility to change the color of the first post of the topic ? (first post only )

many thanks
Get Free Traffic To Your Website
Trafficonic.com - Free Traffic To Your Website
User avatar
david63
Registered User
Posts: 20646
Joined: Thu Dec 19, 2002 8:08 am

Re: How to change the color of First post of the topic

Post by david63 »

Which colour do you want changing? Text? Background? Border? or something else?

Is this "new" colour an existing colour of the style or is it any colour that the User chooses?

Is the colour defined by the Admin or the User when posting?

Does the same colour apply to all fora or is it selectable by forum?

It would help when making an extension request if you could be specific as to what you want - that way you may stand a chance of somebody actually doing it.
David
Remember: You only know what you know and - you don't know what you don't know!

I now no longer support any of my extensions but they will start to become available here
User avatar
ViolaF
I've Been Banned!
Posts: 1609
Joined: Tue Aug 14, 2012 11:52 pm

Re: How to change the color of First post of the topic

Post by ViolaF »

i think, he means the background-colour of the post itself ;)
User avatar
Ger
Registered User
Posts: 2107
Joined: Wed Jan 02, 2008 7:35 pm
Location: 192.168.1.100
Contact:

Re: How to change the color of First post of the topic

Post by Ger »

Should be quite easy to pass the $topic_data['topic_first_post_id'] to the template and add a class indicating the first post to the post div. You can assign any CSS you like to that class.
My extensions:
Simple CMS, Feed post bot, Avatar Resize, Modbreak, Magic OGP, Live topic update, Modern Quote, Quoted Where (GDPR) and Autoresponder.
Newest: FAQ manager for 3.2

Like my work? Buy me a coffee to keep it coming. :ugeek:

-Don't PM me for support-
User avatar
KhurramMunawar
Registered User
Posts: 534
Joined: Tue Mar 25, 2014 2:20 am
Location: Islamabad, Pakistan
Name: Khurram Munawar
Contact:

Re: How to change the color of First post of the topic

Post by KhurramMunawar »

i just want to make the first post prominent than the replies.
and that could be by changing the post Background color or the text color.

and that should apply to all first posts of all the topics in the fora.

Thanks
Get Free Traffic To Your Website
Trafficonic.com - Free Traffic To Your Website
User avatar
KhurramMunawar
Registered User
Posts: 534
Joined: Tue Mar 25, 2014 2:20 am
Location: Islamabad, Pakistan
Name: Khurram Munawar
Contact:

Re: How to change the color of First post of the topic

Post by KhurramMunawar »

Ger wrote: Wed Nov 22, 2017 3:16 pm Should be quite easy to pass the $topic_data['topic_first_post_id'] to the template and add a class indicating the first post to the post div. You can assign any CSS you like to that class.
thanks for the suggestion.
I am not very good in doing as you directed. I need complete tutorial :mrgreen:
Get Free Traffic To Your Website
Trafficonic.com - Free Traffic To Your Website
User avatar
Ger
Registered User
Posts: 2107
Joined: Wed Jan 02, 2008 7:35 pm
Location: 192.168.1.100
Contact:

Re: How to change the color of First post of the topic

Post by Ger »

Well, you create an extension (might want to use the Skeleton Extension tool) that uses the event core.viewtopic_modify_post_row
Than create a function that's called upon that event:

Code: Select all

public function is_first_post($event)
{
    $post_row = $event['post_row'];
    $topic_data = $event['topic_data'];
    $post_row['S_TOPIC_FIRST_POST'] = ($post_row['POST_ID'] == $topic_data['topic_first_post_id']);
    $event['post_row'] = $post_row;
}
Next, you create 2 template files that hook into viewtopic_body_postrow_post_before and viewtopic_body_postrow_post_after to add a surrounding div like

Code: Select all

<!-- IF S_TOPIC_FIRST_POST --><div class="topic_first_post"><!--ENDIF -->
and

Code: Select all

<!-- IF S_TOPIC_FIRST_POST --></div><!--ENDIF -->
And you create a CSS file that has something like

Code: Select all

.topic_first_post .post {
	background-color: #F00; 
}
Please note that I've just written this from the top of my head so totally untested and it might just as well be bugged :mrgreen:
My extensions:
Simple CMS, Feed post bot, Avatar Resize, Modbreak, Magic OGP, Live topic update, Modern Quote, Quoted Where (GDPR) and Autoresponder.
Newest: FAQ manager for 3.2

Like my work? Buy me a coffee to keep it coming. :ugeek:

-Don't PM me for support-
User avatar
KhurramMunawar
Registered User
Posts: 534
Joined: Tue Mar 25, 2014 2:20 am
Location: Islamabad, Pakistan
Name: Khurram Munawar
Contact:

Re: How to change the color of First post of the topic

Post by KhurramMunawar »

Thank you so much for the great help.
Get Free Traffic To Your Website
Trafficonic.com - Free Traffic To Your Website
Post Reply

Return to “Extension Requests”