TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,973
  • Latest: NonStop
Stats
  • Total Posts: 196,236
  • Total Topics: 21,353
  • Online today: 577
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 307
  • Total: 307

Sticky news posts

Started by boyo, March 09, 2008, 01:35:56 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

boyo

I am setting up a new site using SMF 1.1.4 and TP 0.9.8 and am starting to customize it. I have a forum dedicated to front page news, and have news posted in it; but what I need to be able to do is sticky a topic on the front page news forum and it stay on top on the front page. Was wondering if this was possible at all without modifying the code by hand.

I searched everything I could think of, and couldnt find anything.


IchBin

Not possible with board news. You can do it with an article, but not with board news.

boyo

Hope you dont mind ,but I found a way.

Open /Sources/TPortal.php
Goto line 1760.
It should read
QuoteORDER BY t.ID_FIRST_MSG DESC
Change it to read
QuoteORDER BY t.isSticky DESC, t.ID_FIRST_MSG DESC

And whala, you have your stickied posts stay at the top, and your non-sticky's underneath. All you have to do is unsticky it in the forum for it to drop back into it's natural place.

Hope this is helpful to someone else, as I couldn't find an answer.

rumboogy

It does seem to work...and I don't get any errors. Are there any "caveats" to this hack?   :D

Wally

boyo

I haven't seen any myself yet, it just seems to work. All it's changing is the sort order in the query for the news.

rumboogy

Actually, I thought it worked...and maybe it does for NEWS, but for general sticky posts...it is not staying at the top of my most recent blocks. Thanks though.

Wally

boyo

I would imagine the most recent posts would be in a different spot for the query, as it's looking at the entire board not just the selected forums for news, so I would not expect it to work for most recent, however, I would imagine that would be in done in a similar fashion.

rumboogy

hmmm...I may have to look for that.

Thanks,

Wally

rumboogy

OK...that didn't take long. I just don't have the experience yet to find it. I downloaded and looked, but I don't know the coding.

Thanks and hope yours works out well.

Wally

rumboogy

Quote from: boyo on March 10, 2008, 06:17:27 PM
I would imagine the most recent posts would be in a different spot for the query, as it's looking at the entire board not just the selected forums for news, so I would not expect it to work for most recent, however, I would imagine that would be in done in a similar fashion.
Any chance you could see how difficult this could be...just curious. If it doesn't take much time...it might even prove useful for you.  ;)

Wally

This website is proudly hosted on Crocweb Cloud Website Hosting.