Threads table empty data and update_first_post() #3148
Labels
b:1.8
Branch: 1.8.x
s:resolved
Status: Resolved. Solution implemented or scheduled
t:bug
Type: Bug. An issue causing error / flaw / malfunction
Milestone
I've been experiencing intermittent threads which do not have a username in forumdisplay but when you view the thread it has the data. I looked into this and it appears to have started in MyBB 1.8x only since none of the problems threads were previous to my upgrade.
mybb_threads table has a firspost entry but the UID, USERNAME, and DATELINE are either empty or set 0.
I found about 111 threads in the past 5 months with uid=0 and dateline=0. Today I was trying to fix them all with a while query to populate the data from post table using the firstpost pid. While doing so I found out that the function update_first_post() exists in inc/functions. So basically I just had to do the query for "uid=0 AND dateline=0" and then run update_first_post($results['tid']) to populate the data. Worked perfectly.
So I looked into what triggers the update_first_post() action and inside showthread.php is this:
PHP Code:if($mybb->input['action'] == "thread"){ if($thread['firstpost'] == 0) { update_first_post($tid); }
If this can be changed to
PHP Code:if($mybb->input['action'] == "thread"){ if($thread['firstpost'] == 0 || $thread['dateline'] == 0) { update_first_post($tid); }
It would pretty much fix this bug. I can't be sure if the thread entries are a bug strictly for my site due to lag, plugins, or attacks but I do know this code change could fix it and also help anyone who may have this issue.
Can I suggest everyone who has a reasonable size forum please run this query to check if you have any of these bad threads?
Code:SELECT * FROM
mybb_threads
WHEREuid
= 0 ANDdateline
= 0 ORDER BYtid
ASCSo this is part bug report and part suggestion to fix potential problems.
Thanks.
Original thread: Threads table empty data and update_first_post()
The text was updated successfully, but these errors were encountered: