Firefox PHP

Be able to post Sticky posts

Posted by mili 
Be able to post Sticky posts
February 04, 2003 08:04AM
It would be nice for admins and mods to be abe to post stickies, posts that would always stay at the top in which rules and regulations could be posted.

Re: Be able to post Sticky posts
July 04, 2003 08:59PM
There's another thread here that's been talking about this for a while so apologies if this covers the same ground.

The simple trick to this is to make the modifystamp in the forum database into a value that corresponds to a date well in the future. I used 2000000000 (9 zeros) which is a date sometime in 2033!

If you can access your data tables this is easy as a bodge for the odd topic. remember to close the thread (closed=1) too or the first person to reply breaks it!

If you want to do the job better, try this:

1. hack moderators.php to include a case statement in the main switch to capture a new "make sticky" event.

go to line 126 (yes, the gap between existing case statements) and add

// hack to keep a topic on top ("sticky")

case "sticky":
$sSQL="Update $ForumTableName set modifystamp=2000000000, closed=1 WHERE thread=$t";
$q->query($DB, $sSQL);
header("Location: $read_page.$ext?f=$num&i=$t&t=$t$GetVars");

2. hack read.php to include a new nav element that allows the mod(s) to make a topic sticky.

go to line 578 or so and add (as new lines)
<!-- hack to keep a message "sticky" -->
&nbsp;|&nbsp;<a href="<?php echo "$forum_url/moderator.$ext?mod=sticky&f=$ForumId&i=$rec_id&t=$thread$GetVars";?>"><FONT color='<?php echo $ForumTableBodyFontColor1; ?>' class="PhorumNav">Make Sticky</font></a>
<!-- end of hack -->

3. hack include/threads.php to display a "sticky topic" warning if you so wish.

go to line 55 and check it reads $t_latest=date_format($trec["latest"]);

add these lines immediately after that line

if ($t_latest == "18.05.33 05:33" ) {
$t_latest = "Sticky topic";

This last part relies on a horrid bodge that depends upon the date format (set at the bottom the language template (see lang directory) and quite likely to be different for different countries - so this will EASILY break). Leave it out if you're unsure, it's purely cosmetic and just avoids displaying a date way off in the future.

If you do want to use this, then you MUST change the 18.05.33 05:33 string to exactly match the format displayed by other posts on your system. Typically this might be 05/18/33 05:33, for example, in the USA. Don't change the values - just the delimiters and order etc.

(Can someone cleverer than me figure out how to capture this BEFORE the date/time gets generated by the convfunc() call in the actual SQL command?)

Hope this helps.
Re: Be able to post Sticky posts
July 14, 2003 09:01PM
If you'd rather open the post up instead of deleting it when you don't want/need it sticky anymore, you can change in moderator.php

case "close":
$sSQL="Update $ForumTableName set closed=$closevar WHERE thread=$t";

- to -

case "close":
if($closevar == 0){
$sSQL="Update $ForumTableName set closed=$closevar, modifystamp=$NOW WHERE thread=$t";
$sSQL="Update $ForumTableName set closed=$closevar WHERE thread=$t";

Re: Be able to post Sticky posts
September 18, 2003 10:41AM

I changed the 'modifystamp' in the forum database to 2000000000, but my topic doesn't appaer at the top :(
I'm using phorum v. 3.4... could someone help me?

Sorry, you do not have permission to post/reply in this forum.