MyBB Community Forums

Full Version: Hey, looking for function.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello, I made new forum style plugin, the only problem that it do not support Lock/No/New Posts thing( [Image: on.gif] [Image: off.gif][Image: offlock.gif])
How can i make function that will do that?

I Know that the image code should be like that:
<img src=\"{$theme['imgdir']}/{$lightbulb['folder']}.gif\" alt=\"{$lightbulb['altonoff']}\" title=\"{$lightbulb['altonoff']}\" />
But it just show
images/.gif
On any case.

And i guess it is the right forum for that Smile
Is this in a plugin function? Did you "global $lightbulb2;"?
I want to use function lightbulb that placed on inc/functions_forumlist.php, so it will be able to know when to use on.gif or off.gif or offlock.gif for each forum.

So The previous code was:
global $db, $mybb, $new_forums, $templates, $theme, $cache, $css;
And current one:
global $db, $mybb, $new_forums, $templates, $theme, $cache, $css, $lightbulb;

But it still show everything on off.gif image.

I Attached the file, hope for some help...
I don't see where you have $lastpost_data set before you call the function in this code:
function do_change()
{
	global $db, $mybb, $new_forums, $templates, $theme, $cache, $css, $lightbulb;
 	$plugincache = $cache->read("forums");
	$rowcount = -1;
	$row_ = "trow1";
	$new_forums = "<table width=\"100%\" height=\"100%\" border=\"1\" style=\"border-collapse: collapse\" bordercolor=\"#C0C0C0\">";
	// GET CATEGORIES
	foreach($plugincache as $forum)
	{
		$childfora = "";
		$sep = " ";
		if($forum['type'] == "c")
		{
			// GET CHILDFORUMS
			foreach($plugincache as $childforum)
			{
				// Get the lightbulb status indicator for this forum based on the lastpost
				$lightbulb = get_forum_lightbulb($forum, $lastpost_data, $hideinfo);
I don't think you've set $lastpost_data before that last line, so really $lastpost_data == null
Ok, so the current code is:
global $db, $mybb, $new_forums, $templates, $theme, $cache, $css, $lightbulb, $forum, $lastpost_data, $hideinfo;
	$plugincache = $cache->read("forums");
	$rowcount = -1;
	$row_ = "trow1";
	$new_forums = "<table width=\"100%\" height=\"100%\" border=\"1\" style=\"border-collapse: collapse\" bordercolor=\"#C0C0C0\">";
	// GET CATEGORIES
	foreach($plugincache as $forum)
	{
		$childfora = "";
		$sep = " ";
		if($forum['type'] == "c")
		{
			// GET CHILDFORUMS
			foreach($plugincache as $childforum)
			{
				$lastpost_data == null;
				// Get the lightbulb status indicator for this forum based on the lastpost
				$lightbulb = get_forum_lightbulb($forum, $lastpost_data, $hideinfo);
But still it's same bug...
Bump... :|
bump.
Please... HELP!
Bump.
(for those who do not know what i want, i want function that will check if forum have or not have new posts since my last login time).
Mybb already does that...
But it's just do not work on plugin:
Check
1. Download: [attachment=6478]
2. Upload to inc/plugins
3. Active plugin.
4. Get to your forum index and see that it always show all forums as "no new posts" even if they are.
I'm not sure but maybe this code helps you...

// If the lastpost is greater than the last visit and is greater than the forum read date, we have a new post
		if($lastpost['lastpost'] > $mybb->user['lastvisit'] && $lastpost['lastpost'] > $forumread && $lastpost['lastpost'] != 0)
		{
			$folder = "on";
			$altonoff = $lang->new_posts;
		}
			// Otherwise, no new posts
		else
		{
			$folder = "off";
			$altonoff = $lang->no_new_posts;
		}

	return array(
		"folder" => $folder,
		"altonoff" => $altonoff
	);
...
Not working.

Reposted(Bump)