News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Mood Stars

Started by Lord Anubis, May 19, 2008, 03:59:53 PM

Previous topic - Next topic

Lord Anubis

Link to Mod



Author: Lord Anubis   Modification: Mood Stars   
Version: 1.1                Tested On: SMF 1.1.5



Compatibility
For SMF 1.1.x

Introduction
Based off of Gobo's Bear/Mood Tags
Adds "Mood Stars" to the display of the post profile as well as on users profiles.  Users can change their "mood" status via their profile settings.

This mood mod comes with 4 different colors. 

- Yellow
- Red
- Purple
- Green

So you can choose a color that best suits your site



Donate
Has this modification helped you? Support the developer by Donating

Changelog
- 1.0 Initial Release
- 1.1 Added mood to the Personal Message Index

ccbtimewiz


Lord Anubis

#2
thanks that means alot :)

Just wait I am working on a newer version that will totally revamp this one!

If you want to see the features check out my Mood Bobels Mod

I will be upgrading this one soon as well ;)

lax.slash

Look good!

Are you planning to add SMF 2 capability?

Lord Anubis

#4
I will as soon as I begin using SMF 2.0...When TinyPortal is compatible, I will switch ;)

If anyone wants to take a shot at making it SMF 2.0 compatible I dont mind  :D

Apllicmz




Lord Anubis

Thanks again, I will be updating this one soon...To match the features of the Mood Bobels ;)

Sheila * R

SMF version: 1.1.5

Theme: CS Classic / serv Ramadhan

Default Forum Language: English


-------------------------------------------------------------

After installation of this mod it appears that under "Modify Profile - Forum Profile Information" there is section added right above "Birthdate". There text box with the moods in it, however, the moods are not showing in the box and nothing appears on the profile that is displayed in the forums. 

ALSO    I am not sure if it is supposed to be skipping this file. all the others say "test successful."

Execute Modification ./Themes/default/UltimateProfile.template.php Skipping file

Lord Anubis

First you need to modify the language file to have the text to show up in front of the ":"

Second it sounds like you will have to manually insert the code for your theme

In the Profile.template.php

Find:
<td>', $context['member']['location'], '</td>

Add after:

', !empty($context['member']['options']['mood_stars']) ? '</tr><tr>
<td><b>' . $txt['stars_mood']. '</b></td>
<td>' . $context['member']['options']['mood_stars'] . '</td>' : '', '



Find:
// Gender, birthdate and location.

Add Before:
// Begin Mood Stars.
                     $context['mood_stars'] = array(
                        'Achy', 'Angelic', 'Angry', 'Artistic', 'Awake', 'Blank', 'Bored', 'Busy', 'Cold',
'Confused', 'Dirty', 'Drunk', 'Embarrassed', 'Envious', 'Exhausted',
                        'Flirty', 'Full', 'Grumpy', 'Happy', 'Horny', 'Hot', 'Hungry', 'Hyper',
                        'Indescribable', 'Indifferent', 'Loved', 'Mellow', 'Mischievous', 'Pensive',
                        'Sad', 'Sexy', 'Sick', 'Silly', 'Singing', 'Sleepy', 'Smart', 'Sore', 'Stressed', 'Thirsty'
                     );
                     echo '<tr>
                     <td><b>'. $txt['stars_mood']. '</b></td>
                     <td><select name="default_options[mood_stars]">';
                     foreach($context['mood_stars'] as $stars)
                        echo '<option', @$context['member']['options']['mood_stars'] == $txt['mood_'.$stars] ? ' selected="selected"' : '', '>', $txt['mood_'.$stars],'</option>';
                     
                     echo '</select></td></tr>';
                     // Not using them anymore.
                     unset($context['mood_stars'], $stars);
                  // End Mood Stars.


Next it sounds like the images didn't upload so what you need to do is manually FTP the entire folder named  "mood_stars"

/Themes/default/images/


Skipping file means just that, it is skipping it because you dont have that modification installed :)
So it should install fine

madaisy

Ok, i have dilbermc theme, but it doesn't have its own display.template.php and profile.template.php files, so I only have to add the translations to modifications.italian but anyway the images aren't shown anywhere!
Why? Please, help!

lax.slash

You might have to upload the images to the default theme manually through FTP. I had to do this when I installed, because for whatever reason, it created the directory, but never extracted the actual images.

Sheila * R

Quote from: Lord Anubis on May 29, 2008, 07:50:06 PM
First you need to modify the language file to have the text to show up in front of the ":"

Second it sounds like you will have to manually insert the code for your theme

