WordPress.org

Ready to get started?Download WordPress

Forums

WP-Mood Hack (35 posts)

  1. x3kep
    Member
    Posted 10 years ago #

    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

  2. carthik
    Member
    Posted 10 years ago #

    Awesome dude!
    So where does the music hack come from?

  3. x3kep
    Member
    Posted 10 years ago #

    It's included with the mood hack. as an All in One.

  4. Anonymous
    Unregistered
    Posted 10 years ago #

    I'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 ;-)

  5. Lauren
    Member
    Posted 10 years ago #

    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'

  6. x3kep
    Member
    Posted 10 years ago #

    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.
    x3kep

  7. TechGnome
    Moderator
    Posted 10 years ago #

    Can they be separated? I'd be interested in the mood part of the hack, and not so much the music portion.
    TG

  8. lectique
    Member
    Posted 10 years ago #

    i 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,
    -perry

  9. Cena
    Member
    Posted 10 years ago #

    Are 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?

  10. x3kep
    Member
    Posted 10 years ago #

    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.

  11. x3kep
    Member
    Posted 10 years ago #

    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.

  12. tontamoo
    Member
    Posted 10 years ago #

    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'.

  13. Ryan Boren
    WordPress Dev
    Posted 10 years ago #

    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/3295

  14. x3kep
    Member
    Posted 10 years ago #

    Tontamoo,
    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.

  15. rapunzell
    Member
    Posted 10 years ago #

    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?

  16. Anonymous
    Unregistered
    Posted 10 years ago #

    i 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?

  17. MrAndyPuppy
    Member
    Posted 10 years ago #

    well, that sounds like you didn't add the field(s) to wp_posts table correctly. Check the install.txt file right at the beginning where it says to add the fields, or further up in this conversation for the actual MySQL commands to add them. Specifically, http://wordpress.org/support/10/3279#post-9

  18. jerryhung
    Member
    Posted 10 years ago #

    I have to use this to show the stored music & mood in edit-form.php and edit-form-advanced.php
    Current Music:  <input name="post_music" type="text" size="50" tabindex="9" value='<?php echo $post->post_music?>'>
    Current Mood:  <select name="post_mood">
    <?php displayMoodList(); ?>
    </select>

  19. Anonymous
    Unregistered
    Posted 10 years ago #

    I apologize for my n00bness, but where exactly do I put these in:
    post_music tinytext NOT NULL,
    post_mood smallint(6) NOT NULL default '0'
    All I'm told to do is this:
    2 new fields need to be added to your wp-post table:
    And I don't really understand where this table is...

  20. Anonymous
    Unregistered
    Posted 10 years ago #

    this is a really cool hack! but can someone teach me how to install it?

  21. Joey
    Member
    Posted 10 years ago #

    I've installed it correctly but then the mood dropdown is blank. Why is this? i did edit the web path correctly in the inc file...

  22. Joey
    Member
    Posted 10 years ago #

    um now I have another problem. I get this whenever I click publish/post
    SQL/DB Error:
    [Unknown column 'post_music' in 'field list']
    INSERT INTO wp_posts (ID, post_author, post_date, post_content, post_title, post_excerpt, post_status, comment_status, ping_status, post_password, post_name, to_ping, post_music, post_mood) VALUES ('0', '1', '2004-04-20 18:33:01', '', '', '', 'publish', 'open', 'open', '', '', '', '', '')
    Warning: Cannot modify header information - headers already sent by (output started at /home/virtual/site129/fst/var/www/html/wp/wp-includes/wp-db.php:106) in /home/virtual/site129/fst/var/www/html/wp/wp-admin/post.php on line 168
    I cant blog until this is fixed, so please be fast about this.

  23. Anonymous
    Unregistered
    Posted 10 years ago #

    yeah where is the wp-post table?

  24. Kathie
    Member
    Posted 9 years ago #

    Im not even able to open the rar file for some reason. It tells me its not a rar archive :|

  25. Kathie
    Member
    Posted 9 years ago #

    I hate bumping *bump*

  26. carthik
    Member
    Posted 9 years ago #

    I can't seem to open it either, I would suggest you email the author, or contact him through his blog.

  27. Kathie
    Member
    Posted 9 years ago #

    Okay. His site isnt working for me either. :|

  28. Kathie
    Member
    Posted 9 years ago #

    Can ANYONE send me the files for this? Please? :|

  29. Anonymous
    Unregistered
    Posted 9 years ago #

    the file's not being found on the site, that's why it's not downloading properly (try turning the .rar into .htm or .txt and you'll see what I mean)
    I'd be interested in seeing this hack too, but it can't be found at the moment :(

  30. ohdear
    Member
    Posted 9 years ago #

    I've uploaded the files - http://members.optusnet.com.au/sclub7oz/wp-mood1dot0.rar
    If anyone finds a way to show the stored mood, let me know :)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.