UBB.Dev
Posted By: JoshPet [6.2] Postlist Last Post By for 6.2 - 01/13/2003 6:42 AM
Mod Name / Version - Postlist Last Post By for 6.2

Description - Shows the "Last Post By" information on the postlist page. To save queries, I chose to store the username... so the name won't be accurate if a user has changed their display name. Since this is only stored for the last post, I figured it was worth the savings in queries.

Pre-requisites - none

Author - JustDave from www.chattersonline.com original author
   Updated for 6.2 by JoshPet of www.joshuapettit.com

Credits - Allen Ayres for testing of original version

Files Altered -
   postlist.php (threads directory)
   postlist.tmpl (threads directory)
   addpost.php (threads directory)
   doapproveposts.php (admin directory)
   viewunapproved.php (admin directory)
   deletepost.php (threads directory)

Database Altered - Yes. 3 fields (B_Last_Number, B_Last_Name, and B_Last_Approved) added to w3t_Posts table.

New Files - none

Any other info - JustDave gets a bulk of the credit here, I just adapted for 6.2.

Last Update: January 19, 2003

Attached File
64714-lastpostby.6.2.zip  (129 downloads)
Posted By: AllenAyres Re: [6.2] Postlist Last Post By for 6.2 - 01/13/2003 7:25 AM
thank you
Posted By: JoshPet Re: [6.2] Postlist Last Post By for 6.2 - 01/13/2003 7:33 AM
You are welcome. Sometimes I need a nudge to get stuff onto my plate.

JustDave my know a better way to do this. I stored the username for last post to save queries. So it won't change when the name changes, but it changes as soon as there's another post in that thread anyway, so for my board, I didn't see it as a big issue.

The link still works... and as we have discovered here, once the name change thing gets tested out, it's doesn't happen that frequently.

But otherwise it required another query per thread being viewed. Probably could have been done like the [Re: Username] thing with an array, but that one escapes me at my current coding level.
Posted By: AllenAyres Re: [6.2] Postlist Last Post By for 6.2 - 01/13/2003 7:38 AM
it escapes me at my next 2 coding levels
Posted By: JoshPet Re: [6.2] Postlist Last Post By for 6.2 - 01/13/2003 7:45 AM
LOL - I'm gaining on it. But I didn't sleep last night (bad new habit of skipping sleep on Saturday night ) so I can't even comprehend it right now.
Posted By: JustDave Re: [6.2] Postlist Last Post By for 6.2 - 01/13/2003 2:14 PM
Yeah I was stopped at that point on this. I need to set that same array setup on this to get the usernames from their numbers. I'll update your instructions when I do this. Thanks for bringing it up to speed for 6.2
Posted By: JustDave Re: [6.2] Postlist Last Post By for 6.2 - 01/14/2003 11:29 AM
Is deletepost.php working for you? It must be late but I can't see what I may have done wrong... lol It's something simple so it's alluding me right now. I think I'm looking way to deep. LoL
Posted By: JoshPet Re: [6.2] Postlist Last Post By for 6.2 - 01/14/2003 11:39 AM
It was working for me... I'll send you my deletepost and you can compare.
Posted By: JustDave Re: [6.2] Postlist Last Post By for 6.2 - 01/14/2003 11:42 AM
Thanks but I think it's do to my own coding mess at the moment... LoL I'll get my stuff cleaned up.
Posted By: JustDave Re: [6.2] Postlist Last Post By for 6.2 - 01/14/2003 5:15 PM
Test
Posted By: JustDave Re: [6.2] Postlist Last Post By for 6.2 - 01/14/2003 5:23 PM
Ok at the cost of one query in postlist.php and saving 1 query in the other scripts I have this working with user numbers. yay

I'll append the instructions sometime today.
Posted By: JoshPet Re: [6.2] Postlist Last Post By for 6.2 - 01/14/2003 5:56 PM
Hey,
I just noticed both on my board and here (since installing this) that my new post rows aren't ligthing up.

Can't think of why this would mess that up.... can you?



