MyBB Community Forums

Full Version: Username is blank when quoting a Guest user
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I just upgraded my forum from 1.8.6 to 1.8.20

Quoting other user's posts still works. The only problem is when I quote a Guest (unregistered) user, the username within the quote code is blank

For example, before the forum upgrade, this code was generated when trying to quote a Guest:

[quote="Guest" pid='9684' dateline='1556915520']


However, now, this is the code that is generated:

[quote="" pid='9684' dateline='1556915520']

Can someone advise what I need to do to fix this? Its inconvenient to remember to have to type in the Guest username when it should be prepopulated

Thanks
you can try using this method from German Support forum

code needs to be modified in inc/functions_posting.php file [GitHub link]
Thanks that worked!

From that link:

Quote:I have fixed the error once, by looking in the file inc / functions_posting.php

// Swap username over if we have a registered user
if($quoted_post['userusername'])
{
   $quoted_post['username'] = $quoted_post['userusername'];
} 


have expanded to

// Swap username over if we have a registered user
if($quoted_post['userusername'])
{
   $quoted_post['username'] = $quoted_post['userusername'];
}
else
{
   if(empty($quoted_post['username']))
   {
       $quoted_post['username'] = htmlspecialchars_uni($lang->guest);
   }
}