2018-04-15, 11:35 PM
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:
If this can be changed to
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?
So this is part bug report and part suggestion to fix potential problems.
Thanks.
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:
if($mybb->input['action'] == "thread")
{
if($thread['firstpost'] == 0)
{
update_first_post($tid);
}
If this can be changed to
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?
SELECT * FROM `mybb_threads` WHERE `uid` = 0 AND `dateline` = 0 ORDER BY `tid` ASC
So this is part bug report and part suggestion to fix potential problems.
Thanks.