UBB.Dev
Posted By: Ian_W Sticky Threads - 06/17/2002 1:57 AM
It would be a great idea if before the title of any sticky posts it said Sticky or Announcement etc. At the moment it is not easy to see if a post is sticky or not.

Ian.

Posted By: JustDave Re: Sticky Threads - 06/17/2002 2:02 AM
Perhaps having a special icon that was only displayed with sticky posts. It would be used no matter what the chosen icon was by the poster.

Perhaps a graphic of a bright red pin that's used on bulletin boards?

This is probably an easy hack. Anyone else interested in this?
Posted By: Gardener Re: Sticky Threads - 06/17/2002 2:53 AM
Something would be good at least, my users got very confused the first time I used it and new users will probably be in the future as well.
Posted By: JustDave Re: Sticky Threads - 06/17/2002 4:54 AM
In your postlist.php script find this:

code:

// Setup the postrow array
$postrow[$z]['color'] = $color;
$postrow[$z]['indentsize'] = "0";
$postrow[$z]['folder'] = $folder;



and change it to this:

code:

if ($Sticky) {
$Subject = "<span class="new"><em>(sticky)</em></span> $Subject";
}
// Setup the postrow array
$postrow[$z]['color'] = $color;
$postrow[$z]['indentsize'] = "0";
$postrow[$z]['folder'] = $folder;





That should do it.
Posted By: caymuc Re: Sticky Threads - 06/17/2002 2:20 PM
Good idea, it just does not work, $Sticky seems to have no value at that time. I placed the hack further down, below:

code:

// ----------------------------------------------------------
// If this post is sticky then we need to use the sticky date
if ($Sticky) {
$time = $html -> convert_time($Sticky,$user['U_TimeOffset']);
} else {
if ($view != "expanded") {
$time = $html -> convert_time($Last_Post,$user['U_TimeOffset']);
}
else {
$time = $html -> convert_time($Posted,$user['U_TimeOffset']);
}
}




and now it works here.
Posted By: caymuc Re: Sticky Threads - 06/17/2002 3:03 PM
And, what about this:

$Subject = "[<img src="{$config['images']}/ascend.gif" {$images['descend']} border="0" alt="" align="absmiddle" /> <span class="new">Info:</span> $Subject]";
Posted By: JustDave Re: Sticky Threads - 06/17/2002 3:38 PM
That's odd, the code I showed was down below

code:

// ----------------------------------------------------------
// If this post is sticky then we need to use the sticky date
if ($Sticky) {
$time = $html -> convert_time($Sticky,$user['U_TimeOffset']);
} else {
if ($view != "expanded") {
$time = $html -> convert_time($Last_Post,$user['U_TimeOffset']);
}
else {
$time = $html -> convert_time($Posted,$user['U_TimeOffset']);
}
}



quite aways. I figured it had a value be then?
Posted By: Lisa_P Re: Sticky Threads - 06/18/2002 1:57 AM
The code:
code:
// Setup the postrow array
$postrow[$z]['color'] = $color;
$postrow[$z]['indentsize'] = $indentsize;
$postrow[$z]['folder'] = $folder;



appears around line 133. It's very similar to the code you said to find -- the only difference is [:"red"]$indentsize;[/] instead of [:"red"]"0"[/]. I may have easily made the same mistake if I hadn't read this whole thread first!

Thank you!
Posted By: JustDave Re: Sticky Threads - 06/18/2002 2:04 AM
Thanks for clarifying

I always have second thoughts about mentioning line numbers because mine are usualy messed up from playing... lol

You could use this little hack to even specify a special icon such as the red pin for sticky posts. There's been a few times people thought something was broke but then discovered it was a sticky post doing exactly what it was ment to do... lol (myself included)
Posted By: yors Re: Sticky Threads - 06/18/2002 8:35 AM
The initial code dave gave (hey, that rhymes!!) works fine. You just have to be carefull to place it in the 2nd instance where it appears (around line 864 of a clean script if I remember correctly). Also, you can change (sticky) up there to Sticky: or whatever you want to appear.

Thanks dave.
Posted By: yors Re: Sticky Threads - 07/04/2002 9:17 AM
ummm....it was working in 6.0 br2, but now in 6.0.1 it isnt working Any ideas?
Posted By: JustDave Re: Sticky Threads - 07/04/2002 9:34 AM
Try placing the hack in down around line 873. You should see these lines:

code:

// Setup the postrow array
$postrow[$z]['color'] = $color;
$postrow[$z]['indentsize'] = "0";
$postrow[$z]['folder'] = $folder;




Hope that helps. Not sure if that's the right spot. Just guessing.
Posted By: Lisa_P Re: Sticky Threads - 07/17/2002 9:42 PM
This could probably be written up and moved to Beta or even Finished hacks -- works fine on our board.

I changed it from having the word "(sticky)" to having a small graphic []http://www.fishingfordeals.com/forums/images/pushpin.gif[/]. I uploaded a screen shot if someone wants to see what it looks like using the graphic.

To use a graphic instead of the word "(sticky)", I simply changed this:
code:
if ($Sticky) {
$Subject = "<span class="new"><em>(sticky)</em></span> $Subject";
}



to this:
code:

