UBB.Dev
Posted By: treszoks Today's Active Topics Beautification Hack - 06/29/2001 2:12 AM
Something that always bothered me was when you go to "Today's Active Topics", one of the columns was the date which was of course...TODAY! LOL. It didn't make much sense so I've made some modifications to take out that column and I've changed it to "Last Response By". I've also taken out the "Forum" column and instead made it a row with the respective topics underneath it. It now looks a TON better.
http://www.baylorfans.com/cgi-bin/search.cgi?action=getdaily

Here are the instructions (my version is 5.46 but it will probably work with most of the 5.4* series). Make a backup before doing this of course!

Modified files: search.cgi only

Find:
Code
code:

Paste ABOVE:
Code
code:

Find and REMOVE:
Code
code:

Find:
Code
code:

Paste ABOVE:
Code
code:

Find:
Code
code:

REPLACE with:
Code
code:
Hmm...I might try it but I don't really care about Todays active topics but, what the heck...I'll try it later. wink
Posted By: Thermit Re: Today's Active Topics Beautification Hack - 07/03/2001 12:09 AM
Thanks! laugh laugh laugh laugh laugh

frown frown But you left off where you change the column names, and my last poster is only right about 25% percent of the time.

[ July 02, 2001 05:27 PM: Message edited by: Thermit ]
What do you mean by 25% right sometimes?
Posted By: Thermit Re: Today's Active Topics Beautification Hack - 07/03/2001 8:45 PM
I can't see any pattern to it, but it is mostly wrong.
I just did a quick check on my board and they all seem to be correct. Maybe it's another hack you have installed?
Posted By: Thermit Re: Today's Active Topics Beautification Hack - 07/03/2001 9:38 PM
treszoks, I just did a quick check of your board too and they are mostly all wrong too.

For example, in "Was Jesus a Sinner?", it says last posted by Bear1969, but it was really last posted by Phil320. Although Bear1969 does post in that thread.

This is exactly what I'm seeing too.

Driving me crazy cause I can't see the pattern...
Posted By: Thermit Re: Today's Active Topics Beautification Hack - 07/03/2001 10:14 PM
Well, looked at it some more and realized that the bug is due to the fact that the last poster needs to be derived from the order of the entries in the daily log, but that is messed-up when the sort function is called to group the array entries by forum.

The following change corrects the last person bug, but doesn't necessarily group all the posts from the same forum together.


Code
code:

[ July 03, 2001 03:16 PM: Message edited by: Thermit ]
Well at least it's not a problem with my mod;) I'll have to take a look at it later and see if I can figure out a fix. Maybe you'll come up with something.
Yeah, I checked too and It seems to be stuffed, Try looking around the code a bit in forumdisplay.cgi since thats where the last poster is installed.
Posted By: Thermit Re: Today's Active Topics Beautification Hack - 07/06/2001 2:23 AM
Well, I decided to take the easy road and just let the posts be in time-order instead of forum-grouped. (Which I did basically with the small hack shown above and some table formatting).

treszoks, I appreciate you jump starting me on this hack. Here's my version:


Active Topics
Try this fix out and let me know how it goes.

Find this:
@daily = sort(@daily2);

And change to this:
@daily = reverse(@daily2);

Now find this:
$MatchTotal = @good;

And add right above it this:
@good = sort(@good);
Posted By: kshock Re: Today's Active Topics Beautification Hack - 07/24/2001 4:31 AM
How can I add a column for total number of replies to a post and total views in the Active Topics list like Thermit has done? I do have the Views hack intalled already.
kshock,

Those items aren't part of the normal index used for today's active topics so you'll have to ask Thermit for documentation. It will add more load to your server however because you'll have to open the file with the views in it plus another file to find out the number of replies.
Posted By: kshock Re: Today's Active Topics Beautification Hack - 07/25/2001 1:00 AM
Thanks for the info on that. As my server is already taxed with traffic, it might be better to leave off the views and reply counts.
Posted By: kshock Re: Today's Active Topics Beautification Hack - 07/25/2001 8:38 PM
This is a nice hack as I've never liked the Active Topics screen. I like this layout a lot better. Just one thing I'd like to change...

Right now the topics are listed within each message board from oldest to newest. I'd like to reverse the order so that the newest topic is at the top of the list instead of the bottom. What would I change in the code to accomplish this?

Also, another cool thing I'd really like to see is a simple total of the number of new posts for that day as well. Maybe at the top, just a simple line that reads... Total Posts Today: 168. Can this be done fairly easily??

Thanks!

[ July 25, 2001 03:23 PM: Message edited by: kshock ]
Posted By: treszoks Re: Today's Active Topics Beautification Hack - 07/26/2001 12:12 AM
kshock,

Find this:
@daily = reverse(@daily2);

Add below it:
$total_posts = $#daily;

