plugin function problem !
#5
(2013-04-13, 12:04 AM)Seabody Wrote: $post is not globalised. I think you also have to pass $msg by reference. (I also cleaned up your code a little bit:

function ParseSpoiler(&$msg)
{
	// added $post to the global statement. Prefixed $msg above with & (pass by reference). Removed != "0" in the if statement below. Rearranged the if-else to be a bit more readable.
	global $mybb, $post;
	if ($on)
	{
		$cach = "#\[cach\](.*?)\[/cach\]#si";

		if ($mybb->user['uid'] != $post['uid'])
		{
			$rep = "Access_restreint";
		}
		else
		{
			$rep = "Access_autorise";
		}
			
		$msg = preg_replace($cach, $rep, $msg);

		return $msg;
	}
}

Thank You verry much!! I will post my first plugin soon
Reply


Messages In This Thread
plugin function problem ! - by sharingamak - 2013-04-12, 07:57 PM
RE: plugin function problem ! - by .m. - 2013-04-12, 08:05 PM
RE: plugin function problem ! - by sharingamak - 2013-04-12, 08:20 PM
RE: plugin function problem ! - by Krytic - 2013-04-13, 12:04 AM
RE: plugin function problem ! - by sharingamak - 2013-04-16, 08:01 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)