Or is this just a mac thing?

It doesn't mess with classes in the postlist.tmpl file.
Posted By: JustDave Re: [6.2] Postlist Last Post By for 6.2 - 01/14/2003 5:57 PM
hmmmm.... I hadn't noticed. I'll look things over and see what may be the cause.
Posted By: JustDave Re: [6.2] Postlist Last Post By for 6.2 - 01/14/2003 7:24 PM
Ok I finished cleaning things up a bit. There's a new create/alter table script as well so that old installs can update and use the user numbers.

Will zip and post shortly.
Posted By: JoshPet Re: [6.2] Postlist Last Post By for 6.2 - 01/14/2003 7:30 PM
You got the post lines working again.

Yeah. Well I tried and came close.... as usual. Always need JustDave around to finalize things.

Thanks Dave.
Posted By: JustDave Re: [6.2] Postlist Last Post By for 6.2 - 01/14/2003 7:40 PM
Your welcome

I just updated the zip. There's a new createlastpostfields-6.2.php script everyone will need to run. For those that are upgrading this will clean out the B_Last_Name field and change it's type to INT(9).

You'll need to be logged in as an admin and the forums need to be closed to access the script.
Posted By: Ian_W Re: [6.2] Postlist Last Post By for 6.2 - 01/17/2003 1:34 PM
Thanks for this Josh & Dave - will be installing today

Posted By: JoshPet Re: [6.2] Postlist Last Post By for 6.2 - 01/18/2003 1:21 PM
Dave -
I thought I could fix this on my own...but the way you've thrown all the user numbers into an array... it confuses me.

Anyway... need to add a clause if the user number is 1, then it needs to fetch the anon name from he post table. Otherwise the last posts (if anon) show up as ***DONOTDELETE***

Ugh.
Posted By: Astaran Re: [6.2] Postlist Last Post By for 6.2 - 01/18/2003 3:03 PM
JustDave, i installed this one also and it works very well.
But i have a question regarding the field B_Last_Approved.
What's the different to B_Approved?
I think it stores exactly the same values or did i get something wrong?
Posted By: JustDave Re: [6.2] Postlist Last Post By for 6.2 - 01/18/2003 3:34 PM
The B_Last_Approved is 'yes' by default just as is B_Approved. If a user replies to a thread and their reply needs approval then it will not be displayed in the "Last Post By" information untill it is approved.
Posted By: JustDave Re: [6.2] Postlist Last Post By for 6.2 - 01/18/2003 3:35 PM
I'll work on this one too today. There should be no additional queries needed.
Posted By: JustDave Re: [6.2] Postlist Last Post By for 6.2 - 01/19/2003 11:55 PM
I have updated the zip to include a code change for postlist.php which will display "Anonymous" for posts stored under user number 1. To properly display anonymous names when allowed there will be an additional field required to store this information in. I'll work on updating this to allow for it sometime soon.
Posted By: Astaran Re: [6.2] Postlist Last Post By for 6.2 - 01/20/2003 12:18 PM
[]The B_Last_Approved is 'yes' by default just as is B_Approved. [/]
So can't you use the B_Approved field to check if the posting is approved and only update "Last Post By" if it is?
Just guessing, if this field is really necessary.
Posted By: JustDave Re: [6.2] Postlist Last Post By for 6.2 - 01/20/2003 12:22 PM
If the post isn't approved then B_Last_Approved will be set to 'no' and will not be used to update the last post info. (or it didn't used to, did that change?)

Once the post is approved it will be appended to the last post info. (or it should be)

I'll have to go over everything sometime soon to add in the ability to track anonymous post names if used/allowed. If somehow this field has not gotten used for the way I had intended I'll get it fixed.
Posted By: JoshPet Re: [6.2] Postlist Last Post By for 6.2 - 02/13/2003 8:52 AM
Moved to finished mods forum.
Posted By: Rick Re: [6.2] Postlist Last Post By for 6.2 - 03/06/2003 10:49 PM
A modification of this will be part of 6.3. Added 1 extra query to the postlist.php script so usernames will be right if a user changes their username.
Posted By: JoshPet Re: [6.2] Postlist Last Post By for 6.2 - 03/06/2003 10:53 PM
Yeah!!
Posted By: ckvsoft Re: [6.2] Postlist Last Post By for 6.2 - 03/11/2003 1:33 PM
Hi
Anyone knows why this hack is not a standard to ubbthread?

