Hi guys can you help me please this plugin for some reason doesn't work with "button_www" in postbit, can you please check it.
Thanks
<?php
if(!defined("IN_MYBB"))
{
die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}
//hooks
$plugins->add_hook("member_profile_end", "websitecontrolProfile");
$plugins->add_hook("postbit", "websitecontrol");
function websitecontrol_info()
{
return array(
"name" => "User Homepage Control",
"description" => "This plugin limits the use of homepages for users.",
"website" => "http://www.dev-network.com",
"author" => "Tom K.",
"authorsite" => "http://community.mybb.com/user-22017.html",
"compatibility" => "16*",
"version" => "1.2 FINAL",
"GUID" => "9ccbc82addb803c6fed6a598af737d17",
);
}
//All the activation processes go here
function websitecontrol_activate()
{
global $db;
$group = array(
"gid" => "13376",
"title" => "User Homepage Control",
"name" => "websitecontrol",
"description" => "Settings for the Homepage Control Plugin",
"disporder" => "1",
"isdefault" => "no",
);
$db->insert_query("settinggroups", $group);
$gid = $db->insert_id();
$websitecontrol_onSetting = array(
"sid" => "2034",
"name" => "websitecontrol_onsetting",
"title" => "Enabled?",
"description" => "Turn the Homepage Control Plugin On and Off",
"optionscode" => "yesno",
"value" => '1',
"disporder" => '1',
"gid" => '13376',
);
$db->insert_query("settings", $websitecontrol_onSetting);
$websitecontrol_PostsCountRequired = array(
"sid" => "2025",
"name" => "websitecontrol_postcount",
"title" => "Required postcount",
"description" => "The minimum amount of posts needed to display a homepage.",
"optionscode" => "text",
"value" => '10',
"disporder" => '2',
"gid" => '13376',
);
$db->insert_query("settings", $websitecontrol_PostsCountRequired);
$websitecontrol_ExemptGroups = array(
"sid" => "2026",
"name" => "websitecontrol_exemptgroups",
"title" => "Exempt Usergroups",
"description" => "Place usergroups (comma separated) to allow them to display homepages regardless of postcount.",
"optionscode" => "text",
"value" => '4',
"disporder" => '3',
"gid" => '13376',
);
$db->insert_query("settings", $websitecontrol_ExemptGroups);
rebuildsettings();
require MYBB_ROOT.'/inc/adminfunctions_templates.php';
}
//All deactivation processes go here
function websitecontrol_deactivate()
{
global $db;
//remove settings
$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='websitecontrol_onsetting'");
$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='websitecontrol_postcount'");
$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='websitecontrol_exemptgroups'");
$db->query("DELETE FROM ".TABLE_PREFIX."settinggroups WHERE name='websitecontrol'");
rebuildsettings();
require MYBB_ROOT.'/inc/adminfunctions_templates.php';
}
function websitecontrol($p)
{
global $mybb;
$gidlist = "0," . $mybb->settings['websitecontrol_exemptgroups'] . ",";
$groups = explode(",", $gidlist);
if ($mybb->settings['websitecontrol_onsetting'] == 1)
{
if (in_array($p['usergroup'],$groups) == true) {
//user is allowed
}
else {
if ($p['postnum'] >= $mybb->settings['websitecontrol_postcount'])
{
//user is allowed
}
else {
//user is not allowed
$p['button_www'] = '';
}
}
}
else {
//user is allowed, but plugin is disabled
}
}
function websitecontrolProfile()
{
require_once "global.php";
global $mybb, $memprofile, $theme, $lang, $websitecontrolProfile;
//print_r($memprofile);
$gidlist = "0," . $mybb->settings['websitecontrol_exemptgroups'] . ",";
$groups = explode(",", $gidlist);
$uid = $memprofile['uid'];
$output_allow = $memprofile['website'];
$output_disallow = "";
if ($mybb->settings['websitecontrol_onsetting'] == 1)
{
if (in_array($memprofile['usergroup'],$groups) == true) {
$memprofile['website'] = $output_allow;
}
else {
if ($memprofile['postnum'] >= $mybb->settings['websitecontrol_postcount'])
{
}
else {
$GLOBALS['website'] = '';
}
}
}
else {
}
}
?>
Thanks