<?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("forumdisplay_thread", "buttoncheck_forum");
$plugins->add_hook("showthread_end", "buttoncheck_thread");


function buttoncheck_info()
{
        return array(
                "name" => "Button Check",
                "description" => "Hide button if user have no permission",
                "website" => "http://mybbhacks.zingaburga.com",
                "author" => "TriTop",
                "version" => "1.0",
        );
}


function buttoncheck_forum()
{
        global $newthread, $fpermissions;
        if ($fpermissions['canpostthreads'] == 0)
        {
                $newthread = "";
        }
}


function buttoncheck_thread()
{
        global $newthread, $newreply, $showthread, $forumpermissions;

        if ($forumpermissions['canpostthreads'] == 0)
        {
                $newthread = "";
        }

        if ($forumpermissions['canpostreplys'] == 0)
        {
                $newreply = "";
        }
}
?>
