Podpress and WordPress 2.6 fix with revisions

Haha, two ‘work’ posts in a row!

As some of you may know, wordpress 2.6 broke podpress, the great podcasting plugin for wordpress. There were several ‘fixes’ that people found after, but basically all of them involved disabling revisions in the new version of wordpress. I then discovered this forum topic that showed how wordpress called the ‘save_post’ hook in the new revisioning system. The solution I came up with allows you to keep the revisioning system turned on, but still allow podpress to work.

Instructions (Podpress 8.8)
1) Download this file.
2) Rename to podpress_admin_class.php and copy it to your /wp-content/plugins/podpress directory, replacing the existing file.
3) Create a post and check it works

Instructions (Other versions)
The above file might work with other versions of podpress, but it might not. It would be better to edit your own podpress_admin_class.php file to ensure things work.
1) Edit /wp-content/plugins/podpress/podpress_admin_class.php
2) Replace the line function post_edit($post_id) with the following:

function post_edit($post_id) {
if(wp_is_post_revision($post_id) || wp_is_post_autosave($post_id)) {
return $post_id;
} else {

3) Scroll down to just above the function edit_category_form($input) {
4) Insert another } above it to close off the condition statement.

Things that should be noted:

  • This worked for me, and its given here that it might work for you, but I’m not responsible for any damaged caused to your website or computer through the user of this plugin.
  • While the podpress information is saved for each revision, if you restore revisions, it currently won’t restore the podpress information from that revision. That requires using the wp_restore_post_revision hook, which I haven’t got round to doing yet.
  • I use wordpress 2.6 on all of the blogs I maintain now. I love it, I love the new file uploads that were introduced in 2.5, and the post revisions from 2.6. I use wordpress on some intranet pages along with allow categries and private files to control access to sensitive information. The new revisions work great because in a world of non-techsavy users, if we need to go back and fix something that someone broke we can, or for writing online documentation, it means you get a complete version history.

    MySQL BIT in PHP

    Ok, if you subscribe to my blog for personal reasons, this isn’t very relevant to you, but for those of you here for the programming, on a recent project I had some problems getting the BIT field in MySQL to be interpreted as a boolean in PHP. There are a couple of discussions on the net about it here and here, but I couldn’t find any simply stated solutions on the net. So here’s what I ended up doing. You can also download the file here, rename the file .php to use it.


    function mysql_bit($bit) {
    return ord($bit) == 1;
    }

    Business Ideas

    So, for those of you that know me know I think, ALOT, and in the process I come up with lots of ideas. I’m also the type of person that tries to do EVERYTHING and too much. After listening to my Pastor’s (excellent) latest sermon on time, I’ve decided I need to be free of feeling like I have to do so much, and just concentrate on the most important things, if I’m really going to be successful in life.

    So here I’m listing a load of the hair-brained business ideas I’ve had. They are now all public, so anybody can feel free to do them if they really think they’re good, and feel free to give a little of the profits if they make a lot :-P

    Finance

    Control Systems For Market Making
    During by time at DB I was involved in a lot of derivatives pricing and risk analysis. One of the ideas I had related to market making. In market making systems use programming logic to determine what price / spread / volume to apply to market making a security. It might be a good idea to model these as a control/feedback system (or even fuzzy logic) as applied in engineering to come up with stable yet fast acting pricing systems.

    Fuzzy Option Pricing
    There are a few papers published about this, but basically the idea is you model an option’s behaviour using a fuzzy logic system that is intuitive to people who know how options should perform given certain conditions. It might be faster than analytical methods, but maybe less accurate.

    Fuzzy Vol Models
    Again related to option pricing. While you might still calculate the price of an option using conventional methods, it might be a good way to construct a vol service using a fuzzy logic system. This would allow the construction of a smooth service, with no discontinuities using logic steps rather than adjusting parameters for skew / long vol / etc.

    China

    Snowboarding
    There must be snow in China, and its cheap to construct and employee in China. Would stand to reason that opening a ski resort for snowboarding and skiing might be really good way to attract tourists and make money, especially since within Asia, Korea and Japan are the main places and are both pretty expensive.

    Tailored Jeans
    There are places in Europe / America that will do tailored jeans for you, any style, custom fit, warn, new, etc. Thought Hong Kong / China would be a great place to do this too, due to the cheap labour and easy custom production that is available in China. Similar to the way HK is a prime destination for tailored suits and shirts at great prices.

    TV Aggregator
    There’s rise of having a ridiculous number of TV channels in Asia these days. In the US there are sites like Titan TV and Tv Tv in Europe which aggregate TV schedules from all the different networks so you can find out in one place what’s on. They also offer services so that DVRs like Elegato can query and programmatically record all of your favourite series like a Tivo.

    iPhone HK

    As most of you know, I’ve wanted an iPhone since forever, but I’m waiting for it to be released “officially” for various reasons; the sdk, upgrades, and 3G.

    Hong Kong is one of those places that you can quite easily get them unlocked, but even I was suprised are seeing a listed company giving them out as a promotional campaign:

    iPhone CCB

    Private Files

    Ok, latest wordpress plugin. I’m getting quite into these. The other two were modifications. This one is completely from scratch. There are several plugins to make a blog private, making it a good tool for basic collaboration / group ware. However file attachments / images have still been visible too the public, until now.

    Private files acts as a proxy, making sure users are logged in before they can download any files. The nice thing about is, it doesn’t modify the current uploads at all, doesn’t store files in a different place, so if you want to stop using it, all links to files stay the same, so you don’t need to redo anything.

    Download it here: http://wordpress.org/extend/plugins/private-files/

    If you have deactivated the plugin or deleted it and you want to unprotect your files manually, just delete the .htaccess file within your wp-content/uploads directory.

    As with most wordpress plugins, the security is not guaranteed, use at your own risk.

    Change Log:
    0.40
    Added MS Office 2007 mime types
    0.39
    Enhancements to block URLs with /../ in them
    0.38
    Bugfix which prevented logged in subscriber users from accessing files.
    0.37
    Now accounts for spaces in file names
    0.36
    Shows a warning if you are not using WordPress permalinks
    Should work on a wider variety of WordPress setups (subdirectories etc.), but uploads must be a subdirectory of your WordPress directory.
    Should work with relative and absolute upload paths
    Tested on the latest version of wordpress
    0.35
    Now uses raw file() read instead of echo, which should clear up issues on some setups.
    0.34
    Bug fix so this actually works under various wordpress conditions, eg. root and not root installations of wordpress
    Tested with wordpress 2.5.1

    Allow Categories

    Ok, latest wordpress plugin modification. This time its of L. Fargue’s Restrict categories plugin.

    • Users are assigned permissions to view posts in certain categories
    • If users don’t have permission to certain posts, those posts aren’t shown, including in the main view and archives.
    • Categories can be made public to everyone, and there is an option to force users to login.
    • This is an initial version, so please report any errors or bugs.

    Installation:
    1) Download the plugin: http://wordpress.org/extend/plugins/allow-categories/
    2) Unzip it
    3) Copy to your wp-content/plugins directory
    4) Activate within wordpress admin
    5) Goto Managed->Allow Categories to edit permissions

    Change Log:
    0.6.4
    Removed debug statement
    0.6.3
    Fix for recent posts
    0.6.2
    Remove debug statement
    0.6.1
    Added allow_list_categories($args) function that can be used in templates to replace wp_list_categories($args) functions. This is a work around until wordpress provide a proper hook for filter a list of categories, so its not perfect. It may work in place of some wp_list_cats() and list_cats() too.
    0.6.0
    Fix for (Public) posts and redirect to login
    Admin users no longer show up in list for version 2.5+
    0.5.9
    Option to redirect to login if viewing a post or category that is not public and the user is not already logged in
    0.5.8
    Small bug fix to comment logic in 0.5.6
    0.5.7
    Allows editing of draft posts by non-admin owner of the draft.
    0.5.6
    Shows comment content for RSS for public posts or for RSS readers that
    know that share login information with the browser (eg. Opera).
    0.5.5
    Bug fix that would show posts to users who had no categories listed.

    Disclaimer:
    This plugin is experimental and is provided with no support or warranty. It should not be considered as providing complete security to wordpress content.

    Alter Ego

    Hey, This is just a quick not to ask you to add my friends app Alter Ego http://apps.facebook.com/profile/ Its an app similar to your profile, but your friends edit it not you. Please spread the news and add edit as many other people as you can.

    If any of you know Janakan, this is one of the steps leading to his website. It allows testing of some of the systems that will eventually make up the whole website. His company / website will eventually have a huge charitable element, so by adding the app, editing your friends profile, sending invites to others and spreading the news you’re helping make that a reality.