Mod này cho phép ta quy định số bài viết thành viên cần có để được vào xem forum nào tuỳ theo quy định!
Demo: diễn đàn này, forum "Ebook hay" trong "Kho tài nguyên"
Chạy query sau:
CODE
SQL
ALTER TABLE ibf_forums ADD (
postnview int(11) not null default '0',
postnview_g varchar(255) )
_________
Mở sources/classes/class_forums.php
Tìm:
CODE
/*-------------------------------------------------------------------------*/
// Forums check access
// ------------------
// Blah-de-blah
/*-------------------------------------------------------------------------*/
function forums_check_access($fid, $prompt_login=0, $in='forum')
{
Thêm phía trên:
CODE
function check_postnview($fid)
{
global $DB,$ibforums;
$postnview_ok = 0;
$DB->query("SELECT postnview_g FROM ibf_forums WHERE id = '{$fid}'");
$r_postnview = $DB->fetch_row();
if ($r_postnview['postnview_g'])
{
$postnview = explode (',',$r_postnview['postnview_g']);
foreach ($postnview as $postnview_g)
{
if (($ibforums->member['mgroup'] == $postnview_g) || ($ibforums->member['mgroup_others'] == $postnview_g) )
{
$postnview_ok = 1;
}
}
}
if ($ibforums->member['g_is_supmod'])
{
$postnview_ok = 1;
}
return $postnview_ok;
}
----
Tìm tiếp:
CODE
if ( $std->check_perms($this->forum_by_id[$fid]['show_perms']) == TRUE )
Thêm phía trên:
CODE
// Post n View - unlovelt
if ($this->forum_by_id[$fid]['postnview'] != '0')
{
if ( ($ibforums->member['posts'] < $this->forum_by_id[$fid]['postnview']) && ( $this->check_postnview($fid) == '0' ))
{
$std->Error( array( LEVEL => 1, MSG => 'postnview') );
}
}
---
Tìm:
CODE
if ( isset($forum_data['last_poster_name']))
{
$forum_data['last_poster'] = $forum_data['last_poster_id'] ? "<a href='{$ibforums->base_url}showuser={$forum_data['last_poster_id']}'>{$forum_data['last_poster_name']}</a>"
: $forum_data['last_poster_name'];
}
Thêm phía trên:
CODE
if ( ($this->forum_by_id[$forum_data['fid']]['postnview'] != '0') && ($this->check_postnview($forum_data['fid'])==0 ) &&($ibforums->member['posts'] < $this->forum_by_id[$forum_data['fid']]['postnview']) )
{
$forum_data['last_topic'] = "<i>You need {$this->forum_by_id[$forum_data['fid']]['postnview']} posts to view</i>";
}
_______________
Mở sources/admin/ad_forums.php
Tìm:
CODE
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Allow BBCode to be posted?</b>" ,
$ibforums->adskin->form_yes_no("use_ibc", $forum['use_ibc'] )
) );
Thêm phía dưới:
CODE
// Post n View.
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>How many post does a user need to see this forum?</b><br />(Enter 0 to turn this off for the forum)" ,
$ibforums->adskin->form_input("postnview", $forum['postnview'])
) );
$ibforums->html .= $ibforums->adskin->add_td_row( array( "<b>Which groups won't be affected?</b><br />(Separate many with a comma , Ex : 1,2,3,4 )<br />By default,Admin & SuperMod isn't affected" ,
$ibforums->adskin->form_input("postnview_g", $forum['postnview_g'])
) );
---
Tìm:
CODE
'notify_modq_emails' => $ibforums->input['notify_modq_emails'],
'permission_showtopic' => $ibforums->input['permission_showtopic'],
'permission_custom_error' => $std->my_nl2br( $std->txt_stripslashes($_POST['permission_custom_error']) ),
Thêm phía dưới:
CODE
'postnview' => $ibforums->input['postnview'],
'postnview_g' => $ibforums->input['postnview_g'],
__________
Mở file lang_error.php
Tìm:
CODE
$lang = array (
Thêm phía dưới:
CODE
'postnview' => "Sorry, but you do not have enought post you use this forum.",
Vào chỉnh sửa ACP ->Manage Forums->Settings >How many post does a user need to see this forum? > Which groups won't be affected?
OK!!!