2012-01-01, 05:23 PM
<?php
/********************************************************************************
*
* Posts required to access threads
* Author: Pratik Unadkat (crazy4cs)
* Copyright: © 2011 Pratik Unadkat (crazy4cs)
*
* Website: http://www.mybb-world.com , http://www.ubers.org/
* License: license.txt
* Any codes in this plugin are copyrighted and not allowed to be reproduced.
*
* Requires specified post count set by admin to view specified threads.
*
********************************************************************************/
if(!defined("IN_MYBB"))
die("This file cannot be accessed directly.");
$plugins->add_hook("showthread_start", "prat");
function prat_info()
{
return array(
"name" => "Posts required to access threads.",
"description" => "Requires specified post count set by admin to view specified threads.",
"website" => "http://www.mybb-world.com",
"version" => "1.0",
"author" => "Pratik Unadkat (crazy4cs)",
"authorsite" => "http://www.ubers.org",
"compatibility" => "16*",
'guid' => "aa56c67f00f9013e92e625f2181416b5"
);
}
function prat_activate()
{
global $db;
$settings_group = array(
'name' => 'prat',
'title' => 'Posts required to access threads',
'description' => 'Settings for posts required to access threads plugin.',
'disporder' => '1',
'isdefault' => 'no'
);
$db->insert_query('settinggroups',$settings_group);
$gid = $db->insert_id();
$setting1 = array(
'name' => 'prat_enabled',
'title' => 'Want to enable this plugin?',
'description' => 'By enabling this, the plugin would function.',
'optionscode' => 'yesno',
'value' => '0',
'disporder' => '2',
'gid' => intval($gid)
);
$db->insert_query('settings',$setting1);
$prat_posts = array(
"name" => "prat_posts",
"title" => "Required posts.",
"description" => "Enter how much posts should be required to access the specified threads.",
"optionscode" => "text",
"value" => "",
"disporder" => "3",
"gid" => intval($gid),
);
$db->insert_query("settings", $prat_posts);
$prat_gid = array(
"name" => "prat_gid",
"title" => "Groups not allowed.",
"description" => "Group ids (gid) of the user who cannot view specified threads until above specified post count is achieved, separate each gid with a <strong>comma</strong>.",
"optionscode" => "text",
"value" => "",
"disporder" => "4",
"gid" => intval($gid),
);
$db->insert_query("settings", $prat_gid);
$prat_tid = array(
"name" => "prat_tid",
"title" => "Blocked threads.",
"description" => "Enter the thread id <strong>(tid)</strong> of the threads you would like to block to above specified users until they achieved the specified post count. Separate each tid with a <strong>comma</strong>.",
"optionscode" => "text",
"value" => "",
"disporder" => "5",
"gid" => intval($gid),
);
$db->insert_query("settings", $prat_tid);
rebuild_settings();
}
function prat_deactivate()
{
global $db;
$db->query("DELETE FROM ".TABLE_PREFIX."settinggroups WHERE name='prat'");
$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='prat_enabled'");
$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='prat_posts'");
$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='prat_gid'");
$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='prat_tid'");
rebuild_settings();
}
function prat()
{
global $tid, $mybb, $db;
$groups = explode(',', $mybb->settings['prat_gid']);
$posts = explode(',', $mybb->settings['prat_posts']);
$threads = explode(',', $mybb->settings['prat_tid']);
$require = $mybb->settings['prat_posts'] - $mybb->user['postnum'];
if($mybb->settings['prat_enabled'] == 1)
{
if($mybb->user['postnum'] < $mybb->settings['prat_posts'] && in_array($tid, $threads) && in_array($mybb->user['usergroup'] , $groups))
{
error("Πρέπει να έχεις <strong>{$mybb->settings['prat_posts']}</strong> posts για να έχεις πρόσβαση στο συγκεκριμένο thread.! Αυτη τη στιγμή έχεις <strong>{$mybb->user['postnum']}</strong>, άρα χρειάζεσε ακόμα <strong>{$require}</strong> posts");
}
}
}
?>
Im editing the above plugin,how i can modify it to support my language?
Thanks.