WP-Mood Hack
-
I have decided to post my first hack. I switched to WP from LiveJournal and liked their mood/music listing. So I wrote this hack to display these.
You can see it in action at my site: http://www.lossofsignal.net
download it at http://www.lossofsignal.net/wp-mood1dot0.rar
if you see any problems/bugs let me know!
x3kep
-
Awesome dude!
So where does the music hack come from?It’s included with the mood hack. as an All in One.
AnonymousI’ve made my own little “hack” that displays the music currently playing. It’s made in PHP, and runs as a daemon on your system, and whenever a new song is played on my computer, it gets sent to my blog.
Requirements:
Linux
Rhythmbox
PHP
see it in action: http://www.hystrix.se/sigge
also note the chatbot πCould you help me with the wp-post. It keeps giving me this error
Error
SQL-query :
post_music tinytext NOT NULL , post_mood smallint( 6 ) NOT NULL default ‘0’what you have posted is not a full query. if you are trying to add the tables from a sql query you neeed to use this:
ALTER TABLE wp_post ADD post_music tinytext NOT NULL
and
ALTER TABLE wp_post ADD post_mood smallint( 6 ) NOT NULL default ‘0’
These should work to add the two additional fields. change wp_post if you have changed your table name that holds post info.
x3kepCan they be separated? I’d be interested in the mood part of the hack, and not so much the music portion.
TGi would like to see a split version as well. I’m currently using emotif as a mood plugin as i like that better http://emotif.sourceforge.net but i’d like to see a pure music hack that i can use.
cheers,
-perryAre there actually THREE instances of $trackback = preg_replace(‘|\s+|’, ‘\n’, $trackback); in post.php? I’ve done a search on versions 1.2 and 1.0.1 of this file, but I’m only finding TWO in both cases.
Help?In the version I created the hack in there are THREE instances,
1st) in the case ‘post’
2nd) in the case ‘edit’
3rd) in the case ‘editpost’ further down the file.
my version must be different than everyone elses for some reason. If you only find two just leave it with that. If you miss one you may see problems in certain instances not saving your choices (like when you post a new message, edit an existing message, or something like that). Otherwise if you only have two I wouldn’t see any other reason that it still wouldn’t work.
As for splitting them, you can by just simply dropping the html and the added fields in the queries for whichever you don’t want. If you want only the music part you don’t need anything in the wp-mood directory so you can just delete all of that.
As for the table name, just replace what I had in that query as wp_post with whatever your table is called and it should work fine.Tontamoo,
Make sure you have the
$post_music = $HTTP_POST_VARS[‘post_music’];
lines added to your post.php file. That’s what reads the variables back for the post when you edit it. Needs to be added after each instance of $trackback = preg_replace(‘|\s+|’, ‘\n’, $trackback); as we where posting about above.Like many others, I only have two instances of $trackback = preg_replace(‘|\s+|’, ‘\n’, $trackback); in the post.php. I ran a search through the code multiple times and found no others.
Specifically, I have $post_music = $HTTP_POST_VARS[‘post_music’]; under case ‘editpost’ and case ‘post’. Where else did you place it? Plus, I have $post_music = $postdate[‘post_music’]; under case ‘edit’.x3kep, the dev team isn’t working on this exactly, we’re working on making this easier to integrate. The new post meta table will allow you to put the music and mood information into a table that associates arbitrary key/value pairs with a given post. This way you don’t have to mess with the posts table or the upgrade code. The new filter and action code may also be useful to you. We’re trying to make it easy for plugin/hack authors to integrate tightly with WordPress without having to hack up WordPress files or tables. How can we make WP-Mood easier to integrate? Add your comments to this thread:
http://wordpress.org/support/10/3295Tontamoo,
that line reading $post_music = $postdate[‘post_music’]; has a typeo in it. It should be
$post_music = $postdata[‘post_music’];
That may be the problem. And I have looked at my source, I also have the same typeo, I must have had it wrong in the directions.I was having the same problem as Tontamoo (old value not being displayed in edit). On the music one it fixed after I added
value="<? echo $post_music ?>"
to the<input name="post_music" type="text" size="50" tabindex="9" >
field in the edit_form pages and correct me if i’m wrong, but shouldn’t<?php displayMoodList(); ?>
in the edit_form pages be<?php displayMoodList($post_mood); ?>
so that the function knows which one to mark select?Anonymousi keep on getting this message:
SQL/DB Error:
[Unknown column ‘post_music’ in ‘field list’]
UPDATE wp_posts SET post_content = ”, post_excerpt = ”, post_title = ”, post_date=”2004-3-27 11:45:58″, post_status = ‘draft’, comment_status = ‘open’, ping_status = ‘open’, post_password = ”, post_name = ”, to_ping = ”, post_music = ”, post_mood = ” WHERE ID = 51
Warning: Cannot modify header information – headers already sent by (output started at /home/scythe/public_html/chaos/wp-includes/wp-db.php:102) in /home/scythe/public_html/chaos/wp-admin/post.php on line 381
whenever i try and post could someone help me?
- The topic ‘WP-Mood Hack’ is closed to new replies.