View previous topic :: View next topic |
Author |
Message |
imeridian
Joined: 12 Feb 2002 Posts: 191
|
|
Back to top |
|
 |
MiniSizeIt
Joined: 02 Nov 2002 Posts: 70
|
Posted: Mon Nov 04, 2002 10:01 pm Post subject: |
|
|
I tried to install this but got errors:
Parse error: parse error in c:\wampp13a\htdocs\journal\b2-include\b2template.functions.php on line 1030
Fatal error: Call to undefined function: dropdown_moods() in c:\wampp13a\htdocs\journal\b2-include\b2edit.form.php on line 65
And realized that the Mood is a drop down with over 900 items which would take forever to find a good one. Being able just to type in a certain mood of choosing a smiley face for a mood would be better. |
|
Back to top |
|
 |
imeridian
Joined: 12 Feb 2002 Posts: 191
|
Posted: Tue Nov 05, 2002 1:44 am Post subject: |
|
|
The php include in b2template.functions.php isn't right then... take out the $b2inc part and include it with real directories or just paste the contents of b2mood.functions.php into your b2template.functions.php.
Actually, no, it doesn't take forever to choose a mood, ever use imood.com? I also say that you are able to edit the b2moodlist.txt before installing to shorten the list. The 'extra fields' hack would probably better suited for what you want I suppose. _________________ -indi<br>
http://indiboi.com
http://artlikepornstars.com
http://www.positivefusion.com |
|
Back to top |
|
 |
