Mood Bobels

Started by Lord Anubis, May 18, 2008, 01:32:26 AM

Previous topic - Next topic

Lord Anubis

Link to Mod



Author: Lord Anubis   Modification: Mood Bobels   
Version: 1.3                Tested On: SMF 1.1.5



Compatibility
For SMF 1.1.x

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



Using TinyPortal?
This code is for use the MOOD BOBELS V2.0 mod for SMF Only

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 'bobel'", __FILE__, __LINE__);

if(db_affected_rows() != 0) {
  $row = mysql_fetch_assoc($query);
  $bobel_select = $row['value'];
}
else {
  $bobel_select = '';
}
//Has one been selected?
if(isset($_POST['bobel'])) {
  $bobel_new = $_POST['bobel'];
// There's already a mood selected
  if ($bobel_select <> '') {
    $query = db_query(
      "UPDATE {$db_prefix}themes
       SET value=$bobel_new
       WHERE ID_MEMBER = $ID_MEMBER
         AND variable LIKE 'bobel'
       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, 'bobel', $bobel_new)", __FILE__, __LINE__);

  }
  $bobel_select = $bobel_new;
}

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

// 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="MoodBobel();"  id="MoodBobel();" action="'. $action . '" method="post" >
  <table><tr><td><b>', $txt['mood_bobel'], ':</b></td>
             <td><select name="bobel" onchange="MoodBobel();">
                 <option value=""></option>';

// Loop and show the drop down.
  foreach ($bobel as $key => $name)
    echo '
      <option value="', $key, '" ', ($bobel_select <> '' && $bobel_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!!! 

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

Changelog
- 1.0 Initial Release
- 1.1 Added support for the Ultimate Profile Mod by JovanT
- 1.2 Modified the code to use language files instead of hard coding, and fixed several other minor details
- 1.3 Added a array/foreach loop to cut down on the coding

Manu.G

#1
Hi,

that's really a great mod :D :D :D
Most of it I love the bobels :D :D

There are some things I want to ask.

  • The bobel "Calm" isn't to see after selecting of this mood
  • Is it possible to add "none" to it? Maybe a user won't show any mood.  :-\
  • Is it possible to add the changing of the mood to the User-informations-box, so the user can change the mood after (s)he has logged in?
Thanks in advance for your help :)
Version SMF 2.0.8
SimplePortal 2.3.5

Lord Anubis

I will look into those :)

Lord Anubis

Try out the new package, V2.0

Added ability to have no mood shown, added a preview of the mood to the profile manager, added Alt text to the images so when you hover over the image it shows the mood in text form

Hope that helps ;)

Apllicmz

Nice Work
Good Mod
translate portugueses anf brazilian

<file name="$languagedir/Modifications.portuguese.php" error="skip">
<operation>
<search position="end" />
<add><![CDATA[
// Mood Bobel
$txt['mood_bobel'] = 'Humor';

]]></add>
</operation>
</file>

<file name="$languagedir/Modifications.brazilian.php" error="skip">
<operation>
<search position="end" />
<add><![CDATA[
// Mood Bobel
$txt['mood_bobel'] = 'Humor';

]]></add>
</operation>
</file>



Lord Anubis

Sweet will add to the next release ;)

Apllicmz




edi67

will be soon realized for smf 2?
CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

Lord Anubis

Not till I start using SMF 2.0 (when TP becomes available for it ;) ) and it becomes more stable, unless someone wants to make it compatible :)

dreama.nana2

#9
Any chance you can make this to work in the "classic" version? When I installed it I got the list of moods but no icons. And when it came to installing the userprofile temp file it  stopped or something.  "success" did not read all the way down.

Edit: ok, I uploaded the images, now I can see a preview of the images when I'm in my profile but when it's not showing up on the board.

Lord Anubis

You will have to manually code that into the display.template.php for your theme

and what do you mean by classic version, do you mean default...If so this installs perfectly into the default version as do all mods

and it should have uploaded the icons when the mod installed so I dunno what is going on there

and did you get error on the installation or skip, because if you dont have the ultimate profile mod, it will skip this template

dreama.nana2

I don't think I have the utlitmate profile mod. When I uploaded the folder of the icons manually they showed in preview on the profile but not on the board. otherwise it seemed to work. what i mean by classic is not the default but the "classic" theme.

dreama.nana2

#12
and it wasn't an error but a "skip" - i'm gonna try again.

this is what it says right now...

7.     Execute Modification     ./Themes/default/UltimateProfile.template.php     Skipping file
8.    Extract Tree    ./Themes/default/images/moodbobels    

Nothing by #8 maybe I haven't given it long enough to completely install. I'll wait a few minutes to see if it finishes.

Question: is the "Ultimate Profile Mod" a requirement to use this mod?

dreama.nana2

God I am way confused. This is my first forum and I'm lucky to get this far. I've found the display.template file through my admin panel. i have that open. i have the instructions for manual install open also. i see line 1... line3... and so forth. but i'm soooooo confused. like i said it shows up when i preview my profile but not on the board.

Lord Anubis

Your looking way too into this

1. Ultimate Profile is NOT required, that is why it says skip
2. If you are using the default you dont have to modify the display.template
3. You must select a mood first in your profile for a mood to appear on your profile and posts

dreama.nana2

ok... you're thinking "classic" means default. i'm not using the default. it's called Classic YaBB SE Theme.

Ok, so tell me why the preview is showing up in my profile but NOT on the board?

And since I'm NOT using the "Default" theme, exactly what is it that I need to change?? And PALEASE be specific.. Thank You.

dreama.nana2

LOL I'd be happy just to get this to work to begin with.

dreama.nana2

alright, i'll give it a try. i'm getting a headache. doesn't make sense it shows up on the profile but not  on the post profile. i'll let you know what happens.

dreama.nana2

It didn't work :( This is what I see in my Profile Information Settings:



But there is nothing, not even an indication that anything's suppose to be there when you look at the profile in the post where the Avatar's are. I'm about to give up cause this is making me feel stupid. It's a great Mod and I just wish it would work for ME.

Lord Anubis

#19
For Version 2.0

MAKE A BACKUP FIRST OF THE display.template.php in case something goes wrong you can replace the file

Open the display.template.php in the themes folder for the classic theme...

Find

// Show their personal text?


Add before


// Did they select a mood?
if(isset($message['member']['options']['bobel']) && !empty($message['member']['options']['bobel']))
{
$bobel = MoodBobel();
echo '

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



BTW, I would get used to using the package parser if you are going to use a theme other than the default, because you will have to manually install most mods

SMF Package Parser

:)

Advertisement: