MyBB Community Forums

Full Version: Most variables not working on forumdisplay_thread
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5
		else
		{
			$attachment_count = '';
		}

		$plugins->run_hooks("forumdisplay_thread_end");
		
$query = $db->simple_select("users", "avatar, avatardimensions, username", "uid = {$thread['uid']}");
$avatar = $db->fetch_array($query);
$profilelink = get_profile_link($thread['uid']);
$thread['avatar'] = "";
if ($avatar['avatar'] != "")
{
    $useravatar = format_avatar($avatar['avatar'], $avatar['avatardimensions'], $mybb->settings['postmaxavatarsize']);
    $thread['avatar'] = "<div class=\"author_avatar\"><a href=\"{$profilelink}\"><img src=\"{$useravatar['image']}\" alt=\"\" {$useravatar['width_height']} /></a></div>";
} 


		eval("\$threads .= \"".$templates->get("forumdisplay_thread")."\";");
	}

	$customthreadtools = $standardthreadtools = '';
	if($ismod)
	{

Yes.

By the way, I also want it to work on forumdisplay_showthread
This is the code for the avatar, without the 2 lines for the fid. Put these after the $plugin->run_hooks line

(2015-08-16, 02:22 PM)XP Mai Wrote: [ -> ]By the way, I also want it to work on forumdisplay_showthread

Of course, I asked you to show your forumdisplay_showthread template.
(2015-08-16, 02:36 PM)Ad Bakker Wrote: [ -> ]Of course, I asked you to show your forumdisplay_showthread template.
Oh, I read wrongly. I thought you were confirming.

forumdisplay_thread

<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder" style="clear: both;">
	<tr>
		<td class="thead" align="center" colspan="{$colspan}">
			<div><strong><a href="{$thread['threadlink']}" class="{$inline_edit_class} {$new_class}" id="tid_{$inline_edit_tid}">{$thread['subject']}</a></strong></div>
			<div class="author smalltext">Trader: {$thread['profilelink']}</div>
		</td>
	</tr>
	<tr>
		<td class="{$bgcolor}" width="50%">
			<br class="clear" />
			<table width="100%" border="0">
				<tr>
					<td width="200px"><b><font size="5px">Trading (Offering)</font></b></td>
					<td><font size=5px">:</font></td>
					<td><font size="5px">{$GLOBALS['threadfields']['stockpileoffering']} {$GLOBALS['threadfields']['trade_offer']}</font></td>
				</tr>
				<tr>
					<td><b><font size="5">For (Needing)</font></b></td>
					<td><font size="5">:</font></td>
					<td><font size="5">{$GLOBALS['threadfields']['stockpileneeding']} {$GLOBALS['threadfields']['trade_need']}</font></td>
				</tr>
				{$GLOBALS['threadfields']['scflang']}
				{$GLOBALS['threadfields']['scffounded']}
				<tr>
					<td><b><font size="5px">Fee</h3></font></b></td>
					<td><font size="5px">:</font></td>
					<td><b><font size="5px"></font></b></td>
				</tr>
				{$GLOBALS['threadfields']['scfslogan']}
			</table>
		</td>
	
		<td class="{$bgcolor}" width="50%">
			<table width="100%" border="0">
				<tr>
					<td align="center" valign="middle">
						<div class="author_avatar"><a href="{$post['profilelink_plain']}"><img src="{$useravatar['image']}" alt="" max-width="100px" max-height="100px" /></a></div>
					</td>
<td><table width="50%" colspan="{$colspan}">
<br class="clear" />
<tr>
<td><b><font size="4px">Ruler Name</font></b></td>
<td>:</td>
<td>{$thread['profilelink']}</td>
</tr>
<tr>
<td><b><font size="4px">Nation Name</font</b></td>
<td>:</td>
<td>{$memprofile['fid10']}</td>
</tr>
<tr>
<td><b><font size="4px">Link</font></b></td>
<td>:</td>
<td>Ans</td>
</table></td>
				</tr>
			</table>
		</td>
		{$modbit}
	</tr>
	<tr>
		<td class="tfoot" colspan="{$colspan}" align="center">
			{$thread['views']} {$lang->views},
			<a href="javascript:MyBB.whoPosted({$thread['tid']});">{$thread['replies']}</a>{$unapproved_posts} {$lang->replies},
			<a href="{$thread['lastpostlink']}">{$lang->lastpost}</a>: {$lastposterlink}, {$lastpostdate} {$lastposttime}
		</td>
	</tr>
</table>
<br />

Result: http://forum.international-union.com/for...php?fid=27

The custom profile field ID is 10, and it's Nations Nation Name. I tried all sorts of variables (excluding yours) but it don't work.

Your variable can't be tried because once I add the code to .php, it's a complete blank for the forum so there's no way to try while having the code in .php.
In your opening post you mentioned fid5. Try it then again with 10:


$query = $db->simple_select("userfields", "fid10", "ufid = {$thread['uid']}");
$thread['fid10'] = $db->fetch_array($query)['fid10'];


and change the following line in your template


<td>{$memprofile['fid10']}</td>

to:


<td>{$thread['fid10']}</td>
Blackout!

Line 1311 to 1330

		{
			$attachment_count = '';
		}

		$plugins->run_hooks("forumdisplay_thread_end");
		
		$query = $db->simple_select("userfields", "fid10", "ufid = {$thread['uid']}");
$thread['fid10'] = $db->fetch_array($query)['fid10']; 
$query = $db->simple_select("users", "avatar, avatardimensions, username", "uid = {$thread['uid']}");
$avatar = $db->fetch_array($query);
$profilelink = get_profile_link($thread['uid']);
$thread['avatar'] = "";
if ($avatar['avatar'] != "")
{
    $useravatar = format_avatar($avatar['avatar'], $avatar['avatardimensions'], $mybb->settings['postmaxavatarsize']);
    $thread['avatar'] = "<div class=\"author_avatar\"><a href=\"{$profilelink}\"><img src=\"{$useravatar['image']}\" alt=\"\" {$useravatar['width_height']} /></a></div>";
} 


		eval("\$threads .= \"".$templates->get("forumdisplay_thread")."\";");
I see it go blank now, did you also make the change in the template?
Yes, this time I remain all changes you asked me to, to show you it's blank.
OK, can you remove these 2 lines again, so that I can see the site again?
(2015-08-16, 04:58 PM)Ad Bakker Wrote: [ -> ]OK, can you remove these 2 lines again, so that I can see the site again?

Done.
I am in your AdminCP now. But when I go to the forumdisplay_thread template of the Vienna theme, I see a completely different template than the one you posted some messages ago. Has this something to do with the XThreads plugin?
I can nowhere find any settings related to this plugin.
Pages: 1 2 3 4 5