MyBB Community Forums
Moving $bannedwarning to error template - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: Extensions (https://community.mybb.com/forum-201.html)
+--- Forum: Plugins (https://community.mybb.com/forum-73.html)
+---- Forum: Plugin Support (https://community.mybb.com/forum-72.html)
+---- Thread: Moving $bannedwarning to error template (/thread-116755.html)



Moving $bannedwarning to error template - mattias - 2012-04-12

Hi,

when a user is banned, he gets two notifications:

1) $bannedwarning = <div class="red_alert"?>You are banned etc.<div>
2) error_no_permission = <td class="trow1">{$error}</td> = You don't have permission etc.

In my opinion the second notification is not necessary since everyone knows that if you are banned, you don't have permission for anything. That's why I created this thread, seeking an alteration of the error_no_permission template for banned users.

Since nobody provided me with the information I am seek yet, I thought of an alternate solution. The solution is to put both notifications together and thus making them appear like one single notification.

So my questions is, how can I put $bannedwarning in the error template and making it work? It won't work just by moving $bannedwarning to the error template. Additional things have to be done to make it work.

I hope somebody can help me Smile
Thanks


RE: Moving $bannedwarning to error template - Mr.Kewl - 2012-04-12

Many sites have different settings for banned members.
I may allow my banned members to view all topic but can't post.


RE: Moving $bannedwarning to error template - mattias - 2012-04-12

By banned members I actually mean this permission:

if($mybb->usergroup['canview'] != 1)


RE: Moving $bannedwarning to error template - Mr.Kewl - 2012-04-12

You can change that to
if($mybb->usergroup['canview'] == 1)



RE: Moving $bannedwarning to error template - mattias - 2012-04-12

What should that accomplish? I want to move the $bannedwarning output into the error no permission template. Here are two pictures:

WRONG

GOOD

Edit: But in a perfect world the page banned users should see is this:

PERFECT

EDIT2: I think I got it now. In inc/functions.php I replaced this:
 
/**
 * Produce a friendly error message page
 *
 * @param string The error message to be shown
 * @param string The title of the message shown in the title of the page and the error table
 */
function error($error="", $title="")
{
	global $header, $footer, $theme, $headerinclude, $db, $templates, $lang, $mybb, $plugins;

	$error = $plugins->run_hooks("error", $error);
	if(!$error)
	{
		$error = $lang->unknown_error;
	}

	// AJAX error message?
	if($mybb->input['ajax'])
	{
		// Send our headers.
		@header("Content-type: text/html; charset={$lang->settings['charset']}");
		echo "<error>{$error}</error>\n";
		exit;
	}

	if(!$title)
	{
		$title = $mybb->settings['bbname'];
	}

	$timenow = my_date($mybb->settings['dateformat'], TIME_NOW) . " " . my_date($mybb->settings['timeformat'], TIME_NOW);
	reset_breadcrumb();
	add_breadcrumb($lang->error);
	
	eval("\$errorpage = \"".$templates->get("error")."\";");
	output_page($errorpage);

	exit;
}

with this:

/**
 * Produce a friendly error message page
 *
 * @param string The error message to be shown
 * @param string The title of the message shown in the title of the page and the error table
 */
function error($error="", $title="")
{
	global $header, $footer, $theme, $headerinclude, $db, $templates, $lang, $mybb, $plugins;

	$error = $plugins->run_hooks("error", $error);
	if(!$error)
	{
		$error = $lang->unknown_error;
	}

	// AJAX error message?
	if($mybb->input['ajax'])
	{
		// Send our headers.
		@header("Content-type: text/html; charset={$lang->settings['charset']}");
		echo "<error>{$error}</error>\n";
		exit;
	}

	if(!$title)
	{
		$title = $mybb->settings['bbname'];
	}

	$timenow = my_date($mybb->settings['dateformat'], TIME_NOW) . " " . my_date($mybb->settings['timeformat'], TIME_NOW);
	reset_breadcrumb();
	add_breadcrumb($lang->error);
	
	if($mybb->usergroup['isbannedgroup'] == 1)
	{
	eval("\$errorpage = \"".$templates->get("error_banned")."\";");
	output_page($errorpage);
	}
	else
	{
	eval("\$errorpage = \"".$templates->get("error")."\";");
	output_page($errorpage);
	}

	exit;
}

I made an additional template error_banned:
<html>
<head>
<title>{$title}</title>
{$headerinclude}
</head>
<body>
{$header}
<br />

{$footer}
</body>
</html>

Now it works exactly as it should. Can anyone verify if I forgot something?