ม็อดนี้จะช่วยจำกัดจำนวนการโพสต์ในแต่ละวันของสมาชิกในแต่ละคน ซึ่งสามารถตั้งค่าที่ต้องการโดยกรอกเป็นตัวเลขลงไป ในหน้าต่างแอดมิน
รายละเอียดเบื้องต้น
- ชื่อ : Limit Post Per Day
- ไฟล์ต้นฉบับ :Limit Post Per Day
- เจ้าของ : snork13
- ประเภท : Administrative
- เวอร์ชั่น : 1.0 Beta
- รองรับ SMF เวอร์ชั่น : SMF 1.1
สำหรับ SMF 1.1
ไฟล์ที่ต้องแก้ไข
Load.phpค้นหา
'posts' => empty($user_settings['posts']) ? 0 : $user_settings['posts'],เพิ่มหลังที่หาว่า
'postsPerDay' => empty($user_settings['postsPerDay']) ? 0 : $user_settings['postsPerDay'],ค้นหา
mem.birthdate, mem.memberIP, mem.memberIP2, mem.ICQ, mem.AIM, mem.YIM, mem.MSN, mem.posts,
mem.lastLogin,เพิ่มหลังที่หาว่า
mem.postsPerDay,ค้นหา
mem.birthdate, mem.ICQ, mem.AIM, mem.YIM, mem.MSN, mem.posts, mem.lastLogin, mem.karmaGood,เพิ่มหลังที่หาว่า
mem.postsPerDay,ค้นหา
mem.ID_MEMBER, mem.memberName, mem.realName, mem.emailAddress, mem.hideEmail,
mem.dateRegistered,เพิ่มหลังที่หาว่า
mem.postsPerDay,Post.phpค้นหา
if (isset($_REQUEST['xml']))
{
$context['sub_template'] = 'post';
// Just in case of an earlier error...
$context['preview_message'] = '';
$context['preview_subject'] = '';
}เพิ่มหลังที่หาว่า
if (!allowedTo(array('admin_forum', 'moderate_forum', 'send_mail')))
{
$request = db_query("
SELECT mem.postsPerDay, mem.ID_MEMBER
FROM {$db_prefix}members AS mem
WHERE mem.ID_MEMBER = $ID_MEMBER", __FILE__, __LINE__);
$results = mysql_fetch_row($request);
$pper_day = $results[0];
mysql_free_result($request);
$time_24hours_ago = time() - 86400;
$request = db_query("
SELECT COUNT(m.ID_MSG) AS postCount
FROM {$db_prefix}messages AS m
WHERE m.ID_MEMBER = $ID_MEMBER
AND m.posterTime > '$time_24hours_ago.'", __FILE__, __LINE__);
list ($postCount) = mysql_fetch_row($request);
mysql_free_result($request);
if (!empty($postCount) && $postCount >= $pper_day)
{
// Excempt moderators.
$request = db_query("
SELECT ID_MEMBER
FROM {$db_prefix}moderators
WHERE ID_MEMBER = $ID_MEMBER", __FILE__, __LINE__);
if (mysql_num_rows($request) == 0)
fatal_error(sprintf($txt['post_too_many_per_day'], $pper_day));
mysql_free_result($request);
}
}Profile.phpค้นหา
'posts' => empty($user_profile[$memID]['posts']) ? 0: (int) $user_profile[$memID]['posts'],เพิ่มหลังที่หาว่า
'postsPerDay' => empty($user_profile[$memID]['postsPerDay']) ? '': (int)
$user_profile[$memID]['postsPerDay'],ค้นหา
if (isset($_POST['posts']) && allowedTo('moderate_forum'))
$profile_vars['posts'] = $_POST['posts'] != '' ? (int)
strtr($_POST['posts'], array(',' => '', '.' => '', ' ' => '')) : '\'\'';เพิ่มหลังที่หาว่า
if (isset($_POST['posts']) && allowedTo('moderate_forum'))
$profile_vars['postsPerDay'] = $_POST['postsPerDay'] != '' ? (int)
strtr($_POST['postsPerDay'], array(',' => '', '.' => '', ' ' => '')) : '\'\'';ค้นหา
'posts' => empty($_POST['posts']) ? 0 : (int) $_POST['posts'],เพิ่มหลังที่หาว่า
'postsPerDay' => empty($_POST['postsPerDay']) ? 0 : (int) $_POST['postsPerDay'],Profile.template.phpค้นหา
<tr>
<td>', $txt[86], ': </td>
<td><input type="text" name="posts" size="4" value="', $context['member']['posts'], '" /></td>
</tr>';แทนที่ด้วย
<tr>
<td>', $txt[86], ': </td>
<td>
<input type="text" name="posts" size="4" value="', $context['member']['posts'], '" />
</td>
</tr>
<tr>
<td>', $txt['posts_limit'], ': </td>
<td>
<input type="text" name="postsPerDay" maxlength="4" size="4" value="', $context['member']['postsPerDay'], '" />
</td>
</tr>';Post.thai-utf8.phpค้นหา ?> แล้วเพิ่มก่อนที่หาว่า
$txt['post_too_many_per_day'] = 'สวัสดี '. $context['user']['name']. ', คุณได้โพสต์กระทู้จำนวนมากภายในเวลา 24 ชั่วโมง[br /]
ซึ่งอาจทำให้มองได้ว่าเป็นการสแปม คุณสามารถโพสต์กระทู้ได้อีกครั้งหลังจากเวลาผ่านไป 24 ชั่วโมง'; Profile.thai-utf8.phpค้นหา ?> แล้วเพิ่มก่อนที่หาว่า
$txt['posts_limit'] = 'จำกัดจำนวนกระทู้ต่อวัน'; ดาวน์โหลดไฟล์ pd1_db.php อัพโหลดขึ้นไปไว้ที่เดียวกับไฟล์ SSI.php จากนั้นรันไฟล์โดยการพิมพ์ http://ชื่อเว็บของคุณ.นามสกุล/pd1_db.php เคาะเอนเทอร์หนึ่งทีแล้วลบไฟล์ทิ้ง
หยิบ: simplemachines.in.th