This is an addition for the Smileys module that adds an ajax form to the user profile page where each user can select a word describing their current mood and a Smiley face - can be used to display user emotions or users current mood.

Extract and add to your sites/all/modules/smileys directory. So the path will be sites/all/modules/smileys/smileys_mood. Enable the module. That's it. (Unless your domain points to a subdirectory! See below.)

TODO:

  • Clean up module code a bit
  • Add support for more... Smileys list
  • Add support for subdirectory? (in external script)
  • Add to admin section + editable array for word list
  • Could use some tpl work

Potential problems: The external script has to be updated manually if your domain points to a subdirectory. Update smileys_mood/scripts/updateusermood.php - no problems if your Drupal install is in the root directory.

Code:

<?php
// Go to drupal path.. 
   $drupal_path = $_SERVER['DOCUMENT_ROOT'];  // <---- change this one to fit yours i.e. $_SERVER['DOCUMENT_ROOT'].'/subfolder';
?>
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Nathaniel’s picture

FileSize
4.32 KB

Technical difficulties... Here is the file.

Gurpartap Singh’s picture

FileSize
42.08 KB

ooooooooohhhhhhhh you stole my idea

heheheheheh

I'm getting an error when trying to set a text or image mood:

Nathaniel’s picture

It should work. The trick is in the $drupal_path

File:
smileys_mood/scripts/updateusermood.php

You can use:
print $drupal_path;
to test and see if it points to the drupal directory where the includes folder is located.

krutipatel’s picture

Hello Nathaniel,
Thanks for the module...
after changing $drupal_path

File:
smileys_mood/scripts/updateusermood.php

i m getting error like (Fatal error: Cannot redeclare db_status_report() (previously declared in D:\home\networking\includes\database.mysql.inc:20))

krutipatel’s picture

FileSize
4.33 KB

Hello,
I have modified 2 files
1. smileys_mood/scripts/updateusermood.php
2. smileys_mood/smileys_mood.module

now it is working well. you need to set path in File : smileys_mood/scripts/updateusermood.php if you are using sub-folder.
Check attached file

Nathaniel’s picture

Assigned: Unassigned » Nathaniel
Status: Needs work » Needs review
FileSize
5.09 KB

Made a lot of updates / clean up. Drupal friendly now, no need to modify anything.

DONE:

  • Cleaned up code a lot
  • Fixed paths, got rid of external script all together
  • Added to smileys admin section: mood tab + editable array for word list

TODO:

  • Add support for more... Smileys list

Attached is new directory with all module updates. Install in /sites/all/modules directory.

artatac’s picture

at /user/1 I can select a mode but there is no save button and it defaults remains no mood

Nathaniel’s picture

Status: Needs review » Needs work

I will take a look and run a few tests. Do you have javascript enabled? Right now this feature requires it.

artatac’s picture

I have javascript ui and javascript plugin modules enabled
the demo site is at
http://venturacottage.homedns.org/619abstmp/user
webmaster
aa

Nathaniel’s picture

Thanks for the demo site, very helpful. I am 90% sure it has something to do with subdomain / ajax issue, not sure how to fix at the moment, will do some research. Maybe install subdomain module and enable ajax callbacks as needed.

Paths:
smileys/mood/js
smileys/mood/get

OR

smileys/mood*

Nathaniel’s picture

Status: Needs work » Needs review
FileSize
5.68 KB

Cleaned up the code to better meet drupal standards.
*Fixed image path for smiley faces.

artatac’s picture

I installed the revised mood module at www.venturacottage.com and can confirm it is now accepting the mood and its revisions.
I was hoping to use this as the basis of a feature in a Junior School website. The Mood would appear in a block on most pages and allow the pupil to set their mood. The only thing that works against this is that If a pupil sets their mood (after a bad test) to Sad then it will stay like that unless they alter it. For a mood to be correct does it not need to alter itself back to neutral after say 1hr so that if someone is set to sad (or happy) it reflects their current mood?

Nathaniel’s picture

Thanks for the update. Interesting concept. This could be done by adding a timestamp field to the smileys_user_mood database table and maybe writing a script that runs during cron to update moods that are not neutral and are more than one hour old. I have no idea what the server workload would be to do this (depends on how many users are using the mood module I suppose).

JohnnyW’s picture

FileSize
15.27 KB

Huh, I seem to try, but when selecting from either drop down list, or image, it shows my index/ then all files in directory INDEX of /

Any suggestions?

JohnnyW’s picture

No response yet? :(

JohnnyW’s picture

Still no response? :(

Nathaniel’s picture

What is your development environment? Have you tried it on a live site? Are you using sub domains? Can you post a link for testing? Are you using the latest from comment #11?

JohnnyW’s picture

Thank you so much for replying...

My development environment is WAMP, Windows 7, localhost -- to migrate to Ubuntu server once running properly.

I am using Drupal 6.22, PHP 5.3.4, and Apache 2.2.17

No sub domains.

No link to testing, because its on my local server.

I am using from comment #11.

Any suggestions we be sincerely appreciated... . I did post a picture on my earlier post.

Thank you so much.

JohnnyW’s picture

FileSize
158.21 KB

Okay, I noticed when I saved, this comes up for a split of a second, and I captured the image with print screen... it occurs when I press save.

What permissions do you think its talking about? I am admin.

Thank you again!!!!

Nathaniel’s picture

Ran a few tests and everything seems to be working okay. I could not reproduce the problem. I suggest trying the module on a fresh install and/or a different server.

shenagarg’s picture

Nathaniel

I used the smileys_mood module from #11. When I open my account page then for mood it shows "no mood". Then after i choose some mood then it shows "It works!" instead of "no mood" text.

I refreshed my account page to see if changes have taken place but again it showed "no mood". I tried to check the table "smileys_mood_user", and I saw that it contains no record. It is empty table. I am just wondering if it depends on some other module or some setting intially which I need to do before I get it running.

Thanks in advance. Really appreciate all the efforts put forward by people in this community.

Nathaniel’s picture

Hrmm. Did you get it to work?

Installed and tested on fresh install of Drupal 6.22.

The only thing I can think of is that the permission "use smiley select box" is required if you are not user 1 (admin).

shenagarg’s picture

Yes I installed on fresh install of Drupal 6.22. Also, I was trying to use it as admin. Still it didn't work.

JohnnyW’s picture

Tried Smiles in comment box, but brakes user interface for Tiny WYSIWYG module.

Had to uninstall it.