ติดต่อลงโฆษณา racingweb@gmail.com

ผู้เขียน หัวข้อ: มาทำ Enhanced Profile Header กัน  (อ่าน 10408 ครั้ง)

0 สมาชิก และ 1 บุคคลทั่วไป กำลังดูหัวข้อนี้

ออฟไลน์ chaotoob.com

  • Jr. Member
  • **
  • กระทู้: 72
    • ดูรายละเอียด
มาทำ Enhanced Profile Header กัน
« เมื่อ: 10/08/09, 05:51:05 »
มาทำ Enhanced Profile Header แบบ Manual กัน
อ้างถึง
http://custom.simplemachines.org/mods/index.php?mod=1611

เริ่ม File Edits

เปิด ./Themes/default/index.template.php

หา Code นี้
โค้ด: [เลือก]
global $context, $settings, $options, $scripturl, $txt, $modSettings;

Copy Code นี้ไปวางทับที่ให้หา
โค้ด: [เลือก]
global $context, $settings, $options, $scripturl, $txt, $modSettings, $user_info;
หา Code นี้
โค้ด: [เลือก]
if (!empty($context['user']['avatar']))
echo '
<td class="windowbg" valign="middle">', $context['user']['avatar']['image'], '</td>';

echo '
<td colspan="2" width="100%" valign="top" class="windowbg2"><span class="middletext">';

// If the user is logged in, display stuff like their name, new messages, etc.
if ($context['user']['is_logged'])
{
echo '
<a href="', $scripturl, '?action=unread">', $txt['unread_since_visit'], '</a> <br />
<a href="', $scripturl, '?action=unreadreplies">', $txt['show_unread_replies'], '</a><br />';

}
// Otherwise they're a guest - send them a lovely greeting...
else
echo $txt['welcome_guest'];

// Now, onto our second set of info, are they logged in again?
if ($context['user']['is_logged'])
{
// Is the forum in maintenance mode?
if ($context['in_maintenance'] && $context['user']['is_admin'])
echo '
<b>', $txt[616], '</b><br />';

// Are there any members waiting for approval?
if (!empty($context['unapproved_members']))
echo '
', $context['unapproved_members'] == 1 ? $txt['approve_thereis'] : $txt['approve_thereare'], ' <a href="', $scripturl, '?action=viewmembers;sa=browse;type=approve">', $context['unapproved_members'] == 1 ? $txt['approve_member'] : $context['unapproved_members'] . ' ' . $txt['approve_members'], '</a> ', $txt['approve_members_waiting'], '<br />';

// Show the total time logged in?
if (!empty($context['user']['total_time_logged_in']))
{
echo '
', $txt['totalTimeLogged1'];

// If days is just zero, don't bother to show it.
if ($context['user']['total_time_logged_in']['days'] > 0)
echo $context['user']['total_time_logged_in']['days'] . $txt['totalTimeLogged2'];

// Same with hours - only show it if it's above zero.
if ($context['user']['total_time_logged_in']['hours'] > 0)
echo $context['user']['total_time_logged_in']['hours'] . $txt['totalTimeLogged3'];

// But, let's always show minutes - Time wasted here: 0 minutes ;).
echo $context['user']['total_time_logged_in']['minutes'], $txt['totalTimeLogged4'], '<br />';
}
echo ' </span>';
}
// Otherwise they're a guest - this time ask them to either register or login - lazy bums...

Copy Code นี้ไปวางทับที่ให้หา
โค้ด: [เลือก]
if (!empty($context['user']['avatar']))
echo '
<td class="windowbg" valign="middle"><a href="', $scripturl, '?action=profile">', $context['user']['avatar']['image'], '</a></td>';

echo '
<td colspan="2" width="30%" valign="top" class="windowbg2"><span class="middletext">';

// If the user is logged in, display stuff like their name, new messages, etc.
if ($context['user']['is_logged'])
{       
echo '
<a href="', $scripturl, '?action=unread">', $txt['unread_since_visit'], '</a> <br />
<a href="', $scripturl, '?action=unreadreplies">', $txt['show_unread_replies'], '</a><br />
<a href="'.$scripturl.'?action=profile;sa=showPosts">'.$txt['own_posts'].'</a><br />';
if ($context['allow_pm'])
        echo'
'.$txt[144].' : <a href="', $scripturl, '?action=pm">', $context['user']['messages'], ' ', $context['user']['messages'] != 1 ? $txt[471] : $txt[153], '</a>', $txt['newmessages4'], ' ', $context['user']['unread_messages'], ' ', $context['user']['unread_messages'] == 1 ? $txt['newmessages0'] : $txt['newmessages1'];
    echo'<br />';
if (!empty($user_info['last_login']))
echo '      '.$txt['last_login'].': '.timeformat($user_info['last_login']), '<br />';
}
// Otherwise they're a guest - send them a lovely greeting...
else
echo $txt['welcome_guest'];

