MyBB Community Forums

Full Version: {$thread['threadlink']} not working in showthread template
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am designing a forum theme at http://forum.puneites.in
While making a 'share it' mod in showthread template I found that {$thread['threadlink']} gives a blank link!

This is the template:

<html>
<head>
<title>{$thread['subject']}</title>
{$headerinclude}
<script type="text/javascript">
<!--
	var quickdelete_confirm = "{$lang->quickdelete_confirm}";
// -->
</script>
<script type="text/javascript" src="jscripts/thread.js?ver=1600"></script>
</head>
<body>
	{$header}
	{$pollbox}
	<div class="float_left">
		{$multipage}

	</div>
	<div class="float_right">
		{$newreply}
	</div>
	{$ratethread}
	<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder" style="clear: both; border-bottom-width: 0;">
		<tr>
			<td class="thead" colspan="2">
				<div style="float: right;">
					<span class="smalltext"><strong><a href="showthread.php?mode=threaded&amp;tid={$tid}&amp;pid={$pid}#pid{$pid}">{$lang->threaded}</a> | <a href="showthread.php?mode=linear&amp;tid={$tid}&amp;pid={$pid}#pid{$pid}">{$lang->linear}</a></strong></span>
				</div>
				<div>
					<strong>{$thread['threadprefix']}{$thread['subject']}</strong>
				</div>
			</td>
		</tr>
		{$classic_header}
	</table>
	<div id="posts">
		{$posts}
	</div>
	<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder" style="border-top-width: 0;">
		<tr>
			<td colspan="2" class="tfoot">
				{$search_thread}
				<div>
					<strong>&laquo; <a href="{$next_oldest_link}">{$lang->next_oldest}</a> | <a href="{$next_newest_link}">{$lang->next_newest}</a> &raquo;</strong>
				</div>
			</td>
		</tr>
	</table>
	<div class="float_left">
		{$multipage}
	</div>
	<div style="padding-top: 4px;" class="float_right">
		{$newreply}
	</div>
	<br style="clear: both;" />
        <div id="sharedock">
        <div class="share"></div>
        <a id="Sfacebook" href="#" onclick="MyBB.popupWindow('http://www.facebook.com/share.php?u={$thread['threadlink']}&t={$thread['subject']}');" target=""></a>

<a id="Stwitter" href="http://twitter.com/?status={$thread['subject']}+//+{$thread['threadlink']}" onclick="" target="_blank"></a>

<a id="Sdigg" href="http://digg.com/submit?phase=2&url={$thread['threadlink']}&title={$thread['subject']}" onclick="" target="_blank"></a>

<a id="Sdelicious" href="http://del.icio.us/post?url={$thread['threadlink']}&title={$thread['subject']}" onclick="" target="_blank"></a>
</div>



	{$sharebuttons}
	{$sharebuttons}
	{$quickreply}
	{$threadexbox}
	{$similarthreads}
	<br />
	<div class="float_left">
		<ul class="thread_tools">
			<li class="printable"><a href="printthread.php?tid={$tid}">{$lang->view_printable}</a></li>
			<li class="sendthread"><a href="sendthread.php?tid={$tid}">{$lang->send_thread}</a></li>
			<li class="subscription_{$add_remove_subscription}"><a href="usercp2.php?action={$add_remove_subscription}subscription&amp;tid={$tid}&amp;my_post_key={$mybb->post_code}">{$add_remove_subscription_text}</a></li>
		</ul>
	</div>

	<div class="float_right" style="text-align: right;">
		{$moderationoptions}
		{$forumjump}
	</div>
	<br style="clear: both;" />
	{$usersbrowsing}
	{$footer}
</body>
</html>

Any ideas what is happening!
Yes, when that template is referenced that variable isn't set.

If you create a plugin using the showthread_end plugin hook, you can set it yourself via the function get_thread_link (you'll need to require_once MYBB_ROOT."inc/functions.php" to use the get_thread_link() function) and not have to worry about a core file edit. Otherwise you can do a core file edit in showthread.php right below $thread = get_thread line with $thread['threadlink'] = get_thread_link.