<?php
if(!defined("IN_MYBB"))
{
die("This file cannot be accessed directly.");
}
$plugins->add_hook("admin_user_users_edit", "custompages_perms_admin_user_users_edit");
$plugins->add_hook("admin_user_users_edit_commit", "custompages_perms_admin_user_users_edit_commit");
function custompages_perms_info()
{
return array(
"name" => "Custom Pages Permissions",
"description" => "Add permissions for custom pages.",
"website" => "http://community.mybboard.net/user-13556.html",
"author" => "MattRogowski",
"authorsite" => "http://community.mybboard.net/user-13556.html",
"version" => "1.0",
"compatibility" => "14*,15*,16*"
);
}
function custompages_perms_activate()
{
}
function custompages_perms_deactivate()
{
}
function custompages_perms_admin_user_users_edit()
{
global $plugins;
$plugins->add_hook("admin_formcontainer_end", "custompages_perms_admin_user_users_edit_form");
}
function custompages_perms_admin_user_users_edit_form()
{
global $mybb, $lang, $form, $form_container, $user;
if($mybb->version_code >= 1500) {
$fc = (array)$form_container;
$fctitle = $fc["\0DefaultFormContainer\0_title"];
unset($fc);
} else $fctitle = $form_container->_title;
if($fctitle == $lang->account_settings.": {$user['username']}")
{
$custom_pages_options = array(
$form->generate_check_box("canviewpage_contact", 1, "Can view contact page??", array("checked" => $mybb->input['canviewpage_contact']))
);
$form_container->output_row("Custom Pages Permissions", "", "<div class=\"user_settings_bit\">".implode("</div><div class=\"user_settings_bit\">", $custom_pages_options)."</div>");
}
}
function custompages_perms_admin_user_users_edit_commit()
{
global $mybb, $updated_user;
$updated_user['canviewpage_contact'] = $mybb->input['canviewpage_contact'];
}
?>
|