MyBB Community Forums

Full Version: Displaying info from within a plugin
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
My plugin skills are rusty Toungue I have been programming in vb.NET for the last 7 months and PHP is taking a while to com back to me Sad

I am writing a small plugin for my forum to not display the signatures of users unless they have a minimum required posts.

The code:

<?php
$plugins->add_hook("postbit", "CheckSig");  

//some code, such as activation - this all works FINE :)
//now the bit that wont work:

function CheckSig($post)
{
   	global $mybb, $CheckSig;
	if ($mybb->settings['signaturecontrol_onsetting'] == "yes")
	{
		if ($post['postnum'] > $mybb->settings['signaturecontrol_postcount'])
		{
			$CheckSig = $post['signature'];
		}
		else {
			$CheckSig =  "";
		}
	}
	else {
		$CheckSig =  $post['signature'];
	}
    
}

Basically it should only display the sig if the user has X amount of posts. Is there something Im doing blatantly wrong?
Why not just this?

function CheckSig($post)
{
         global $mybb;
         if ($post['postnum'] <= $mybb->settings['signaturecontrol_postcount'])
         {
                $post['signature'] = '';
         }
}
(2011-05-10, 05:40 PM)Aries-Belgium Wrote: [ -> ]Why not just this?

function CheckSig($post)
         global $mybb, $CheckSig;
         if ($post['postnum'] <= $mybb->settings['signaturecontrol_postcount'])
         {
                $post['signature'] = '';
         }
}

You missed one { . Also why to add $CheckSig in global ? :s
(2011-05-10, 05:43 PM)Yaldaram Wrote: [ -> ]
(2011-05-10, 05:40 PM)Aries-Belgium Wrote: [ -> ]Why not just this?

function CheckSig($post)
         global $mybb, $CheckSig;
         if ($post['postnum'] <= $mybb->settings['signaturecontrol_postcount'])
         {
                $post['signature'] = '';
         }
}

You missed one { . Also why to add $CheckSig in global ? :s

Fixed, and I just copied the line. Didn't see it in there.
EDIT: NVM, did it Toungue