Now just put $total_posts further below where you'd like it to be displayed. For example, find $MatchTotal and place it near that.
Posted By: kshock Re: Today's Active Topics Beautification Hack - 07/26/2001 6:34 AM
I got the display to work, but, it always says 0 messages wherever I use $total_posts, but, there are messages there.
Where exactly are you placing it? Make sure you're doing it within the other plain HTML stuff.
Posted By: kshock Re: Today's Active Topics Beautification Hack - 07/26/2001 7:20 AM
That's where I put it, right near the $MatchTotal variable within the HTML as you suggested.
The only thing I can think of is make sure you put the
"$total_posts = $#daily;" in the right spot. What version are you using?
Posted By: kshock Re: Today's Active Topics Beautification Hack - 07/26/2001 7:59 AM
Here's how it looks in my code:

Code
code:

Here's where the variable is used...

Code
code:

But even with new messages, the total keeps coming up Zero. I'm using version 5.47a.

[ July 26, 2001 01:00 AM: Message edited by: kshock ]
Just an Idea, Link the Last Reponse by member and link it to there profile. That might be a good idea. smile
kshock,

Well everything looks okay from what you posted. I'm not for sure what the deal is. It may have something to do with your version but I don't know. I'm using 5.46 which really shouldn't be too much different from yours. Try changing "$total_posts = $#daily;" to "$total_posts = $#daily2;"

You might also look to see if the variable $total_posts is used anywhere else to make sure it isn't an already existing variable.

Lord Dexter,

Not a bad idea and would be easy to do. Find this:
$LastPerson = "$goodline[2]";

Add this below it:
$goodline[2] =~ tr/ /+/;
$LastPerson = "$LastPerson";

[ July 26, 2001 10:21 AM: Message edited by: treszoks ]
Posted By: kshock Re: Today's Active Topics Beautification Hack - 07/26/2001 9:29 PM
Treszoks, it's working now! But, strangely, it works either way now whether I use $#daily or $#daily2 as the variable.

Because I first tested this just after midnight when there was only one message listed in the Daily Active Topics, I'm wondering if the $#daily variable needs a +1 added to make it truly accurate. For example, if there were two messages, maybe it would have indicated 1 instead of Zero as it was with only 1 message. Does this make sense?

Anyway, it seems to be working now, thank you VERY much for your fast feedback and assistance. I also added the link to the profiles that you told Lord Dexter how to do. I made a small change...

$LastPerson = "$LastPerson";

I just added the target=_blank part so that it pops open a new window when viewing the profile.

Thanks!
Posted By: treszoks Re: Today's Active Topics Beautification Hack - 07/27/2001 12:27 AM
Yep, I bet you are right!

Edit: Make that "$total_posts = $#daily + 1;"

Don't use the ++ in this instance because it increments the array itself as well.

[ July 27, 2001 12:20 AM: Message edited by: treszoks ]
Posted By: kshock Re: Today's Active Topics Beautification Hack - 07/28/2001 8:54 AM
Had another idea...

Is there a way to somehow store total posts for the previous day so you could show how many new messages there were yesterday, as well as the message count for the current day on the Today's Active Topics screen?
Yes there is, but you would probably have to run a cron script once every night to save the info.
Posted By: Thermit Re: Today's Active Topics Beautification Hack - 07/28/2001 9:01 PM
It seems to me cron wouldn't be necessary, because the UBB already has some function which deletes the old "daily index" read by Active Topics and starts a new one. If this true, then some extra code could probably be added to save yesterdays count before it gets removed.
You're right, I forgot that the daily index filename was changed everyday. Look in "ubb_library2.pl" for "sub cleandailies". That's the subroutine that deletes all old daily indexes. Just add in your own code there to store the info before it gets deleted.

This sounds like something I might be interested in doing after thinking about it...I'll try to cook something up.
Posted By: treszoks Re: Today's Active Topics Beautification Hack - 07/28/2001 10:19 PM
Okay, I wrote some stuff but I won't know if it works until it's a new day of course. I'll post tomorrow with the results!
Thats great, Hope the hack works out good for you. smile
Well my new script worked fine. I've made a new topic since it's a new hack. Thanks to kshock and Thermit for the ideas! Here's the link for instructions:
https://www.ubbdev.com/ubbcgi/ultimatebb.cgi?ubb=get_topic&f=7&t=000606
Posted By: Thermit Re: Today's Active Topics Beautification Hack - 07/30/2001 2:54 AM
Good work dude. That's pretty cool.
I think posts/topics are reversed in dailies.cgi chart.
Thanks again.
You're right. I fixed that plus I added some date checking since it turns out the date placed is actually the next day. The code I put in will work most of the time except for special years when dealing with the number of days in February. It'd be more of a hassle to figure out the code for those few instances every few years so I'm just leaving it as is smile I've uploaded the fixes.
© UBB.Developers