Should look like this instead if you edit:
Replace inc/plugins/ "at_limit.php" with:
<?php
/** Attachment Download Limit
* Author: Mohammad Zangeneh @ MyBBIran.com @ Iran, updated by vintagedaddyo
**/
//I've used my new pattern!:)!
// Direct Access Disallow
if(!defined("IN_MYBB"))
die("Direct access to this file is not allowed!");
//Hooks
$plugins->add_hook("attachment_start", "at_limit_on");
$plugins->add_hook("attachment_end", "at_limit_on");
$plugins->add_hook("attachment_end", "at_limit_tb");
$plugins->add_hook("admin_formcontainer_output_row", "at_limit_acp_ug");
$plugins->add_hook("admin_user_groups_edit_commit", "at_limit_acp_ug_commit");
// Plugin Info
function at_limit_info()
{
return array(
"name" => "Limit Attachments Downloads Per Day ",
"description" => "Allows You To Set A Maximum Attachments Downloads Per Day For UserGroups",
"website" => "www.MyBBIran.com",
"author" => "Mohammad Zangeneh & updated by vintagedaddyo",
"authorsite" => "https://community.mybb.com/user-6029.html",
"version" => "1.0",
"compatibility" => "16*,18*",
"guid" => "97d6cbcfb387b8a9ff08379aabd52be0"
);
}
function at_limit_activate()
{
global $db, $cache;
// Add Table
$db->write_query ("CREATE TABLE `".TABLE_PREFIX."atdl` (
`did` smallint(8) UNSIGNED NOT NULL auto_increment,
`uid` bigint(30) UNSIGNED NOT NULL default '0',
`dateline` bigint(30) UNSIGNED NOT NULL default '0',
PRIMARY KEY (`did`)
) ENGINE=MyISAM");
// Add Field
$db->query("ALTER TABLE ".TABLE_PREFIX."usergroups ADD attachdllimit INT(5) NOT NULL DEFAULT '5'");
$cache->update_usergroups();
}
function at_limit_deactivate()
{
// Delete Field
global $db, $cache;
$db->query("ALTER TABLE ".TABLE_PREFIX."usergroups Drop attachdllimit");
$cache->update_usergroups();
// Delete Table
if ($db->table_exists("atdl"))
$db->drop_table("atdl");
}
function at_limit_tb()
{
global $db, $attachment, $mybb;
if($attachment['thumbnail'])
{
return;
}
if(!$attachment['thumbnail'])
{
$activate = array(
'uid' => intval($mybb->user['uid']),
'dateline' => TIME_NOW,
);
$db->insert_query('atdl', $activate);
}
}
function at_limit_uid($username)
{
global $db;
$q = $db->simple_select('users', 'uid', 'username=\''.$db->escape_string($username).'\'', 1);
return $db->fetch_field ($q, 'uid');
}
function at_limit_on()
{
global $db, $mybb, $lang, $attachment;
$lang->load('at_limit');
if ($mybb->usergroup['attachdllimit'] > 0)
{
$q = $db->simple_select("atdl", "COUNT(*) AS dl_num", "uid='{$mybb->user['uid']}' AND dateline >='".(TIME_NOW - (60*60*24))."'");
$atdls = $db->fetch_field($q, 'dl_num');
if($mybb->input['thumbnail'])
{
return;
}
if ($atdls >= $mybb->usergroup['attachdllimit'])
{
$lang->atdl_error = $lang->sprintf($lang->atdl_error, $mybb->usergroup['attachdllimit']);
error($lang->atdl_error);
}
}
}
function at_limit_acp_ug($pluginargs)
{
global $db, $mybb, $form, $lang;
$lang->load('at_limit');
if($pluginargs['title'] == $lang->misc && $lang->misc)
{
// add . before = for fixing the fact that it dropped all other content in misc before
$pluginargs['content'].= "{$lang->acp_atdl_title}<br /><small class=\"input\">{$lang->acp_atdl_desc}</small><br />".$form->generate_text_box('attachdllimit', $mybb->input['attachdllimit'], array('id' => 'attachdllimit', 'class' => 'field50'));
}
}
function at_limit_acp_ug_commit()
{
global $mybb, $updated_group;
$updated_group['attachdllimit'] = intval($mybb->input['attachdllimit']);
}
?>
If this is easier, here is the "
Limit Attachments Downloads Per Day" (1.0)" plugin fixed:
[
attachment=37666]