Cyberian75
Joined: 26 Sep 2002 Posts: 967 Location: Washington
|
Posted: Wed Jan 22, 2003 8:58 pm Post subject: |
|
|
First of all, thank you for such a great hack!
I have duplicated and modified b2categories.php so that I can edit, rename, and delete moods just like the way you do with categories.
Copy the following codes and save it as "b2mood.php," which you have to put it in the main b2 directory. Then, you have to edit "menutop.txt" file in "b2-include" directory to display the "mood" menu in b2edit page.
Also, you have to change the properties of "mood_id" field in b2moods table. Change the property to PRIMARY, UNIQUE, and also change the extra property to "auto_increment". This is done in phpMyAdmin by the way.
Here are the codes...
Code: |
<?php
$title = "Mood";
/* <Mood> */
function add_magic_quotes($array) {
foreach ($array as $k => $v) {
if (is_array($v)) {
$array[$k] = add_magic_quotes($v);
} else {
$array[$k] = addslashes($v);
}
}
return $array;
}
if (!get_magic_quotes_gpc()) {
$HTTP_GET_VARS = add_magic_quotes($HTTP_GET_VARS);
$HTTP_POST_VARS = add_magic_quotes($HTTP_POST_VARS);
$HTTP_COOKIE_VARS = add_magic_quotes($HTTP_COOKIE_VARS);
}
$b2varstoreset = array('action','standalone');
for ($i=0; $i<count($b2varstoreset); $i += 1) {
$b2var = $b2varstoreset[$i];
if (!isset($$b2var)) {
if (empty($HTTP_POST_VARS["$b2var"])) {
if (empty($HTTP_GET_VARS["$b2var"])) {
$$b2var = '';
} else {
$$b2var = $HTTP_GET_VARS["$b2var"];
}
} else {
$$b2var = $HTTP_POST_VARS["$b2var"];
}
}
}
switch($action) {
case "addmood":
$standalone = 1;
require_once("./b2header.php");
if ($user_level < 3)
die ("Cheatin' uh ?");
$mood_name=addslashes($HTTP_POST_VARS["mood_name"]);
$query="INSERT INTO $tablemoods (mood_name) VALUES ('$mood_name')";
$result=mysql_query($query) or die("Couldn't add mood <b>$mood_name</b>");
header("Location: b2mood.php");
break;
case "Delete":
$standalone = 1;
require_once("./b2header.php");
$mood_id = $HTTP_POST_VARS["mood_id"];
$queryname = "SELECT mood_name FROM $tablemoods WHERE mood_id = '$mood_id'";
$resultname = mysql_query($queryname) or die(mysql_error());
$row = mysql_fetch_object($resultname);
$mood_name = $row->mood_name;
$mood_name = addslashes($mood_name);
if ($mood_id=="0")
die("Can't delete the <b>$mood_name</b> category: this is the default one");
if ($user_level < 3)
die ("Cheatin' uh ?");
$query="DELETE FROM $tablemoods WHERE mood_id=\"$mood_id\"";
$result=mysql_query($query) or die("Couldn't delete category <b>$mood_name</b>".mysql_error());
$query="UPDATE $tableposts SET post_mood='0' WHERE post_mood='$mood_id'";
$result=mysql_query($query) or die("Couldn't reset category on posts where category was <b>$mood_name</b>");
header("Location: b2mood.php");
break;
case "Rename":
require_once ("./b2header.php");
$queryname = "SELECT mood_name FROM $tablemoods WHERE mood_id = '$mood_id'";
$resultname = mysql_query($queryname) or die(mysql_error());
$row = mysql_fetch_object($resultname);
$mood_name = $row->mood_name;
$mood_name = addslashes($mood_name);
if ($mood_id=="0")
die("Can't rename the <b>$mood_name</b> category: this is the default one");
?>
<?php echo $blankline; ?>
<?php echo $tabletop; ?>
<p><b>Old</b> name: <?php echo $mood_name ?></p>
<p>
<form name="renamecat" action="b2mood.php" method="post">
<b>New</b> name:<br />
<input type="hidden" name="action" value="editedmood" />
<input type="hidden" name="mood_id" value="<?php echo $HTTP_POST_VARS["mood_id"] ?>" />
<input type="text" name="mood_name" value="<?php echo $mood_name ?>" /><br />
<input type="submit" name="submit" value="Edit it!" class="search" />
</form>
<?php echo $tablebottom; ?>
<?php
break;
case "editedmood":
$standalone = 1;
require_once("./b2header.php");
if ($user_level < 3)
die ("Cheatin' uh ?");
$mood_name=addslashes($HTTP_POST_VARS["mood_name"]);
$mood_id=addslashes($HTTP_POST_VARS["mood_id"]);
$query="UPDATE $tablemoods SET mood_name='$mood_name' WHERE mood_id=$mood_id";
$result=mysql_query($query) or die("Couldn't edit mood <b>$mood_name</b>: ".mysql_error());
header("Location: b2mood.php");
break;
default:
$standalone=0;
require_once ("./b2header.php");
if ($user_level < 3) {
die("You have no right to edit the categories for this blog.<br>Ask for a promotion to your <a href=\"mailto:$admin_email\">blog admin</a> :)");
}
?>
<?php echo $blankline ?>
<?php echo $tabletop ?>
<table cellpadding="5" cellspacing="0">
<tr>
<td>
<form name="b2mood" method="post">
<b>Edit</b> a mood:<br />
<?php
$query="SELECT * FROM $tablemoods ORDER BY mood_name";
$result=mysql_query($query);
echo "<select name=\"mood_id\">\n";
echo "\t<option value=\"0\">b2moods:</option>\n";
while($row = mysql_fetch_object($result)) {
if ($row->mood_id == $mood_id)
echo " selected";
echo "\t<option value=\"".$row->mood_id."\"";
echo ">".$row->mood_name."</option>\n";
}
echo "</select>\n";
?><br />
<input type="submit" name="action" value="Delete" class="search" />
<input type="submit" name="action" value="Rename" class="search" />
</form>
<p>
<b>Add</b> a mood:<br />
<form name="addmood" action="b2mood.php" method="post">
<input type="hidden" name="action" value="addmood" />
<input type="text" name="mood_name" /><br />
<input type="submit" name="submit" value="Add it!" class="search" /></form></td></tr></table>
<?php echo $tablebottom ?>
<?php
break;
}
/* </Moods> */
include($b2inc."/b2footer.php"); ?>
|
_________________ Michael P. |
|
Back to top |
|
 |
