MyBB Community Forums

Full Version: What's the variable for "thread starter avatar"
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I would like to know what's the variable for the thread starter avatar on the showthread.php page. If there's src or full <img> tag that represents the thread starter's avatar I'd be happy to know if there's a default one.
There is only UID and username available globally in showthread related to thread starter; which can be retrieved using {$thread['uid']} and {$thread['username']} variables respectively.

To fetch the avatar of the thread starter you need to implement custom function through core edit or plugins using the available info.
Hey @kenndev,
As effone said, you need to do either core edit or use a plugin.
I will suggest using the Last Post Avatar plugin by Whiteneo for this purpose.
https://community.mybb.com/mods.php?action=view&pid=74
Further, speaking to core edit:
Open your showthread.php and find this line near about line no. 1600
eval("\$showthread = \"".$templates->get("showthread")."\";");

and add before it:
$starter = get_user($thread['uid']);
$thread['starter_avatar'] = empty($starter['avatar']) ? $mybb->settings['useravatar'] : $starter['avatar'];

Save your file and replace with original.
Now you can access the thread starter's avatar image url anywhere in your thread (showthread) using the variable $thread['starter_avatar']
(2021-04-01, 11:31 AM)effone Wrote: [ -> ]Further, speaking to core edit:
Open your showthread.php and find this line near about line no. 1600
eval("\$showthread = \"".$templates->get("showthread")."\";");

and add before it:
$starter = get_user($thread['uid']);
$thread['starter_avatar'] = empty($starter['avatar']) ? $mybb->settings['useravatar'] : $starter['avatar'];

Save your file and replace with original.
Now you can access the thread starter's avatar image url anywhere in your thread (showthread) using the variable $thread['starter_avatar']

Can I update MyBB without issue after I make core edits and there's a new update.
Core edits are likely to be lost after an update.
You need to re-apply all core edits you have committed after every update.

Or to preserve the edits you can use Patches plugin:
https://github.com/frostschutz/MyBB-Patches
(2021-04-01, 12:22 PM)effone Wrote: [ -> ]Core edits are likely to be lost after an update.
You need to re-apply all core edits you have committed after every update.

Or to preserve the edits you can use Patches plugin:
https://github.com/frostschutz/MyBB-Patches

Ohk thanks