Thread: Mood
View Single Post
  #5  
Old 4th May 2010, 08:06
sammygo sammygo is offline
Senior Member
 
Join Date: May 2008
P2P
Posts: 141
Default Hooh
This mod will display the user mood in userdetail and is based on zodiac mode

First you have to add this to your data base

Code:
CREATE TABLE `mood` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `name` varchar(50) default NULL,
  `moodpic` varchar(50) default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM ;



INSERT INTO `mood` (`id`, `name`, `moodpic`) VALUES
(1, 'Exited', ':w00t:'),
(2, 'Happy', ':smile: '),
(3, 'Cool', ':cool:'),
(4, 'In love', ':wub:'),
(5, 'Sick', ':sick:'),
(6, 'Black Sheep', ':sheep:'),
(7, 'Angry', ':wall:'),
(8, 'Sad', ':''-( ');
after you do that
you have to add one more thing to your data base
Code:
ALTER TABLE `users` ADD `mood` int(10) NOT NULL
my.php
go to
Code:
tr("Stylesheet", "<select name=stylesheet>\n$stylesheets\n</select>",1);
add under
Code:
$mood = "<option value=0>---Your mood ?--</option>n";
$mood_r = mysql_query("SELECT id,name FROM mood ORDER BY name") or die;
while ($mood_a = mysql_fetch_array($mood_r))
$mood .= "<option value=$mood_a[id]" . ($CURUSER["mood"] == $mood_a['id'] ? " selected" : "") . ">$mood_a[name]</option>n";
print("<tr><td align=right><b>mood</b></td><td><select name=mood>\n$mood\n</select>");
takeprofedit.php
go to
Code:
$avatars = ($_POST["avatars"] != "" ? "yes" : "no");
add
Code:
$mood = 0 + $_POST["mood"];
then go to
Code:
$updateset[] = "avatars = '$avatars'";
add under
Code:
$updateset[] = "mood = $mood";
usersdetails.php
now you must decide where you'd like to show the user mood (i have it under avatar)
if you'd like to put this unde avatar go to
Code:
if ($user["avatar"])
    print("<tr><td class=rowhead>Avatar</td><td align=left><img width=150 src=\"" . htmlspecialchars($user["avatar"]) . "\"></td></tr>\n");
and add this
Code:
$mood_r = mysql_query("SELECT moodpic FROM mood WHERE id=$user[mood] LIMIT 1") or sqlerr();
if (mysql_num_rows($mood_r) == 1)
{
  $mood_a = mysql_fetch_assoc($mood_r);
  $mood = "".format_comment($mood_a["moodpic"])."";
}
if ($user["mood"] > 0)  
print("<tr><td class=rowhead>mood</td><td>$mood</td></tr>\n");
for the image I use smiles
if you'd like to change the images with other smile you must go to your data base and modify moodipc
if you don't want to show smiles and want to put other images you must modify moodipc and put your image name and extension (you must have the image in your pic dir) and you must change
Code:
$mood = "".format_comment($mood_a["moodpic"])."";
to
Code:
$mood = "<img src=/pic/$mood_a["moodpic"]  style='padding:2px'>";
hope you like this and find it useful and easy to install :)

THANKS TO putyn @ TBdev.net
www.tbdev.net/index.php?showtopic=16915
Reply With Quote