If you go to http://yourforum.com/misc.php?action=rules, you will see a blank page. This tutorial will show you how to make that page show along with rules that you can edit via the the Configuration tab in you Admin CP.
Difficulty: 6/10
Est. time: About 5 minutes if you do it right.
Ok, first thing you have to do is open up your misc.php file.
Find:
Replace with:
And save the file.
Now when you go to http://yourforum.com/misc.php?action=rules, you should still see a blank page.
Go into your Admin CP, go to the Templates & Style tab, on the left, click Templates, click the theme you are using to open up the templates for that theme, and click Add Template.
Make the name of the template 'misc_rules', and make the content this:
Now if you refresh your Rules page, you should at lease see a page in your site with an empty box.
Go into you Admin CP, go to the Configuration tab, and click Add New Setting.
Make the settings:
Title: Rules Title
Description: This is what the title of the page will be, as well as the title of the rules box.
Group: General Configuration
Display Order: 7
Identifier: rules_title (Must be exactly that for this to work)
Type: Text
Value: Rules
And click Insert New Setting.
Now, click Add New Setting again, and make the settings:
Title: Rules Content
Description: This is what the content of the rules page will be.
Group: General Configuration
Display Order: 8
Identifier: rules_content (Must be exactly that for this to work)
Type: Textarea
Value: The administrator has not set any rules...
And click Insert New Setting.
Thats it! Now when you refresh your rules page, you should see a box that says 'The administrator has not set any rules...'!
To change this, go to your Admin CP, go to the Configuration tab, and go to General Configuration. Scroll down until you see Rules Title and Rules Content, and edit those fields to fit your needs
I hope this tutorial helped, if you have any problems feel free to post here!
Difficulty: 6/10
Est. time: About 5 minutes if you do it right.
Ok, first thing you have to do is open up your misc.php file.
Find:
elseif($mybb->input['action'] == "rules")
{
if($mybb->input['fid'])
{
$plugins->run_hooks("misc_rules_start");
$query = $db->simple_select("forums", "*", "fid='".intval($mybb->input['fid'])."' AND active!=0");
$forum = $db->fetch_array($query);
$forumpermissions = forum_permissions($forum['fid']);
if($forum['type'] != "f" || $forum['rules'] == '')
{
error($lang->error_invalidforum);
}
if($forumpermissions['canview'] != 1)
{
error_no_permission();
}
if(!$forum['rulestitle'])
{
$forum['rulestitle'] = $lang->sprintf($lang->forum_rules, $forum['name']);
}
require_once MYBB_ROOT."inc/class_parser.php";
$parser = new postParser();
$parser_options = array(
"allow_html" => 1,
"allow_mycode" => 1,
"allow_smilies" => 1,
"allow_imgcode" => 1,
"filter_badwords" => 1
);
$forum['rules'] = $parser->parse_message($forum['rules'], $parser_options);
// Make navigation
build_forum_breadcrumb($mybb->input['fid']);
add_breadcrumb($forum['rulestitle']);
$plugins->run_hooks("misc_rules_end");
eval("\$rules = \"".$templates->get("misc_rules_forum")."\";");
output_page($rules);
}
}
(Hopefully thats what it looks like.)Replace with:
elseif($mybb->input['action'] == "rules")
{
if($mybb->input['fid'])
{
$plugins->run_hooks("misc_rules_start");
$query = $db->simple_select("forums", "*", "fid='".intval($mybb->input['fid'])."' AND active!=0");
$forum = $db->fetch_array($query);
$forumpermissions = forum_permissions($forum['fid']);
if($forum['type'] != "f" || $forum['rules'] == '')
{
error($lang->error_invalidforum);
}
if($forumpermissions['canview'] != 1)
{
error_no_permission();
}
if(!$forum['rulestitle'])
{
$forum['rulestitle'] = $lang->sprintf($lang->forum_rules, $forum['name']);
}
require_once MYBB_ROOT."inc/class_parser.php";
$parser = new postParser();
$parser_options = array(
"allow_html" => 1,
"allow_mycode" => 1,
"allow_smilies" => 1,
"allow_imgcode" => 1,
"filter_badwords" => 1
);
$forum['rules'] = $parser->parse_message($forum['rules'], $parser_options);
// Make navigation
build_forum_breadcrumb($mybb->input['fid']);
add_breadcrumb($forum['rulestitle']);
$plugins->run_hooks("misc_rules_end");
eval("\$rules = \"".$templates->get("misc_rules_forum")."\";");
output_page($rules);
}
else
{
add_breadcrumb("Rules Page", "misc.php?action=rules");
eval("\$rules = \"".$templates->get("misc_rules")."\";");
output_page($rules);
}
}
And save the file.
Now when you go to http://yourforum.com/misc.php?action=rules, you should still see a blank page.
Go into your Admin CP, go to the Templates & Style tab, on the left, click Templates, click the theme you are using to open up the templates for that theme, and click Add Template.
Make the name of the template 'misc_rules', and make the content this:
<html>
<head>
<title>{$mybb->settings['bbname']} - {$mybb->settings['rules_title']}</title>
{$headerinclude}
</head>
<body>
{$header}
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr>
<td class="thead" colspan="{$colspan}"><strong>{$mybb->settings['rules_title']}</strong></td>
</tr>
<tr>
<td class="trow1">{$mybb->settings['rules_content']}</td>
</tr>
</table>
{$footer}
</body>
</html>
Now if you refresh your Rules page, you should at lease see a page in your site with an empty box.
Go into you Admin CP, go to the Configuration tab, and click Add New Setting.
Make the settings:
Title: Rules Title
Description: This is what the title of the page will be, as well as the title of the rules box.
Group: General Configuration
Display Order: 7
Identifier: rules_title (Must be exactly that for this to work)
Type: Text
Value: Rules
And click Insert New Setting.
Now, click Add New Setting again, and make the settings:
Title: Rules Content
Description: This is what the content of the rules page will be.
Group: General Configuration
Display Order: 8
Identifier: rules_content (Must be exactly that for this to work)
Type: Textarea
Value: The administrator has not set any rules...
And click Insert New Setting.
Thats it! Now when you refresh your rules page, you should see a box that says 'The administrator has not set any rules...'!
To change this, go to your Admin CP, go to the Configuration tab, and go to General Configuration. Scroll down until you see Rules Title and Rules Content, and edit those fields to fit your needs
I hope this tutorial helped, if you have any problems feel free to post here!