สำหรับ SMF 2.0.xxแก้ไขไฟล์:file $boarddir/index.php
ค้นหา -->>
'collapse' => array('BoardIndex.php', 'CollapseCategory'),
เพิ่มไว้หลัง -->>
'comment' => array('ProfileComments2.php', 'CommentsMain'),
file $sourcedir/Admin.php
ค้นหา -->>
'current_theme' => array(
'label' => $txt['theme_current_settings'],
เพิ่มไว้ก่อน -->>
'comment' => array(
'label' => $txt['pcomments_admin'],
'file' => 'ProfileComments2.php',
'function' => 'CommentsMain',
'custom_url' => $scripturl . '?action=admin;area=comment;sa=admin;sesc=' . $sc,
'icon' => 'server.gif',
'subsections' => array(),
),
file $sourcedir/ManagePermissions.php
ค้นหา -->>
$groupLevels['global']['standard'] = array_merge($groupLevels['global']['restrict'], array(
เพิ่มไว้หลัง -->>
'pcomments_view',
'pcomments_add',
'pcomments_edit_own',
'pcomments_edit_any',
'pcomments_delete_own',
'pcomments_delete_any',
'pcomments_autocomment',
ค้นหา -->>
$permissionList = array(
'membergroup' => array(
เพิ่มไว้หลัง -->>
'pcomments_view' => array(false, 'pcomments', 'pcomments'),
'pcomments_add' => array(false, 'pcomments', 'pcomments'),
'pcomments_edit_own' => array(false, 'pcomments', 'pcomments'),
'pcomments_edit_any' => array(false, 'pcomments', 'pcomments'),
'pcomments_delete_own' => array(false, 'pcomments', 'pcomments'),
'pcomments_delete_any' => array(false, 'pcomments', 'pcomments'),
'pcomments_autocomment' => array(false, 'pcomments', 'pcomments'),
file $themedir/Profile.template.php
ค้นหา -->>
}
// Template for showing all the posts of the user, in chronological order.
แก้เป็น -->>
// Start Profile Comments Mod
if (allowedTo('pcomments_view'))
{
echo '
<h3 class="catbg"><span class="left"></span><span class="right"></span>
',$txt['pcomments_usercomments'],'
</h3><div class="windowbg2"><table align="center" width="100%">';
global $sourcedir, $smcFunc;
require_once($sourcedir . '/ProfileComments2.php');
$context['start'] = (int) $_REQUEST['start'];
$dbresult = $smcFunc['db_query']('', "
SELECT
COUNT(*) AS total
FROM {db_prefix}profile_comments
WHERE COMMENT_MEMBER_ID = " . $context['member']['id'] . " AND approved = 1");
$row = $smcFunc['db_fetch_assoc']($dbresult);
$total = $row['total'];
$smcFunc['db_free_result']($dbresult);
echo '<tr><td colspan="2" class="catbg"><a href="', $scripturl, '?action=comment;sa=add;u=' . $context['member']['id'] . '">',$txt['pcomments_addcomment'],'</a></td></tr>';
// Loop though all the comments
$dbresult = $smcFunc['db_query']('', "SELECT p.ID_COMMENT, p.ID_MEMBER, p.comment, p.subject, p.date, m.real_name, p.COMMENT_MEMBER_ID
FROM {db_prefix}profile_comments as p
LEFT JOIN {db_prefix}members AS m ON (p.ID_MEMBER = m.ID_MEMBER)
WHERE p.COMMENT_MEMBER_ID = " . $context['member']['id'] . " AND p.approved = 1 ORDER BY p.ID_COMMENT DESC LIMIT $context[start],10");
$comment_count = $smcFunc['db_affected_rows']();
while ($row = $smcFunc['db_fetch_assoc']($dbresult))
{
echo '<tr class="catbg"><td colspan="2">' . $row['subject'] . ' | ' . timeformat($row['date']) . '</td></tr>';
echo '<tr>
<td width="15%" valign="top" class="windowbg2">';
if ($row['real_name'] != '')
{
// Display the users avatar
$memCommID = $row['ID_MEMBER'];
if ($row['real_name'])
{
$memCommID = $row['ID_MEMBER'];
loadMemberData($memCommID);
loadMemberContext($memCommID);
ShowUserBox($memCommID);
}
}
else
echo $txt['pcomments_text_guest'] . '<br />';
echo '</td>
<td width="85%" valign="top" class="windowbg">' . parse_bbc($row['comment']) . '<br />';
if (allowedTo('pcomments_edit_any') || (allowedTo('pcomments_edit_own') && $row['ID_MEMBER'] == $user_info['id']))
{
echo '<a href="', $scripturl, '?action=comment;sa=edit&id=' . $row['ID_COMMENT'] . '">',$txt['pcomments_editcomment'],'</a>';
}
if (allowedTo('pcomments_delete_any') || (allowedTo('pcomments_delete_own') && $row['ID_MEMBER'] == $user_info['id']))
{
echo ' <a href="', $scripturl, '?action=comment;sa=delete&id=' . $row['ID_COMMENT'] . '">',$txt['pcomments_delcomment'],'</a>';
}
echo '</td>';
echo '</tr>';
}
$smcFunc['db_free_result']($dbresult);
if ($comment_count != 0)
echo '<tr><td colspan="2" class="catbg"><a href="', $scripturl, '?action=comment;sa=add;u=' . $context['member']['id'] . '">',$txt['pcomments_addcomment'],'</a></td></tr>';
if ($total > 0)
{
echo '<tr class="titlebg">
<td align="left" colspan="2">
' . $txt['pcomments_text_pages'];
$context['page_index'] = constructPageIndex($scripturl . '?action=profile;u=' . $context['member']['id'] , $_REQUEST['start'], $total, 10);
echo $context['page_index'];
echo '
</td>
</tr>';
}
echo '</table>
</div>';
}
// End Profile Comments Mod
}
// Template for showing all the posts of the user, in chronological order.
file $languagedir/Modifications.thai-utf8.php
เพิ่ม -->>
//Begin Profile Comments Text Strings
// Permissions
$txt['permissiongroup_pcomments'] = 'Profile Comments';
$txt['permissiongroup_simple_pcomments'] = 'Profile Comments';
$txt['permissionname_pcomments_view'] = 'View Comments';
$txt['permissionhelp_pcomments_view'] = 'If the user is allowed to view user comments.';
$txt['permissionname_pcomments_add'] = 'Allow add Comments';
$txt['permissionhelp_pcomments_add'] = 'If the user is allowed to enter comments in others profile.';
$txt['permissionname_pcomments_edit_own'] = 'Edit own comment.';
$txt['permissionhelp_pcomments_edit_own'] = 'Allows the user to edit their own comments.';
$txt['permissionname_pcomments_edit_any'] = 'Edit any comment';
$txt['permissionhelp_pcomments_edit_any'] = 'Allows the user to edit any comments.';
$txt['permissionname_pcomments_delete_own'] = 'Delete own comment.';
$txt['permissionhelp_pcomments_delete_own'] = 'Allows the user to delete their own comments.';
$txt['permissionname_pcomments_delete_any'] = 'Delete any comment';
$txt['permissionhelp_pcomments_delete_any'] = 'Allows the user to delete any comments.';
$txt['permissionname_pcomments_autocomment'] = 'Auto Approve Comments';
$txt['permissionhelp_pcomments_autocomment'] = 'Comments do not need to wait for approval.';
$txt['cannot_pcomments_add'] = 'You are not allowed to add comments.';
$txt['cannot_pcomments_edit_own'] = 'You are not allowed to edit your own comment.';
$txt['cannot_pcomments_edit_any'] = 'You are not allowed to edit any comment.';
$txt['cannot_pcomments_delete_own'] = 'You are not allowed to delete own comment.';
$txt['cannot_pcomments_delete_any'] = 'You are not allowed to delete any comment.';
$txt['pcomments_admin'] = 'Profile Comments';
// Profile Comments Profile.template.php text strings
$txt['pcomments_usercomments'] = 'User Comments';
$txt['pcomments_editcomment'] = '[Edit Comment]';
$txt['pcomments_delcomment'] = '[Delete Comment]';
$txt['pcomments_addcomment'] = 'Add Comment';
$txt['pcomments_text_pages'] = 'Pages: ';
$txt['pcomments_text_guest'] = 'Guest';
$txt['pcomments_txt_gender'] = 'Gender';
$txt['pcomments_txt_posts'] = 'Posts';
$txt['pcomments_txt_view_profile'] = 'View Profile';
$txt['pcomments_txt_www'] = 'WWW';
$txt['pcomments_txt_profile_email'] = 'Email';
// END Profile Comments Text Strings
ดาวน์โหลด: ProfileComments2.rar
ขออภัย! ท่านไม่สามารถเข้าถึงข้อมูลส่วนนี้ได้ กรุณาอ่าน เงื่อนไขการใช้งาน DexMore.Comแตกไฟล์แล้วอัพโหลดไปไว้ที่
file ProfileComments2.php -->> $sourcedir
file ProfileComments.template2.php -->> $themesdir/default
file ProfileComments.english.php -->> $languagedir
file ProfileComments.thai-utf8.php -->> $languagedir
สร้างไฟล์: ProfileCommentsinstall2.php เพื่อสร้างฐานข้อมูล ไว้ใน $boarddir (ที่เดียวกับไฟล์ SSI.php) รัน http://www.your_url.xxx/$boarddir/ProfileCommentsinstall2.php -->> Enter เสร็จแล้วลบทิ้ง
<?php
/*
Profile Comments: 2.0
http://www.smfhacks.com
ProfileCommentsinstall.php - Profile Comments
Purpose - Installs the database tables for Profile Comments
*/
if (file_exists(dirname(__FILE__) . '/SSI.php') && !defined('SMF'))
require_once(dirname(__FILE__) . '/SSI.php');
// Hmm... no SSI.php and no SMF?
elseif (!defined('SMF'))
die('<b>Error:</b> Cannot install - please verify you put this in the same place as SMF\'s index.php.');
$smcFunc['db_query']('', "CREATE TABLE IF NOT EXISTS {db_prefix}profile_comments
(ID_COMMENT int(11) NOT NULL auto_increment,
ID_MEMBER mediumint(8) unsigned NOT NULL default '0',
comment text,
subject varchar (100),
date int(11) NOT NULL default '0',
COMMENT_MEMBER_ID mediumint(8) unsigned NOT NULL default '0',
approved tinyint(4) NOT NULL default '1',
PRIMARY KEY (ID_COMMENT))
Engine=MyISAM");
// Alter the Profile comments table
$dbresult = $smcFunc['db_query']('', "SHOW COLUMNS FROM {db_prefix}profile_comments");
$approved = 1;
while ($row = $smcFunc['db_fetch_row']($dbresult))
{
if($row[0] == 'approved')
$approved = 0;
}
$smcFunc['db_free_result']($dbresult);
if ($approved)
$smcFunc['db_query']('', "ALTER TABLE {db_prefix}profile_comments ADD approved tinyint(4) NOT NULL default '1'");
// Add Package Servers
$smcFunc['db_query']('', "DELETE FROM {db_prefix}package_servers WHERE url = 'http://www.smfhacks.com'");
$smcFunc['db_query']('', "REPLACE INTO {db_prefix}package_servers (name,url) VALUES ('SMFHacks.com Modification Site', 'http://www.smfhacks.com')");
?>
ลิงค์หัวข้อ:
http://dexmore.com/topic/2296