Displaying info from within a plugin
#1
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?
Reply
#2
Why not just this?

function CheckSig($post)
{
         global $mybb;
         if ($post['postnum'] <= $mybb->settings['signaturecontrol_postcount'])
         {
                $post['signature'] = '';
         }
}
Reply
#3
(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
Reply
#4
(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.
Reply
#5
EDIT: NVM, did it Toungue
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)