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.
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.
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
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
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.
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***
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?
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.
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.
[]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.
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.
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.
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?
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
[] 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.
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.
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.
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.
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
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.
Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.
Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.