ผู้เขียน หัวข้อ: แสดงอารมณ์ในPost Profile  (อ่าน 822 ครั้ง)

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

ออฟไลน์ smf

  • [color=green][i]"ถ้าคุณไม่สามารถอธิบายอย่างง่ายๆ ให้คนอื่นเข้าใจได้แล้วล่ะก็ แสดงว่าคุณยังเข้าใจมันไม่ดีพอ"[/i][/color]
  • Administrator
  • Hero Member
  • *****
  • กระทู้: 1,368
  • พอยท์: 5
    • ดูรายละเอียด
    • pordoo.com
    • อีเมล์
แสดงอารมณ์ในPost Profile
« เมื่อ: 3 ตุลาคม 2015, 00:56:42 »
Mod Name:Mood Bobel (Updated For 2.0 RC3)
http://custom.simplemachines.org/mods/index.php?mod=1380









File Edits


./Themes/default/languages/Modifications.english.php

Find:
โค๊ด: [Select]
?>
Add Before:
โค๊ด: [Select]
// Mood Bobel
$txt['mood_bobel'] = 'Mood';


./Sources/Subs.php

Find:
โค๊ด: [Select]
?>
Add Before:
โค๊ด: [Select]
function MoodBobel()
{
$bobel = array(
'Amused', 'Angry', 'Busy', 'Calm', 'Cold', 'Confused', 'Content', 'Curious',
                        'Depressed', 'Drunk', 'Embarrassed', 'Energetic', 'Envious', 'Exhausted',
                        'Flirty', 'Full', 'Grumpy', 'Happy', 'High', 'Horny', 'Hot', 'Hungry', 'Hyper',
                        'Indescribable', 'Lazy', 'Loved', 'Mischievous', 'Okay', 'Pissed', 'Relaxed', 'Relieved',
                        'Sad', 'Scared', 'Sick', 'Silly', 'Sleepy', 'Smart', 'Stressed', 'Thoughtful', 'Worried'

);
return $bobel;
}


./Sources/Profile-Modify.php

Find:
โค๊ด: [Select]
$erase_options = array();
if (isset($_POST['default_options']) && is_array($_POST['default_options']))

Add Before:
   
โค๊ด: [Select]
// Convert the $_POST['bobel'] to $_POST['default_options']['bobel']
if (isset($_POST['bobel']))
{
$_POST['default_options']['bobel'] = $_POST['bobel'];

}


./Themes/default/Profile.template.php

Find:
โค๊ด: [Select]
if (!isset($context['disabled_fields']['location']) && !empty($context['member']['location']))
echo '
<dt>', $txt['location'], ':</dt>
<dd>', $context['member']['location'], '</dd>';

echo '
</dl>';

Add After:
โค๊ด: [Select]
if(isset($context['member']['options']['bobel']) && !empty($context['member']['options']['bobel']))
{
$bobel = MoodBobel();
echo '
<dl><dt style="color:blue;">', $txt['mood_bobel'], ':</dt>
<dd>', $bobel[$context['member']['options']['bobel']], '</dd>';
}
        echo' </dl>';

Find:
โค๊ด: [Select]
// Callback function for entering a birthdate!
function template_profile_birthdate()
{
global $txt, $context;

Replace With:
โค๊ด: [Select]
// Callback function for entering a birthdate!
function template_profile_birthdate()
{
global $txt, $settings, $context;



// Begin Mood Bobels

// Call the function that has all the mood info
$bobel = MoodBobel();

echo '
<script language="JavaScript" type="text/javascript">
function showmoods()
{
document.images.moods.src = document.forms.creator.bobel.options[document.forms.creator.bobel.selectedIndex].value != \'\' ? \'' . $settings['default_theme_url'] . '/images/moodbobels/\' + document.forms.creator.bobel.options[document.forms.creator.bobel.selectedIndex].value + \'.gif\' : \'' . $settings['default_theme_url'] . '/images/moodbobels/blank.gif\';
}
</script>

<dt style="color:red;">
',$txt['mood_bobel'],':
</dt>
<dd>
<select name="bobel" onchange="showmoods()">
<option value="">Choose Mood</option></br>';

// Loop and show the drop down.
foreach ($bobel as $key => $name)
echo '
<option value="', $key, '" ', isset($context['member']['options']['bobel']) &&  $context['member']['options']['bobel'] == $key ? 'selected="selected"' : '', '>', $name, '</option>';

    echo '
</select>
<img id="moods" src="', $settings['default_theme_url'], '/images/', isset($context['member']['options']['bobel']) && !empty($context['member']['options']['bobel']) ? 'moodbobels/' . $context['member']['options']['bobel'] . '.gif': 'blank.gif', '"  align="top" />
</dd>';


./Themes/default/Display.template.php


Find:
โค๊ด: [Select]
// Show their personal text?
Add Before:
โค๊ด: [Select]
// Did they select a mood?
if(isset($message['member']['options']['bobel']) && !empty($message['member']['options']['bobel']))
{
$bobel = MoodBobel();
echo '

   ', $txt['mood_bobel'], ': ', $bobel[$message['member']['options']['bobel']], ' <br /><img src="', $settings['default_theme_url'], '/images/moodbobels/', $message['member']['options']['bobel'], '.gif" alt="', $bobel[$message['member']['options']['bobel']], '" />';
}

./Themes/default/PersonalMessage.template.php

Find:
โค๊ด: [Select]
// Show their personal text?
Add Before:
โค๊ด: [Select]
// Did they select a mood?
if(isset($message['member']['options']['bobel']) && !empty($message['member']['options']['bobel']))
{
$bobel = MoodBobel();
echo '
<br />', $txt['mood_bobel'], ':', $bobel[$message['member']['options']['bobel']], ' <br /> <img src="', $settings['default_theme_url'], '/images/moodbobels/', $message['member']['options']['bobel'], '.gif" alt="', $bobel[$message['member']['options']['bobel']], '" /><br /><br />';
}



File Operations

Move the included directory "moodbobels" to "./Themes/default/images".
« แก้ไขครั้งสุดท้าย: 3 ตุลาคม 2015, 01:17:41 โดย pordoo »