ramin006
Member
آموزش قراردادن مد تشکر برای phpbb2 :
توضیح :
---------
این مد به کاربران ثبت نام کرده اجازه تشکر از پست های دیگر کاربران را می دهد.
نمونه:
http://forum.maku-online.com
درباره مد:
راهنمای نصب مد تشکر:
توجه:
- قبل از انجام هرگونه تغییر، حتما از فایل ها و دیتابیس پشتیبان تهیه نمایید! -
آغاز نصب مد :
ابتدا فایل زیر را توسط یک ادیتور باز کنید:
پیدا کنید:
بعد از کد بالا اضافه کنید:
پیدا کنید:
قبل از کد بالا اضافه کنید:
پیدا کنید:
بعد از کد بالا اضافه کنید:
پیدا کنید:
قبل از کد بالا اضافه کنید:
پیدا کنید:
بعد از کد بالا اضافه کنید:
پیدا کنید:
بعد از کد بالا اضافه کنید:
پیدا کنید:
قبل از کد بالا اضافه کنید:
فایل بعدی:
فایل زیر را باز کنید:
در سطرهای پایانی پیدا کنید:
یکی از کدهای زیر را مناسب با زبان انجمن قبل از کد بالا وارد کنید:
کد اول( زبان فارسی):
و یا کد دوم(زبان انگلیسی):
فایل بعدی:
فایل زیر را باز کنید:
اگر از قالب دیگری استفاده می کنید فایل مربوط به آن قالب را باز کنید.
پیدا کنید:
بعد از کد بالا اضافه کنید:
فایل بعدی:
فایل زیر را باز کنید:
پیدا کنید:
قبل از کد بالا اضافه کنید:
پیدا کنید:
در خطی که کد بالا است دنبال این کد بگردید:
بعد از کد بالا اضافه کنید:
پیدا کنید:
کد زیر را به جای کد بالا قرار دهید:
پیدا کنید:
قبل از کد بالا قرار دهید:
وارد دیتابیس انجمن خود شده و کدهای زیر را به آن اضافه کنید.
و نهایتا فایل های زیر را در مسیرهای مشخص شده کپی کنید.
این فایل ها به صورت فشرده در پایان همین آموزش قرار داده شده اند.
توجه: در این راهنما از قالب پیشفرض PHPBB2 یعنی subSilver استفاده شده است اگر از قالب دیگری استفاده می کنید فایل ها را در پوشه ی همان قالب کپی کنید.
--------- تمامی فایل ها و تغییرات را ذخیره کرده و از انجمن خود لذت ببرید----------
اگر با مشکلی در استفاده از این مد برخورد کردید در همین جا مطرح کنید.
دانلود ( لینک اول )
دانلود ( لینک دوم )
توضیح :
---------
این مد به کاربران ثبت نام کرده اجازه تشکر از پست های دیگر کاربران را می دهد.
نمونه:
http://forum.maku-online.com
درباره مد:
کد:
## Installation Level: Easy
## Installation Time: 10 Minutes
## Files To Edit: viewtopic.php
## language/lang_english/lang_main.php
## templates/subSilver/subSilver.cfg
## templates/subSilver/viewtopic_body.tpl
## Included Files: thanks.php
## templates/subSilver/thanks.tpl
## templates/subSilver/thanks_popup.tpl
## templates/subSilver/images/lang_english/icon_thank.gif
راهنمای نصب مد تشکر:
توجه:
- قبل از انجام هرگونه تغییر، حتما از فایل ها و دیتابیس پشتیبان تهیه نمایید! -
آغاز نصب مد :
ابتدا فایل زیر را توسط یک ادیتور باز کنید:
کد:
viewtopic.php
پیدا کنید:
کد:
$pagination = ( $highlight != '' ) ? generate_pagination("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&postdays=$post_days&postorder=$post_order&highlight=$highlight", $total_replies, $board_config['posts_per_page'], $start) : generate_pagination("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&postdays=$post_days&postorder=$post_order", $total_replies, $board_config['posts_per_page'], $start);
بعد از کد بالا اضافه کنید:
کد:
//
// Start Thank Post by User Mod
//
// Set to 1 to use pop-ups instead of using the same window
$popup_enabled = 0;
if ($popup_enabled == 1) {
$thanks_javascript ='<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, \'" + id + "\', \'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=400,height=225\');");
}
// End -->
</script>';
}
//
// End Thank Post by User Mod
//
پیدا کنید:
کد:
'FORUM_ID' => $forum_id,
قبل از کد بالا اضافه کنید:
کد:
'THANKS_JAVASCRIPT' => $thanks_javascript,
پیدا کنید:
کد:
$search = '<a href="' . $temp_url . '">' . sprintf($lang['Search_user_posts'], $postrow[$i]['username']) . '</a>';
کد:
//
// Start Thank Post by User Mod
//
$thanks_img = '';
if ( ($userdata['session_logged_in']) && ($userdata['user_id'] != $poster_id) ) {
// Posts SQL
$sql = "SELECT thanks_from_user_id
FROM " . POSTS_TABLE . "
WHERE post_id = " . $postrow[$i]['post_id'];
if ( !($result = $db->sql_query($sql)) ) {
message_die(GENERAL_ERROR, "Could not obtain post information", '', __LINE__, __FILE__, $sql);
}
$post_row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$already_thanked = 0;
if ($post_row['thanks_from_user_id'] != null) {
$thanked_users = explode("|",$post_row['thanks_from_user_id']);
$thanked_count = count($thanked_users);
// Loop through all users who thanked the post
for ($x = 0; $x < $thanked_count; $x++) {
if ($thanked_users[$x] == $userdata['user_id']) {
$already_thanked = 1;
}
}
}
// If the user hasn't thanked this post
if ($already_thanked == 0) {
$temp_url = append_sid("thanks.$phpEx?p=" . $postrow[$i]['post_id']);
if ($popup_enabled == 1) {
$thanks_img = '<a href="javascript:popUp(\'' . $temp_url . '\')"><img src="' . $images['icon_thank'] . '" alt="' . $lang['Thanks_text'] . '" title="' . $lang['Thanks_text'] . '" border="0" /></a>';
}
else {
$thanks_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_thank'] . '" alt="' . $lang['Thanks_text'] . '" title="' . $lang['Thanks_text'] . '" border="0" /></a>';
}
}
}
//
// End Thank Post by User Mod
//
کد:
$template->assign_block_vars('postrow', array(
کد:
//
// Start Thank Post by User Mod
//
// If the user isn't anonymous
if ($postrow[$i]['user_id'] != ANONYMOUS) {
// From Users SQL
$sql = "SELECT user_posts, user_thanks_given, user_thanks_received
FROM " . USERS_TABLE . "
WHERE user_id = " . $postrow[$i]['user_id'];
if ( !($result = $db->sql_query($sql)) ) {
message_die(GENERAL_ERROR, "Could not obtain user information", '', __LINE__, __FILE__, $sql);
}
$user_row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
// Thanked Posts SQL
$sql = "SELECT COUNT(thanks_count) AS thanks_count
FROM " . POSTS_TABLE . "
WHERE poster_id = " . $postrow[$i]['user_id'] . "
AND thanks_count <> 0";
if ( !($result = $db->sql_query($sql)) ) {
message_die(GENERAL_ERROR, "Could not obtain posts information", '', __LINE__, __FILE__, $sql);
}
$thanked_post_count = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$thanks_given = $lang['Thanks_thanks'] . ': ' . $user_row['user_thanks_given'];
$thanks_received = $lang['Thanks_thanked_1'] . ' ' . $user_row['user_thanks_received'] . ' ' . $lang['Thanks_thanked_2'] . ' ' . $thanked_post_count['thanks_count'] . ' ' . $lang['Thanks_thanked_3'];
}
else {
$thanks_given = "";
$thanks_received = "";
}
//
// End Thank Post by User Mod
//
کد:
'POSTER_FROM' => $poster_from,
کد:
'POSTER_THANKS_GIVEN' => $thanks_given,
'POSTER_THANKS_RECEIVED' => $thanks_received,
کد:
'EDIT' => $edit,
کد:
'THANKS_IMG' => $thanks_img,
کد:
}
$template->pparse('body');
کد:
//
// Start Thank Post by User Mod
//
if ($postrow[$i]['thanks_count'] >= 1) {
$thanked_by = "";
$thanked_users = explode("|",$postrow[$i]['thanks_from_user_id']);
$thanked_count = $postrow[$i]['thanks_count'];
// Loop through all users who thanked the post
for ($x = 0; $x < $thanked_count; $x++) {
// Users SQL
$sql = "SELECT user_id, username
FROM " . USERS_TABLE . "
WHERE user_id = " . $thanked_users[$x];
if ( !($result = $db->sql_query($sql)) ) {
message_die(GENERAL_ERROR, "Could not obtain user information", '', __LINE__, __FILE__, $sql);
}
$user_row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if ($x >= 1) { $thanked_by .= ", "; }
// Add user to thanked by list
$temp_url = "profile.$phpEx?mode=viewprofile&u=" . $user_row['user_id'];
$thanked_by .= '<a href="' . $temp_url . '">' . $user_row['username'] . '</a>';
}
$template->assign_block_vars('postrow.thanks', array(
'L_THANKS_TEXT' => $lang['Thanks_thanked_by'],
'THANKS_USERS' => $thanked_by)
);
}
//
// End Thank Post by User Mod
//
فایل زیر را باز کنید:
کد:
language/lang_english/lang_main.php
یا
language/lang_farsi/lang_main.php
کد:
?>
یکی از کدهای زیر را مناسب با زبان انجمن قبل از کد بالا وارد کنید:
کد اول( زبان فارسی):
کد:
//
// Start Thank Post by User Mod
//
//Persian By Ramin(maku-online.com)
$lang['Thanks_title'] = 'تشکر از کاربر برای پست';
$lang['Thanks_text'] = 'تشکر از کاربر برای این پستش';
$lang['Thanks_thanked_by'] = 'تشکر شده توسط';
$lang['Thanks_thanks'] = 'تشکر کرده';
$lang['Thanks_thanked_1'] = 'تشکر شده';
$lang['Thanks_thanked_2'] = 'بار در';
$lang['Thanks_thanked_3'] = 'پست';
$lang['Thanks_not_logged_in'] = 'برای ارسال تشکر باید با نام کاربری خود وارد شوید';
$lang['Thanks_no_post_specified'] = 'No post was specified.';
$lang['Thanks_no_such_post'] = 'Post doesn\'t exist.';
$lang['Thanks_anonymous'] = 'ارسال تشکر برای پست هایی که توسط مهمان نوشته شده مقدور نمی باشد!';
$lang['Thanks_self'] = 'شما نمی توانیداز پستی که توسط خودتان ارسال شده تشکر نمایید!';
$lang['Thanks_already_thanked'] = 'شما قبلا از این پست تشکر کرده اید';
$lang['Thanks_success_1'] = 'نویسنده مطلب';
$lang['Thanks_success_2'] = 'در بخش';
$lang['Thanks_success_3'] = 'تشکر شما با موفقیت ثبت شد';
$lang['Thanks_success_back'] = 'اگر به صورت خودکار برنگشتید اینجا کلیک کنید';
$lang['Thanks_success_redirect'] = '.شما تا 5 ثانیه دیگر به انجمن باز خواهید گشت';
//End Persian By Ramin(maku-online.com)
// End Thank Post by User Mod
//
کد:
//
// Start Thank Post by User Mod
//
$lang['Thanks_title'] = 'Thank User for Post';
$lang['Thanks_text'] = 'Thank this user for their post';
$lang['Thanks_thanked_by'] = 'Thanked by';
$lang['Thanks_thanks'] = 'Thanks';
$lang['Thanks_thanked_1'] = 'Thanked';
$lang['Thanks_thanked_2'] = 'Times in';
$lang['Thanks_thanked_3'] = 'Posts';
$lang['Thanks_not_logged_in'] = 'You aren\'t logged in.';
$lang['Thanks_no_post_specified'] = 'No post was specified.';
$lang['Thanks_no_such_post'] = 'Post doesn\'t exist.';
$lang['Thanks_anonymous'] = 'You can\' thank an anonymous post.';
$lang['Thanks_self'] = 'You can\'t thank your own post.';
$lang['Thanks_already_thanked'] = 'You have already thanked this post.';
$lang['Thanks_success_1'] = 'Post by';
$lang['Thanks_success_2'] = 'in thread';
$lang['Thanks_success_3'] = 'has successfully been thanked.';
$lang['Thanks_success_back'] = 'Click here if you can\'t wait or if redirection is not supported by your browser';
$lang['Thanks_success_redirect'] = 'Redirecting to the topic/post you came from in 5 seconds.';
//
// End Thank Post by User Mod
//
فایل زیر را باز کنید:
کد:
templates/subSilver/subSilver.cfg
پیدا کنید:
کد:
$images['icon_edit'] = "$current_template_images/{LANG}/icon_edit.gif";
کد:
$images['icon_thank'] = "$current_template_images/{LANG}/icon_thank.gif";
فایل بعدی:
فایل زیر را باز کنید:
کد:
templates/subSilver/viewtopic_body.tpl
کد:
<table width="100%" cellspacing="2" cellpadding="2" border="0">
کد:
{THANKS_JAVASCRIPT}
کد:
{postrow.ROW_CLASS}
کد:
{postrow.POSTER_POSTS}<br />
کد:
<br />{postrow.POSTER_THANKS_GIVEN}<br />{postrow.POSTER_THANKS_RECEIVED}<br /><br />
کد:
{postrow.QUOTE_IMG}
کد:
{postrow.QUOTE_IMG} {postrow.THANKS_IMG}
کد:
<tr>
<td class="spaceRow" colspan="2" height="1"><img src="templates/subSilver/images/spacer.gif" alt="" width="1" height="1" /></td>
</tr>
کد:
<!-- BEGIN thanks -->
<tr>
<td colspan="2" class="{postrow.ROW_CLASS}" width="100%" valign="bottom"><table cellspacing="0" cellpadding="0" border="0" height="18">
<tr>
<td valign="middle"><span class="gen">{postrow.thanks.L_THANKS_TEXT}: {postrow.thanks.THANKS_USERS}</span></td>
</tr>
</table></td>
</tr>
<!-- END thanks -->
وارد دیتابیس انجمن خود شده و کدهای زیر را به آن اضافه کنید.
کد:
ALTER TABLE `phpbb_posts` ADD `thanks_count` MEDIUMINT( 8 ) NOT NULL DEFAULT '0';
ALTER TABLE `phpbb_posts` ADD `thanks_from_user_id` TEXT NULL ;
ALTER TABLE `phpbb_users` ADD `user_thanks_received` MEDIUMINT( 8 ) NOT NULL DEFAULT '0';
ALTER TABLE `phpbb_users` ADD `user_thanks_given` MEDIUMINT( 8 ) NOT NULL DEFAULT '0';
و نهایتا فایل های زیر را در مسیرهای مشخص شده کپی کنید.
این فایل ها به صورت فشرده در پایان همین آموزش قرار داده شده اند.
کد:
copy root/thanks.php to thanks.php
copy root/templates/subSilver/thanks.tpl to templates/subSilver/thanks.tpl
copy root/templates/subSilver/thanks_popup.tpl to templates/subSilver/thanks_popup.tpl
copy root/templates/subSilver/images/lang_english/icon_thank.gif to templates/subSilver/images/lang_english/icon_thank.gif
--------- تمامی فایل ها و تغییرات را ذخیره کرده و از انجمن خود لذت ببرید----------
اگر با مشکلی در استفاده از این مد برخورد کردید در همین جا مطرح کنید.
دانلود ( لینک اول )
دانلود ( لینک دوم )
آخرین ویرایش: