MyBB Community Forums

Full Version: Customizing forumdisplay_thread - show custom profile fields
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hi Aries,

Turns out this script actually only shows the extra profile fields of the person who is LOGGED IN. That makes sense now that I look at the code better, but on my forum all the threads were made by me, so I didn't notice that. But what I want is not to show MY info, but the info of the person who wrote the thread.
So at every thread behind the name of the author some of the extra fields. Do you know how to do that?

Thanks!
Oh, I see. get_user() doesn't load the custom profile fields. When the user id is the same as the current user, it will return $mybb->user, which include the profile fields.

Try this. Add this to the top of the 'forumdisplay_thread' template
<?php
$query = $db->simple_select("userfields", "*", "ufid=".intval($thread['uid']));
$thread += $db->num_rows($query) == 1 ? $db->fetch_array($query) : array();
?>
Now you can use $thread['fidX'] (where X = the id of the custom field) anywhere in the template.
Thanks again! This works perfect!
Thanks for responding so quick Big Grin
(2011-06-02, 09:14 AM)Erain Wrote: [ -> ]Thanks again! This works perfect!
Thanks for responding so quick Big Grin

No problem Wink
Pages: 1 2