if ($Sticky) {
$Subject = "<img src="{$config['images']}/pushpin.gif" border="0" /> $Subject";
}



Attached picture 52695-stickypic.jpg
Posted By: msula Re: Sticky Threads - 07/17/2002 10:41 PM
I like it!
Posted By: AllenAyres Re: Sticky Threads - 07/18/2002 5:25 AM
thanks, works well here

For xhtml compliance and just something that explains it to the newbie a bit better, you might want it to be something like this:

code:

if ($Sticky) {
$Subject = "<img src="{$config['images']}/pushpin.gif" border="0" alt="sticky" /> $Subject";
}



I looked for a language file entry for "sticky" but it just ain't there
Posted By: JoshPet Re: Sticky Threads - 07/18/2002 5:36 AM
Very cool. Going to try this out this weekend.

Now.... if someone could do something similar if there is a file attached include this "disk" or paper clip icon, we'd be in heaven.
Posted By: JustDave Re: Sticky Threads - 07/18/2002 5:56 AM
I think if you changed line 617 in your postlist.php script from this:

code:

SELECT t1.B_Number,t1.B_Parent,t1.B_Username,t1.B_Posted,t1.B_Last_Post,t1.B_Subject,t1.B_Main,t1.B_Status,t1.B_Approved,t1.B_Icon,t1.B_Reged,t1.B_Counter,t1.B_Sticky,t1.B_Replies,t1.B_Rating,t1.B_Rates,t1.B_RealRating,t2.U_Color,t2.U_Status



to this:

code:

SELECT t1.B_File,t1.B_Number,t1.B_Parent,t1.B_Username,t1.B_Posted,t1.B_Last_Post,t1.B_Subject,t1.B_Main,t1.B_Status,t1.B_Approved,t1.B_Icon,t1.B_Reged,t1.B_Counter,t1.B_Sticky,t1.B_Replies,t1.B_Rating,t1.B_Rates,t1.B_RealRating,t2.U_Color,t2.U_Status



and then changed line 690 from this:

code:

list($Number,$Parent,$Username,$Posted,$Last_Post,$Subject,$Main,$Open,$Approved,$icon,$Reged,$Counter,$Sticky,$Replies,$Rating,$Rates,$stars,$Color,$PostStatus) = $dbh -> fetch_array($sth);



to this:

code:

list($File,$Number,$Parent,$Username,$Posted,$Last_Post,$Subject,$Main,$Open,$Approved,$icon,$Reged,$Counter,$Sticky,$Replies,$Rating,$Rates,$stars,$Color,$PostStatus) = $dbh -> fetch_array($sth);



and then just above this on line 873:

code:

// Setup the postrow array



add this:

code:

if ($File) {
$Subject = "<img src="{$config['images'}/disk.gif" border="0" alt="$File" /> $Subject";
}



and that should do the trick.

You could also turn the disk.gif into a link to the file too.

Example:
code:

$Subject = "<a href="{$config['fileurl']}/$File"><img src="{$config['images'}/disk.gif" border="0" alt="$File" /></a> $Subject";



(ps. I haven't actually done this so it may not work... please let me know if it does... lol)
Posted By: JoshPet Re: Sticky Threads - 07/19/2002 5:29 AM
Thanks Lisa & Dave... the Stickey note thing is Awesome!

Dave, I think you're close on the Icon for an attachment... but....

There were a few typos.... which I was dosh garn impressed that I figured out.

This line:
$Subject = "<img src="{$config['images'}/disk.gif" border="0" alt="$File" /> $Subject";

Should be:
$Subject = "<img src="{$config['images']}/icons/disk.gif" border="0" alt="$File" /> $Subject";

Note to fill in the ] after 'images'
insert the subdirectory /icons/disk.gif
and the \ before the " after disk.gif

Seems to be working for me!

Thanks Dave!!!!
Posted By: JustDave Re: Sticky Threads - 07/19/2002 5:32 AM
hehe thanks for the typo fixes. I just sorta winged it, didn't actually put the code in and test it. I'm glad it's working though. Others may find it usefull too.
Posted By: JoshPet Re: Sticky Threads - 07/19/2002 5:48 AM
BTW ...

It's not a biggie.... I think I prefer them having to view the post first to download the file.... especially if Rick is changing how the download of attachments works. But if you try the snippit of code you posted to make the disk link to the attachment, that works... but it kills the link to the thread.

FYI - Don't try it that way. But it works perfect with just the disk.
Posted By: JoshPet Re: Sticky Threads - 07/19/2002 7:40 AM
You guys are all busy creating these great Hacks... THANKS!!!

I thought I'd try my hand and writing them up and posting them in the beta forum so others can try.

Here is the Sticky Thread hack.

Here is the Attachment Icon thread.
Posted By: theman_dup1 Re: Sticky Threads - 10/18/2002 11:57 PM
sounds great this is just what i need BUT i dont have postlist.php i only have 3 php files all others are cgi im using Ultimate Bulletin BoardTM 6.2.1.2
Posted By: AllenAyres Re: Sticky Threads - 10/19/2002 12:40 AM
www.ubbdev.com is thataway my friend
Posted By: theman_dup1 Re: Sticky Threads - 10/19/2002 12:50 AM
hehe,thanks
© UBB.Developers