mfg Chris
Posted By: Dalantech Re: [6.2] Postlist Last Post By for 6.2 - 03/11/2003 1:44 PM
[]ckvsoft said:
Hi
Anyone knows why this hack is not a standard to ubbthread?

mfg Chris [/]

If you look a few posts up from this one the programmer who wrote UBB Threads (Scream) said it will be in the next release...
Posted By: ckvsoft Re: [6.2] Postlist Last Post By for 6.2 - 03/12/2003 12:54 PM
Thanx
Posted By: ericgtr Re: [6.2] Postlist Last Post By for 6.2 - 06/20/2003 2:36 AM
I am wondering if this is conflicting with another mod, I have tried this over and over and can't get it to work and it looks like everyone else is fine so I am not sure what's going on. After my first failure I dropped the tables and started over from scratch (and re-ran the table install script provided in the download) and enabled error logging, here is what I got after my last attempt
Code
Unable to do_query: INSERT INTO w3t_Boards (Bo_Title,Bo_Description,Bo_Keyword,Bo_Total,Bo_Last,Bo_HTML, <br />Bo_Created,Bo_Expire,Bo_Markup, <br />Bo_Cat,Bo_Moderated,Bo_CatName,Bo_Read_Perm,Bo_Write_Perm,Bo_ThreadAge,Bo_Reply_Perm, <br />Bo_SpecialHeader,Bo_StyleSheet,Bo_Posterid,Bo_LastNumber)


This (or most of it) appeared on every page so I just put back the backed up files, any ideas?

edit: added line breaks
Posted By: JoshPet Re: [6.2] Postlist Last Post By for 6.2 - 06/20/2003 2:50 AM
What was the rest of the error? Was there more? It seems to stop before it says what part it doesn't like.

Did you add the database fields to your database?
Posted By: ericgtr Re: [6.2] Postlist Last Post By for 6.2 - 06/20/2003 3:12 AM
The rest of it was related to specific forums that I had, here is the whole thing (sorry) and I did add the database fields per createlastpostfields-6.2.php. After the first didn't take I dropped the tables and added it again, then re-modded all the pages from scratch

Code
Unable to do_query: INSERT INTO w3t_Boards (Bo_Title,Bo_Description,Bo_Keyword,Bo_Total,Bo_Last, <br />Bo_HTML,Bo_Created,Bo_Expire,Bo_Markup,Bo_Cat,Bo_Moderated,Bo_CatName,Bo_Read_Perm, <br />Bo_Write_Perm,Bo_ThreadAge,Bo_Reply_Perm,Bo_SpecialHeader,Bo_StyleSheet,Bo_Posterid,Bo_LastNumber) <br />VALUES ('Bootleg Trading', 'Want to swap boots? Come on in. Please no uploading in <br />this forum.', 'bootlegs','0','0','Off','1055220294','0','On','1','no','Music Files', <br />'-1-2-3-4-5-','-1-2-3-5-','0','-1-2-3-5-','0','usedefault','','') - <br />Duplicate entry 'bootlegs' for key 2 


edit added line breaks because none of us have a 10 foot wide monitor
Posted By: JoshPet Re: [6.2] Postlist Last Post By for 6.2 - 06/20/2003 3:22 AM
OK -

[]
Duplicate entry 'bootlegs' for key 2
[/]
That part at the very end is what I was looking for - that's the actual error as to why it couldn't complete the query. The begining is just the query.

This error looks like you are trying to create a second forum with the keyword of 'bootlegs' but you already have this forum.

Each forum must have a unique keyword.