Reese
Joined: 07 Sep 2002 Posts: 60
|
Posted: Mon Mar 03, 2003 7:20 pm Post subject: |
|
|
I know this project has been dropped, but I guess it can't hurt to try and see if someone could help.
I installed b2moods to see if I could transform it into a "listening to" field - with a list of possibilities as the b2moodlist.txt. It all installed okay, but I had whitespace in my text file, so only the first word would show up. I wanted to edit that file, to see if I could use a code that inserted a space. I realized that it would need to be updated in the b2moods table, so I just figured screw it, and dropped the whole table to reinstall it.
Now, when I run b2moodinstall.php, it tells me it's created everything the way it should, but the b2mood table doesn't come up.
I have no clue what's going on, I haven't changed anything but the text file, and I even now restored that to the default mood file, just in case.
Does anyone know what could be going wrong?
http://resolidify.org/weblog/b2moodinstall.php, is all I can offer for examples, so that you can see yourself that there's no errors.
Thanks. |
|
Back to top |
|
 |
Cyberian75
Joined: 26 Sep 2002 Posts: 967 Location: Washington
|
Posted: Mon Mar 03, 2003 7:57 pm Post subject: |
|
|
I just tried to run the installer, and I think I know what your problem is. When you dropped the b2mood table, you didn't drop a field in b2post table called "post_mood". So when you try to reinstall b2mood, the installer would halt because that field exists.
So I suggest that you drop that table again as well as that field in b2post table and reinstall it. _________________ Michael P. |
|
Back to top |
|
 |
Reese
Joined: 07 Sep 2002 Posts: 60
|
Posted: Mon Mar 03, 2003 9:39 pm Post subject: |
|
|
Thank you so much, that worked.
Would there be any possible way that there could be spaces inbetween words in b2moodlist.txt? I've tried every way I could think of, but those aren't many.
Thanks. |
|
Back to top |
|
 |
Cyberian75
Joined: 26 Sep 2002 Posts: 967 Location: Washington
|
Posted: Mon Mar 03, 2003 9:44 pm Post subject: |
|
|
Yes, there's a way. Instead of using that text file to edit the moods, implement my "subhack" I provided several posts above. With that, you can delete, edit, and/or rename moods easily. _________________ Michael P. |
|
Back to top |
|
 |
Reese
Joined: 07 Sep 2002 Posts: 60
|
Posted: Mon Mar 03, 2003 9:49 pm Post subject: |
|
|
Oh, I wasn't aware that the result would be any different using your hack.
Convinient, I already have it installed.
Thank you so much, you've been a huge help!! |
|
Back to top |
|
 |
Cyberian75
Joined: 26 Sep 2002 Posts: 967 Location: Washington
|
Posted: Mon Mar 03, 2003 9:54 pm Post subject: |
|
|
You are very welcome.
By the way, once you install b2mood, you don't need that text file on your server since all those moods are copied into the database during installation. _________________ Michael P. |
|
Back to top |
|
 |
Reese
Joined: 07 Sep 2002 Posts: 60
|
Posted: Mon Mar 03, 2003 10:32 pm Post subject: |
|
|
Thank you, I'm having a problem though.
My "moods" aren't showing up in their post.
It's actually a "listening to" field in my blog, so this is what the piece incorporating it into my template looks like:
<?php the_mood('<b>Listening to:','</b>'); ?>
What could be going wrong? Thanks. |
|
Back to top |
|
 |
Cyberian75
Joined: 26 Sep 2002 Posts: 967 Location: Washington
|
Posted: Mon Mar 03, 2003 10:36 pm Post subject: |
|
|
But you do get a list of "moods" in b2edit page? _________________ Michael P. |
|
Back to top |
|
 |
Reese
Joined: 07 Sep 2002 Posts: 60
|
Posted: Mon Mar 03, 2003 10:38 pm Post subject: |
|
|
Yes. |
|
Back to top |
|
 |
Cyberian75
Joined: 26 Sep 2002 Posts: 967 Location: Washington
|
Posted: Mon Mar 03, 2003 10:44 pm Post subject: |
|
|
And I assume you edited all the required files/functions, including b2functions.php file? _________________ Michael P. |
|
Back to top |
|
 |
Reese
Joined: 07 Sep 2002 Posts: 60
|
Posted: Mon Mar 03, 2003 10:47 pm Post subject: |
|
|
Correct.
If you'd like to check for yourself, I'd be willing to arrange that. |
|
Back to top |
|
 |
|