// Now, onto our second set of info, are they logged in again?
if ($context['user']['is_logged'])
{
// Is the forum in maintenance mode?
if ($context['in_maintenance'] && $context['user']['is_admin'])
echo '
<b>', $txt[616], '</b><br />';

// Are there any members waiting for approval?
if (!empty($context['unapproved_members']))
echo '
', $context['unapproved_members'] == 1 ? $txt['approve_thereis'] : $txt['approve_thereare'], ' <a href="', $scripturl, '?action=viewmembers;sa=browse;type=approve">', $context['unapproved_members'] == 1 ? $txt['approve_member'] : $context['unapproved_members'] . ' ' . $txt['approve_members'], '</a> ', $txt['approve_members_waiting'], '<br />';

echo'<hr>
<div align="center"><a href="'.$scripturl.'?action=profile">'.$txt['your_profile'].'</a> | <a href="'.$scripturl . '?action=markasread;sa=all;sesc=' . $context['session_id'],'">'.$txt[452].'</a> | <a href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">' , $txt[108] , '</a></div>

</span>
<td colspan="2" width="100%" valign="top" class="windowbg2"><span class="middletext">
<b>'.$txt['my_stats'].':</b><br />
&raquo; '.$txt['you_have'].' <b>'.$user_info['posts'].'</b> '.$txt[21].'<br />
&raquo; ';
        // Show the total time logged in?
if (!empty($context['user']['total_time_logged_in']))
{
echo '
', $txt['totalTimeLogged1'];

// If days is just zero, don't bother to show it.
if ($context['user']['total_time_logged_in']['days'] > 0)
echo $context['user']['total_time_logged_in']['days'] . $txt['totalTimeLogged2'];

// Same with hours - only show it if it's above zero.
if ($context['user']['total_time_logged_in']['hours'] > 0)
echo $context['user']['total_time_logged_in']['hours'] . $txt['totalTimeLogged3'];

// But, let's always show minutes - Time wasted here: 0 minutes ;).
echo $context['user']['total_time_logged_in']['minutes'], $txt['totalTimeLogged4'], '<br />';
}
echo'
<hr>
<b>', $txt[645], ':</b><br />
&raquo; ', $context['common_stats']['total_posts'], ' ', $txt[95], ' ', $txt['smf88'], ' ', $context['common_stats']['total_topics'], ' ', $txt[64], ' ', $txt[525], ' ', $context['common_stats']['total_members'], ' ', $txt[19], '.<br />
&raquo; ', ($settings['show_latest_member'] ? '' . $txt[201] . ' <b>' . $context['common_stats']['latest_member']['link'] . '</b>' . $txt[581] : '');
echo '</span></td>';
}
// Otherwise they're a guest - this time ask them to either register or login - lazy bums...

เปิด ./Themes/default/languages/Modifications.english.php

หา Code นี้
โค้ด: [เลือก]
?>
Copy Code นี้ไปวางก่อนหน้าที่ให้หา
โค้ด: [เลือก]
$txt['my_stats'] = 'My Stats';
$txt['you_have'] = 'You have';
$txt['own_posts'] = 'Show Own Posts';
$txt['last_login'] = 'Last Login';
$txt['your_profile'] = 'Your Profile';

เปิด ./Themes/default/languages/Modifications.thai-utf8.php หรือ Modifications.thai.php
หา Code นี้
โค้ด: [เลือก]
?>
Copy Code นี้ไปวางก่อนหน้าที่ให้หา
โค้ด: [เลือก]
$txt['my_stats'] = 'My Stats';
$txt['you_have'] = 'You have';
$txt['own_posts'] = 'Show Own Posts';
$txt['last_login'] = 'Last Login';
$txt['your_profile'] = 'Your Profile';

เป็นอันเสร็จสิ้นก็จะได้แบบนี้