Were you trying to add a new forum to your board?

That wouldn't have anything to do with this mod - this mod has to do with adding posts and tracking who posted to it last. It does not alter the w3t_Boards table - it only alters the w3t_Posts table.
Posted By: ericgtr Re: [6.2] Postlist Last Post By for 6.2 - 06/20/2003 3:42 AM
Okay dude, you gotta be thinking I just got off the short bus here lol. Let's try this error and see if we can get to the problem at hand shall we?

Code
Unable to do_query: ALTER TABLE w3t_Posts ADD B_Last_Number INT(11) <br />UNSIGNED NOT NULL, ADD B_Last_Name INT(9) UNSIGNED NOT NULL, ADD <br />B_Last_Approved varchar(3) DEFAULT 'yes' NOT NULL - <br />Duplicate column name 'B_Last_Number' 


As to the other issue with the keyword you are correct, I just went back a page and changed it and all was good.

Edit: again. Please don't wide post 4 feet of code inside code tags - it makes the whole thread stretch out and then it makes it difficult to read what's here.
Posted By: JoshPet Re: [6.2] Postlist Last Post By for 6.2 - 06/20/2003 3:58 AM
OK -
Well perhaps - you keep wide posting even after I keep editing to correct them.

OK - what version are you running?
Did you have this mod installed before?

[]
Duplicate column name 'B_Last_Number' [/]

The database column is already there.
Posted By: ericgtr Re: [6.2] Postlist Last Post By for 6.2 - 06/20/2003 4:35 AM
version 6.2.3 (I know it said 6.2 but thought it would work with 6.2.3)
Okay I just made sure all the columns were dropped which they were, I uploaded the modified files again and ran createlastpostfields-6.2.php and it created fine with no errors. Now on the site I am getting no errors yet it's as if the mod isn't there, the last post is the same as it was.

xxx is a zip file if you would like to see the modified files. If I have to I will just live without the mod, I know it's now available in 6.3 but I do not want to re-mod my board with everything again. It makes no sense to me why they would remove such a feature to begin with. Thanks Josh.
Posted By: JoshPet Re: [6.2] Postlist Last Post By for 6.2 - 06/20/2003 4:42 AM
Yes, it'll work under 6.2.3 - if you had it installed before, you didn't need to add the database fields - as they were already there.

If you dropped the tables - then you dropped all the data with it. So if you aren't getting any errors - you are probably on the right track. But there will be no info until replies are posted from this point on.

The scripts looked good. I removed the link to them after I looked - Infopop can shut us down for posting copyrighted scripts on our board.
Posted By: ericgtr Re: [6.2] Postlist Last Post By for 6.2 - 06/20/2003 5:12 AM
Thanks, It does appear to be working but only half way. All I get is "By" without a user name, you can stop in and take a look if you want here is a thread that just got a post http://www.vhfans.com/boards/postlist.php?Cat=&Board=stage
Posted By: ericgtr Re: [6.2] Postlist Last Post By for 6.2 - 06/20/2003 9:38 PM
It turns out that I am having trouble uploading at home. Josh, you said my files looked right and you were correct sir, they were right. Today when I uploaded those exact same files from work the they were all larger than the one's I had uploaded last night. Not sure why that would happen really. Thanks again for all the help here Josh.
Posted By: JoshPet Re: [6.2] Postlist Last Post By for 6.2 - 06/20/2003 9:41 PM
Glad you got it working.
Posted By: The Duke of URL Re: [6.2] Postlist Last Post By for 6.2 - 08/11/2003 12:38 AM
how do we remove this from the database before upgrading to 6.3?
Posted By: JoshPet Re: [6.2] Postlist Last Post By for 6.2 - 08/11/2003 1:29 AM
It won't hurt to upgrade to 6.3 with it.... but if you want to get rid of the unused fields..... backup your database first

Then

ALTER TABLE w3t_Posts
DROP B_Last_Number,
DROP B_Last_Name,
DROP B_Last_Approved



That should do it.

merci
© UBB.Developers