MyBB Hacks

Full Version: Created one new page - MyMood (by RateU)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hello guys.
I have just changed some items to put the mood in the "USERNAME Forum Info" table. Then I created one page to change the MyMood that RateU created called MyMood.php and the template called MyMood.

[Image: semttulonl.png]

Once the user clicks the MyMood image it will popup the MyMood template/page and the user will be able to select the Mood within the dropdown menu. Once the user select the mood he can close the page and click the "refresh" image seen next the "My Mood:" field. This button will refresh the page to make the new Mood appear in the profile. The MyMood page is also linked to the user "Aditional information" field inside his "edit profile" link (User control panel).

[Image: 69339214.png]

But... Once the user click to change the mood again the MyMood page will not display the current selected MyMood. How can I add to the dropdown menu show the selected MyMood? (the "Aditional information" field inside his "edit profile" link (User control panel) shows the selected mood.)


MyMood.php (Template)

Code:
<html>
<head>
<title>{$mybb->settings['bbname']} - My Mood</title>
{$headerinclude}
</head>
<body>
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr>
<td class="trow1" align="center">
<br />
<br />
<strong>Change My Mood</strong>
<form action="usercp.php" method="post" name="input">
<input type="hidden" name="my_post_key" value="{$mybb->post_code}" />
<blockquote>Select your current Mood from the list bellow.</blockquote>
<br />
<br />
<span class="smalltext">My Mood:</span>
<br />
<select name="profile_fields[fid10]" size="1">
<option value="Aggressive">Aggressive</option>
<option value="Alienated">Alienated</option>
<option value="Amazed">Amazed</option>
<option value="Amused">Amused</option>
<option value="Angelic">Angelic</option>
<option value="Angry">Angry</option>
<option value="Apelike">Apelike</option>
<option value="Artistic">Artistic</option>
<option value="Asleep">Asleep</option>
<option value="Balanced">Balanced</option>
<option value="Banhappy">Banhappy</option>
<option value="Bashful">Bashful</option>
<option value="Bitching">Bitching</option>
<option value="Blah">Blah</option>
<option value="Bookworm">Bookworm</option>
<option value="Bored">Bored</option>
<option value="Breezy">Breezy</option>
<option value="Brooding">Brooding</option>
<option value="Busy">Busy</option>
<option value="Buzzed">Buzzed</option>
<option value="CaffeineFix">CaffeineFix</option>
<option value="Chatty">Chatty</option>
<option value="Cheeky">Cheeky</option>
<option value="Cheerful">Cheerful</option>
<option value="Cloud9">Cloud9</option>
<option value="Cold">Cold</option>
<option value="Coldturkey">Coldturkey</option>
<option value="Confused">Confused</option>
<option value="Cool">Cool</option>
<option value="Crappy">Crappy</option>
<option value="Creative">Creative</option>
<option value="Curious">Curious</option>
<option value="Cynical">Cynical</option>
<option value="Daring">Daring</option>
<option value="Dead">Dead</option>
<option value="Depressed">Depressed</option>
<option value="Devilish">Devilish</option>
<option value="Disagree">Disagree</option>
<option value="Doh">Doh</option>
<option value="Doubtful">Doubtful</option>
<option value="Dramaqueen">Dramaqueen</option>
<option value="Dreaming">Dreaming</option>
<option value="Drunk">Drunk</option>
<option value="Elated">Elated</option>
<option value="Energetic">Energetic</option>
<option value="Fiendish">Fiendish</option>
<option value="Fine">Fine</option>
<option value="Flirty">Flirty</option>
<option value="Gloomy">Gloomy</option>
<option value="Goofy">Goofy</option>
<option value="Grumpy">Grumpy</option>
<option value="Happy">Happy</option>
<option value="Hot">Hot</option>
<option value="Hungover">Hungover</option>
<option value="InLove">InLove</option>
<option value="Innocent">Innocent</option>
<option value="Inpain">Inpain</option>
<option value="Insomnious">Insomnious</option>
<option value="Inspired">Inspired</option>
<option value="Lonely">Lonely</option>
<option value="Lucky">Lucky</option>
<option value="Lurking">Lurking</option>
<option value="Mellow">Mellow</option>
<option value="Mischievious">Mischievious</option>
<option value="Mondayblues">Mondayblues</option>
<option value="Musical">Musical</option>
<option value="Nerdy">Nerdy</option>
<option value="Notamused">Notamused</option>
<option value="Notworthy">Notworthy</option>
<option value="Paranoid">Paranoid</option>
<option value="Pensive">Pensive</option>
<option value="Predatory">Predatory</option>
<option value="Procrastinating">Procrastinating</option>
<option value="Psychedelic">Psychedelic</option>
<option value="Question">Question</option>
<option value="Relaxed">Relaxed</option>
<option value="Roflmao">Roflmao</option>
<option value="Sad">Sad</option>
<option value="Scared">Scared</option>
<option value="Scurvy">Scurvy</option>
<option value="Shocked">Shocked</option>
<option value="Sick">Sick</option>
<option value="Sleepy">Sleepy</option>
<option value="Sluggish">Sluggish</option>
<option value="Sneaky">Sneaky</option>
<option value="Snobbish">Snobbish</option>
<option value="Spaced">Spaced</option>
<option value="Spooky">Spooky</option>
<option value="Sporty">Sporty</option>
<option value="Starving">Starving</option>
<option value="Stressed">Stressed</option>
<option value="Sunshine">Sunshine</option>
<option value="Sweettooth">Sweettooth</option>
<option value="Thinking">Thinking</option>
<option value="Tired">Tired</option>
<option value="Torn">Torn</option>
<option value="Twisted">Twisted</option>
<option value="Veggedout">Veggedout</option>
<option value="Volatile">Volatile</option>
<option value="Woot">Woot</option>
<option value="Worried">Worried</option>
<option value="Yeehaw">Yeehaw</option>
</select>
</td>
<br />
<br />
<tr>
<td>
<div align="center">
<input type="hidden" name="action" value="do_profile" />
<input type="submit" class="button" name="regsubmit" value="Update Profile" />
</div>
</td>
</tr>
</form>
</td>
</tr>
</table>
</body>
</html>