In the Profile.template.php


Next it sounds like the images didn't upload so what you need to do is manually FTP the entire folder named  "mood_stars"

/Themes/default/images/




Okay, where am I supposed to be finding the profile.template.php because I am not seeing it anywhere. Second am I actually supposed to go to my FTP folder and adding the "mood_stars" in there under my themes/default/images???

Lord Anubis

The Profile.template.php is in the theme directory for your theme

yes FTP the "mood_stars" folder with images to themes/default/images

NEMINI

still planning to port the new stuff from mood bobels over to this one?  really looking forward to the mouse over ability being added.  Can be difficult to discern what the image is trying to say.
signatures are boring.

steighan

nice mod, I always was pining for a mod that I could use to show my current mood and disposition, I eventually just gave up and just hardcoded the string A**h** in the template.php



/jk
"Frequently wrong, but never in doubt"

Lord Anubis

#15
Quote from: NEMINI on June 01, 2008, 04:45:02 PM
still planning to port the new stuff from mood bobels over to this one? 

Done :)

This code is for use the MOOD STARS V2.0 mod for SMF for TinyPortal users

Use a PHP block


global $db_prefix, $ID_MEMBER, $txt, $context;

$query = db_query(
    "SELECT value
     FROM {$db_prefix}themes
     WHERE ID_MEMBER = $ID_MEMBER
       AND variable LIKE 'star'", __FILE__, __LINE__);

if(db_affected_rows() != 0) {
  $row = mysql_fetch_assoc($query);
  $star_select = $row['value'];
}
else {
  $star_select = '';
}
//Has one been selected?
if(isset($_POST['star'])) {
  $star_new = $_POST['star'];
// There's already a mood selected
  if ($star_select <> '') {
    $query = db_query(
      "UPDATE {$db_prefix}themes
       SET value=$star_new
       WHERE ID_MEMBER = $ID_MEMBER
         AND variable LIKE 'star'
       LIMIT 1", __FILE__, __LINE__);
  }

// No mood previously selected
  else {
    $query = db_query(
      "INSERT INTO {$db_prefix}themes (ID_MEMBER, ID_THEME, variable, value)
       VALUES ($ID_MEMBER, 1, 'star', $star_new)", __FILE__, __LINE__);

  }
  $star_select = $star_new;
}

// Call the function that has all the mood info
$star = MoodStar();

// find out where we are and figure out how to get back
$str = getenv("QUERY_STRING");
if ($str)
  $action = 'index.php?'.$str;
else
  $action = 'index.php';

// print out the form
echo '
<form  accept-charset="', $context['character_set'], '" class="smalltext" style="padding: 0; margin: 8px 0 8px 0; text-align: center;" name="MoodStar();"  id="MoodStar();" action="'. $action . '" method="post" >
  <table><tr><td><b>', $txt['mood_star'], ':</b></td>
             <td><select name="star" onchange="MoodStar();">
                 <option value=""></option>';

// Loop and show the drop down.
  foreach ($star as $key => $name)
    echo '
      <option value="', $key, '" ', ($star_select <> '' && $star_select == $key) ? 'selected="selected"' : '', '>', $name, '</option>';

  echo '</select></td></tr></table></ br>';
echo '
  <input type="submit" value="', $txt[10], '" />
  </form>';


DEMO LOOK:



A special thanks goes out to JPDeni from TinyPortal for making this code possible!!!

Lord Anubis

PHP Block ;) for TinyPortal  :o

Lord Anubis


Amun

Very cool... love it. Nice work :)
:D :D :D

DadL

#19
I love this mood mod, I installed yellow_mood_stars_1.1 via ParserPackage. I followed everything carefully except for I do not have UltimateProfile.template.php. Mood doesn't show in profile and there are so many error logs like this:

8: Undefined index: stars_mood
File: /home/*******/public_html/Themes/default/Display.template.php (main sub template - eval?)
Line: 332


8: Undefined index: mood_Stressed
File: /home/*******/public_html/Themes/default/Profile.template.php (forumProfile sub template - eval?)
Line: 1407


8: Undefined index: mood_Thirsty
File: /home/*******/public_html/Themes/default/Profile.template.php (forumProfile sub template - eval?)
Line: 1407


8: Undefined index: mood_Blank
File: /home/*******/public_html/Themes/default/Display.template.php (main sub template - eval?)

and so on....


In just a minute, I got 25 pages of error logs.   :(


EDIT:
Im using SMF 1.1.5
theme: blackRain

Advertisement: