2012-02-09, 08:26 PM
Hi,
I am using the buttoncheck.php plugin from here to hide New Thread and New Reply buttons from guests. This is the code that does the trick:
I was thinking if it is possible to hide specific HTML code from guests instead of just $newreply and $newthread.
In particular I want to hide this piece of code from all guests:
I have tried to add the following beneth "$newreply = "";" :
In the end I had this:
I thought that this way the whole <div class="threadBottom"> container won't be visible for guests, but this actually resulted in a white page/php error.
Can anyone tell me what my mistake was and how to do it correctly if possible? Thanks in advance.
I am using the buttoncheck.php plugin from here to hide New Thread and New Reply buttons from guests. This is the code that does the trick:
<?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 = "";
}
}
?>
I was thinking if it is possible to hide specific HTML code from guests instead of just $newreply and $newthread.
In particular I want to hide this piece of code from all guests:
<div class="threadBottom">
<ul class="thread_tools">
<li class="subscription_{$add_remove_subscription}">
<a href="usercp2.php?action={$add_remove_subscription}subscription&tid={$tid}&my_post_key={$mybb->post_code}">{$add_remove_subscription_text}
</a>
</li>
</ul>
</div>
I have tried to add the following beneth "$newreply = "";" :
"\<div class=\"threadBottom\"></div>" = "";
In the end I had this:
function buttoncheck_thread()
{
global $newthread, $newreply, $showthread, $forumpermissions;
if ($forumpermissions['canpostthreads'] == 0)
{
$newthread = "";
}
if ($forumpermissions['canpostreplys'] == 0)
{
$newreply = "";
"\<div class=\"threadBottom\"></div>" = "";
}
}
I thought that this way the whole <div class="threadBottom"> container won't be visible for guests, but this actually resulted in a white page/php error.
Can anyone tell me what my mistake was and how to do it correctly if possible? Thanks in advance.