MyBB Community Forums

Full Version: Please check my plugin
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I know it's pretty simply PHP but I am only starting with all this stuff!
Please how to make this pappy work, it suppose to restrict access to users under 10 posts?

<?php
// Disallow direct access to this file for security reasons
if(!defined("IN_MYBB"))
{
	die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}

$plugins->add_hook("online_today_start", "online_restrict");

function uor_info()
{
	
	return array(
		"name"			=> "Online User Restrict",
		"description"	=> "Restrict access to who's online to users under 10 posts",
		"website"		=> "http://letsforum.com",
		"author"		=> "Victor Dub",
		"authorsite"	=> "http://letsforum.com",
		"version"		=> "1.0",
		"guid" 			=> "",
		"compatibility" => "*"
	);
}


function online_restrict()
{
	if(!$mybb->user['postnum'] >= 10)
{
	error;
}
}
?>
You need to global $mybb. Additionally, error; should probably be error('error message here');

http://www.php.net/manual/en/language.va...ope.global
@Nathan Malcolm please help me it doesn't work!

function online_restrict() {
	global $mybb;
	if($mybb->user['postnum'] >= 10)
{
	error('error message here');
}
}
function online_restrict()
{
	global $mybb;
	if($mybb->user['postnum'] < 10)
	{
		error('error message here');
	}
} 
Thanks very much but for some reason it doesn't show error! Maybe hook ain't correct?

Nathan baby thanks very much I had wrong hooks!

I should be:
$plugins->add_hook("online_start", "online_restrict");
$plugins->add_hook("online_today_start", "online_restrict");

One question is this plugin secure will it cause some security issues?????
There is no way this code can cause security issues..
D666 thanks very much brother as always pleasure to deal will professionals like all you guys!