MyMood.php (File itself)

Code:
<?php

define('IN_MYBB', 1); // (1a)
require "./global.php"; // (1b)

add_breadcrumb("MyMood", "MyMood.php"); // (2)

eval("\$MyMood = \"".$templates->get("MyMood")."\";"); // (3)
output_page($MyMood); // (4)

?>


Thank you. Smile

(11-28-2010 12:46 AM)Skiilz Wrote: [ -> ]I have just changed some items to put the mood in the "USERNAME Forum Info" table

What do you mean by "USERNAME Forum Info table"?
The first profile table in the left:

Code:
Skiilz's Forum Info
Joined: 	11-16-2010
Last Visit 	Today 07:42 AM
Total Posts: 	100 (8.22 posts per day | 2.98 percent of total posts)
(Find All Threads — Find All Posts)
Time Spent Online: 	1 Day, 38 Minutes, 59 Seconds

Are you using PHP In Template plugin or Template Conditional plugin?
MyMood page: none;
MyMood on profile: Template Conditional (same as your tutorial)
(11-25-2010 08:05 AM)Skiilz Wrote: [ -> ]P.S.: As stated here (http://community.mybb.com/thread-82787.html

I asked it to you because in this post you are using PHP In Template plugin.
Please remember that you need a different code for the MyBB Hacks Mood if you are using PHP In Template.

(11-28-2010 12:46 AM)Skiilz Wrote: [ -> ]How can I add to the dropdown menu show the selected MyMood?

I think you can use conditional for that.
Try to add this kinds of code in each option there:

Code:
<option value="Aggressive"<if $mybb->user['fid10'] == 'Aggressive' then> selected="selected"</if>>Aggressive</option>

Plugin I have: PHP and Template Conditionals
Thank you that worked. Took me some minutes to add this code to all of the items Smile
(11-28-2010 09:56 AM)Skiilz Wrote: [ -> ]Plugin I have: PHP and Template Conditionals

I hope you've changed the code for the mood system to make it supported by PHP In Template 1.7 plugin "officially" (I think).
SO.. I have to change this:

Code:
<if $post['fid4'] then>
	<div>
		Mood: <img src="images/mybbhacksmood/<?=str_replace(' ', '', $post['fid4'])?>.png" alt="{$post['fid4']}" title="{$post['fid4']}" />
	</div>
</if>


to this:

Code:
<if $post['fid4'] then>
	<div>
		Mood: <img src="images/mybbhacksmood/<?php echo str_replace(' ', '', $post['fid4']); ?>.png" alt="{$post['fid4']}" title="{$post['fid4']}" />
	</div>
</if>

?

I think you should do that.
Not quite sure if using <?=.....?> supported officially by PHP In Template plugin (at least for 1.7).
Pages: 1 2
Reference URL's