۱۳۹۰/۱۱/۴، ۰۰:۳۶:۱۸ صبح
(آخرین ویرایش: ۱۳۹۰/۱۱/۴، ۰۰:۴۴:۱۳ صبح، توسط baxe rapper.)
درود
Warning System Improver
Author: Dvdxseo
Submitted: 22nd January 2012
بهبود دهنده سیستم اخطار و اضافه نمودن جزئیاتی به انجمن شما
مزایا:
پیغام بهتری به یوزر پس از گرفتن اخطار میفرستد
ایجاد یک موضوع برای هر هشدار
اجازه ایجاد گونه های اخطار جدید : تخلف : گزارش خلاف زمانی که شما به یک کاربر هشدار میدهید .
نکته :اطمینان حاصل نمایید در قالب
وجود داشته باشد :
قبل از :
و همچنین : در قالب :
وجود داشته باشد قبل از :
نصب و راهاندازی این افزونه کار ساده ای نیست
Warning System Improver
Author: Dvdxseo
Submitted: 22nd January 2012
بهبود دهنده سیستم اخطار و اضافه نمودن جزئیاتی به انجمن شما
مزایا:
پیغام بهتری به یوزر پس از گرفتن اخطار میفرستد
ایجاد یک موضوع برای هر هشدار
اجازه ایجاد گونه های اخطار جدید : تخلف : گزارش خلاف زمانی که شما به یک کاربر هشدار میدهید .
نکته :اطمینان حاصل نمایید در قالب
کد:
'warnings_warn_type'
وجود داشته باشد :
کد:
' {$only_warn} '
قبل از :
کد:
</label>
و همچنین : در قالب :
کد:
'warning_warn_pm'
کد:
: '{$send_pm_forced}'
کد:
'togglePM();' ' onclick="togglePM();"
نصب و راهاندازی این افزونه کار ساده ای نیست
کد php:
HOW TO INSTALL THE WARNING SYSTEM IMPROVER
Please read carefully.
1) MAKE A BACKUP COPY OF THE FOLLOWING FILES!!
- /warnings.php
- /admin/modules/config/warning.php
- /inc/languages/your_language/warnings.lang.php
2) - Open /warnings.php and find (about line 102)
if(!trim($mybb->input['notes']))
{
$warn_errors[] = $lang->error_no_note;
}
REPLACE WITH:
if($mybb->settings['wsi_noadminnote'] != 1)
{
if(!trim($mybb->input['notes']))
{
$warn_errors[] = $lang->error_no_note;
}
}
- (About) Line 120 find
$points = $warning_type['points'];
REPLACE WITH
$points = ($mybb->input['only_warn']) ? '0' : $warning_type['points'];
- (About) Line 192 find
"message" => $mybb->input['pm_message'],
REPLACE WITH
"message" => ($points > 0) ? str_replace('{points}',$lang->sprintf($lang->infraction_profile_pm, $points), $mybb->input ['pm_message']) : str_replace('{points}', $lang->warning_profile_pm, $mybb->input['pm_message']),
- (About) Line 250 find
$db->insert_query("warnings", $new_warning);
ADD AFTER
if($mybb->settings['wsi_create_thread']) // Do we want to create a thread for this warning?
{
$q = $db->fetch_array($db->write_query("SELECT * FROM ".TABLE_PREFIX."posts ORDER BY pid DESC"));
$new_thread = array(
"tid" => "NULL",
"fid" => $mybb->settings['wsi_fid'],
"subject" => ($points > 0) ? str_replace(array('{user_warned}','{type_of_warning}'),array($user['username'],'Infraction'),$mybb->settings['wsi_thread_subject']) : str_replace(array('{user_warned}','{type_of_warning}'),array($user['username'],'Warning'),$mybb->settings['wsi_thread_subject']),
"prefix" => 0,
"icon" => 2,
"poll" => 0,
"uid" => $mybb->user['uid'],
"username" => $mybb->user['username'],
"dateline" => TIME_NOW,
"firstpost" => $q['pid']+1,
"lastpost" => TIME_NOW,
"lastposter" => $mybb->user['username'],
"lastposteruid" => $mybb->user['uid'],
"views" => 0,
"replies" => 0,
"closed" => 0,
"sticky" => 0,
"numratings" => 0,
"totalratings" => 0,
"notes" => "",
"visible" => 1,
"unapprovedposts" => 0,
"attachmentcount" => 0,
"deletetime" => 0
);
$q2 = $db->fetch_array($db->write_query("SELECT * FROM ".TABLE_PREFIX."threads ORDER BY tid DESC"));
$new_post = array(
"pid" => "NULL",
"tid" => $q2['tid']+1,
"replyto" => 0,
"fid" => intval($mybb->settings['wsi_fid']),
"subject" => ($points > 0) ? str_replace(array('{user_warned}','{type_of_warning}'),array($user['username'],'Infraction'),$mybb->settings['wsi_thread_subject']) : str_replace(array('{user_warned}','{type_of_warning}'),array($user['username'],'Warning'),$mybb->settings['wsi_thread_subject']),
"icon" => 2,
"uid" => $mybb->user['uid'],
"username" => $mybb->user['username'],
"dateline" => TIME_NOW,
"message" => "",
"ipaddress" => get_ip(),
"longipaddress" => 0,
"includesig" => 1,
"smilieoff" => 0,
"edituid" => 0,
"edittime" => 0,
"visible" => 1,
"posthash" => 0
);
if($post['pid'])
{
$new_post['message'] = ($points > 0) ? $lang->sprintf($lang->infraction_message_post, $user['uid'], $user['username'], $points, $warning_type['title'], $new_warning['notes'], $post['message'], $post['pid'], $mybb->settings['bburl']) : $lang->sprintf($lang->warning_message_post, $user['uid'], $user['username'], $warning_type['title'], $new_warning['notes'], $post['message'], $post['pid'], $mybb->settings['bburl']);
}
else
{
$new_post['message'] = ($points > 0) ? $lang->sprintf($lang->infraction_profile_post, $user['uid'], $user['username'], $points, $warning_type['title'], $new_warning['notes'], $mybb->settings['bburl']) : $lang->sprintf($lang->warning_profile_post, $user['uid'], $user['username'], $warning_type['title'], $new_warning['notes'], $mybb->settings['bburl']);
}
// Insert the thread in the database.
$db->insert_query("threads",$new_thread);
$db->insert_query("posts",$new_post);
// Time to update fourm counters
update_forum_counters(intval($mybb->settings['wsi_fid']),array("posts" => "+1","threads" => "+1"));
// All Done!
}
- (About) Line 745 find
eval("\$types .= \"".$templates->get("warnings_warn_type")."\";");
ADD BEFORE
$only_warn = ($type['can_be_only_warn']) ? '<input type="checkbox" class="types_check" name="only_warn" onclick="checkType();" /><span class="smalltext">This is only a warn, not an infraction. (No points will be added)</span>' : "";
3) Open /admin/modules/config/warning.php
- (About) Line 455 find
"points" => intval($mybb->input['points']),
ADD AFTER
"can_be_only_warn" => $mybb->input['only_warn'],
- (About) Line 495 find
$expiration_periods = array(
ADD BEFORE
$form_container->output_row("Can be used as \"warning\"?", "If chosen when warning a user, this will not affect their amount of points", $form->generate_check_box("only_warn","1","Yes",array("id" => "only_warn")), 'only_warn');
- (About) Line 541 find
$updated_type = array(
"title" => $db->escape_string($mybb->input['title']),
"points" => intval($mybb->input['points']),
ADD AFTER
"can_be_only_warn" => $mybb->input['only_warn'],
- (About) Line 592 find
$expiration_periods = array(
ADD BEFORE
$form_container->output_row("Can be used as \"warning\"?", "If chosen when warning a user, this will not affect their amount of points", $form->generate_check_box("only_warn","1","Yes",array("id" => "only_warn", "checked" => ($type['can_be_only_warn'] == 1) ? true : false)), 'only_warn');
<!-- LANGUAGE EDITS -->
4) Open inc/languages/your_language/warnings.lang.php
- FIND ?>
ADD BEFORE:
$l['warning_message_post'] = "[align=center][size=medium][b]WARNING FOR [url={7}/member.php?action=profile&uid={1}]{2}[/url][/b][/size][/align]
[b]Reason[/b]: {3}
[b]Notes[/b]: {4}
[b][url={7}/showthread.php?pid={6}#pid{6}]Original Message[/url][/b]: [quote=\'{2}\' pid=\'{6}\']{5}[/quote]";
$l['infraction_message_post'] = "[align=center][size=medium][b]INFRACTION FOR [url={8}/member.php?action=profile&uid={1}]{2}[/url][/b][/size][/align]
[b]Reason[/b]: {4}
[b]Points[/b]: {3}
[b]Notes[/b]: {5}
[b][url={8}/showthread.php?pid={7}#pid{7}]Original Message[/url][/b]: [quote=\'{2}\' pid=\'{7}\']{6}[/quote]";
$l['infraction_profile_post'] = "[align=center][size=medium][b]INFRACTION FOR [url={6}/member.php?action=profile&uid={1}]{2}[/url][/size][/b][/align]
[b]Reason[/b]: {4}
[b]Points[/b]: {3}
[b]Notes[/b]: {5}";
$l['warning_profile_post'] = "[align=center][size=medium][b]WARNING FOR [url={5}/member.php?action=profile&uid={1}]{2}[/url][/size][/b][/align]
[b]Reason[/b]: {3}
[b]Notes[/b]: {4}";
$l['wsi_msg'] = "[url={3}/showthread.php?pid={4}#pid{4}]Original Message[/url]:[quote={1} pid={4}]{2}[/quote]";
$l['infraction_profile_pm'] = "This infraction adds you {1} points. Please remember that your permissions could be restricted if you score many points.";
$l['warning_profile_pm'] = "This is a warning, so no points will be added to your score, but this is to remind you to respect the forum rules.";
- Find:
$l['warning_pm_message'] = "Dear {1},
You have received a warning from the staff of {2}.
--
--
";
ADD WHEREVER YOU WANT: {3} and {4}
That's all. Thanks for using this plugin :)