MyBB Community Forums

Full Version: Last thread link in header
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I would like the have a last thread link in my header like in this forum http://windows7forum.pl

I don't know if it's a plugin or just a matter of modification in template header, I tried to do my own but seems to not work, nothing is showing up, here is my code in templates -> header

<div class="latestnewsbar"><strong>Last thread:</strong> <a href="{$lastpost_link}" title="{$full_lastpost_subject}"><strong>{$lastpost_subject}</strong></a> ({$lastpost_time})</div>

And it turns up like this:
[Image: 29792573.png]

Is there any way to do correct this or I need a plugin for that? Can someone make a plugin for this if its possible? Or shoul I just correct my code by something else?

Regards
I just posted a reply to your thread. I simply edited another plugin to fit your needs. The code is a bit messy but it works great.

http://community.mybb.com/thread-91514-p...#pid667671
Anyone else can help? because this is not working...
I can give this a shot tomorrow, since I'm heading to bed now.

This should be an easy plugin, basically it is just a template edit.
He already got it to work, but a nicer plugin would be welcome. Smile
I'm making something like this for my community. Hopefully release it tomorrow. Wink
I finish a plugin with what you ask: Last Thread Link

Until will be aproved by staff, I will let you to download from here, but remember: it's a initial release (my first plugin) so... can have bugs.
Was tested in MyBB 1.6.2 and work's without problems.

[attachment=22180][attachment=22187][attachment=22186][attachment=22181]

I wait to tell me if it help you or not.
Thank you.


Download (updated with code of Aries-Belgium):
Nice to see your plugin Smile Congratulations on your first release.
@MyBB Fan: your plugin doesn't check if the user has viewing permissions in the forum the last thread is posted in.

include_once(MYBB_ROOT."/inc/functions_search.php");

$where_sql = "visible = '1'";
$unsearchforums = get_unsearchable_forums();
if($unsearchforums)
{
	$where_sql .= " AND fid NOT IN ($unsearchforums)";
}
$inactiveforums = get_inactive_forums();
if($inactiveforums)
{
	$where_sql .= " AND fid NOT IN ($inactiveforums)";
}

$query=$db->query("SELECT tid, subject, username FROM ".TABLE_PREFIX."threads WHERE {$where_sql} ORDER BY dateline DESC LIMIT 1");
Thank you, sir.
Anyway... I ill add new options soon.
I wait to report any bugs...
@Aries-Belgium: thank you: was updated with your code (under your credit line)
I still wait another bugs... it's my first release
Pages: 1 2