PHP 4, WordPress 2.5 and BBPress 0.9

I just found a bug in WordPress 2.5, which is exposed when it is run in PHP 4.3.11. I thought of detailing about it here so that it will be useful for others who are seeking solution for the similar problem.

Recently I was trying to integrate WordPress and BBPress to make them share a single database and cookie. The advantage of this integration is that a logged in user can share the session between WordPress and BBPress.

Right now the latest version of BBPress is 0.9 and it can be integrated only with WordPress 2.5. Only BBPress 1.0 (which is in alpha) can be integrated with WordPress 2.7. There is an excellent tutorial by _ck_ which explains the reasons behind this and it also has a step by step guide to integrate them.

I tested this integration in my test server running PHP 5 and was able to do it within minutes. But when I tried to do it in another server running PHP 4.3.11, it was not working. After lot of head banging and hair picking, I found out that there is a bug in WordPress 2.5, which does not allow you to share the cookie with BBPress 0.9 under PHP 4.

The following is the technical detail about the bug. If you are not technically inclined, you can safely skip it. You only need to remember that you cannot integrate WordPress 2.5 and BBPress 0.9 in PHP 4, you have to use WordPress 2.5.1

Well for the brave hearts here is the explanation. 🙂

In both WordPress and BBPress, the function wp_hash() is used to generate the hash, which is required to encrypt the cookie.

In WordPress 2.5, the function wp_hash() is defined in wp-includes/pluggable.php file as

function wp_hash($data) {
    $salt = wp_salt();

    if ( function_exists('hash_hmac') ) {
        return hash_hmac('md5', $data, $salt);
    } else {
        return md5($data . $salt);
    }
}

It checks whether the function hash_hmac()is present. If not it generates the hash using the function md5(). The problem is that hash_hmac() is present only in PHP 5 and WordPress includes a copy of hash_hmac() function in the wp-includes/compat.php file for backward compatibility.

But in BBPress, wp_hash() function is defined in bb-includes/pluggable.php as

function wp_hash($data) {
    $salt = wp_salt();

    return hash_hmac('md5', $data, $salt);
}

This bug is present in WordPress 2.5 and will only affect servers running PHP 4. So if you are running PHP 4 and want to integrate WordPress and BBPress, then you have to use WordPress 2.5.1 and not 2.5.

Hope this explanation saves some hair for someone somewhere, doing something similar. 🙂

Posted in WordPress | Tagged , , , | 1 Comment

Webbynode – A new VPS hosting service in beta

Webbynode is a new Xen based VPS hosting service, which targets developers who want to have control over every aspect of their server. This means you can have a single server where you can run your Ruby on Rails application in parallel with a Django application.

The service is currently in beta and you can register your email address in their registration page to get an invite. The advantage of testing the service during the beta period is that you can use the service free right now and once the service is out of beta, you will get discount over the regular price and if you are lucky you can even get lifetime memberships. 🙂

I am still waiting for an invite and once I get to try this service, I will write a detailed review comparing its feature with slicehost, which is my current hosting service.

More details about Webbynode can be found below.

Posted in Random/Personal | Tagged , | 6 Comments

Celebrating Failures – FailCamp

The guys behind BarCamp Chennai, are putting together another event titled FailCamp.  If you are wondering what a FailCamp is, here is the quote from the official wiki.

FailCamp

We all make mistakes and learn from it to become a better person. Won’t it be great to learn from other’s mistakes so that we don’t make the same ones!

The focus is really not about the failure. It’s about why we failed and what lessons we learnt from it. Let’s not be ashamed about failing. Let’s celebrate failure. Let’s look straight into its eyes.

If it sounds interesting, head over to FailCamp wiki and register yourself. Here are the details about the event.

Date

November 16 2008 – Sunday

Place

Tenth Planet Technologies Pvt., Ltd.,

#807, P.T.Lee Building, 6th Floor, Anna Salai, (Opposite LIC building)

Chennai-600 002

Driving directions and parking information are available in the wiki. You can also find some pictures of the venue here.

Unconference

Failcamp is also an unconference like BarCamp and everyone will be participating rather than just attending. Even you can help in organizing the event. In the wiki, you can find the list of items that needs to be done and you can pick any one of them that interest you.

I will be attending the event and if possible will talk about the lessons which I learned from one of my pet project King Ping. 

Let me know if you are coming and we can meet up and celebrate failures.

Posted in Events/Conferences | Tagged , , , | Leave a comment

Links to BarCamp Chennai 2 presentations

Someone in the BarCamp Chennai group asked for links to photos and presentations, since he was not able to attend. I composed the links and sent an email to the group. I thought of posting it here, so that even people who are not subscribed to that group can benefit.

Photos

Photos tagged bcc2 in Flickr

Videos

Awesome video to explain what is Web 2.0

Presentations/Demos

AWS by Varun Balaji

Design of Programmer Spaces by Siddharta

OpenStreetMap

Twitter tweets

http://search.twitter.com/search?q=bcc2+OR+”barcamp+chennai”

Blogs

Barcamp Chennai 2 – Interesting By Aswin

BarCamp Chennai 2 By me

If I have missed any links, let me know and I will add them.

Posted in Events/Conferences | Tagged , | 2 Comments

BarCamp Chennai 2

As planned, I attended the second edition of BarCamp Chennai and it was very good. I missed the fun on the first day but made up for it on the second day. We had some very nice sessions and above all I really enjoyed the discussions which we had during the sessions.

Dream Moment

I experienced a dream-come-true moment when I shook hands with Kiruba. I have been following him in the cyber space for nearly 2-3 years, but it was only now, I got a chance to talk to him in the physical world. 

Sessions

There were lot of talks which took place on day two. Almost all of them were very interesting and lively.  I will try to brief on some of them which I attended and found interesting.

First was the session titled “Indian Education System Sucks” by Viru. The session was very interactive, partly because of the title and partly because of how Viru handled it. There were lot of points which were discussed and towards the end almost everyone agreed that there are some major flaws in the system. Once the problem was identified and accepted the discussion shifted towards finding out the possible solutions to make it better.

Next was the session titled “Global Financial Meltdown and IT Industry” by Sukumar, Ganesh, Raj and Syed. Out of all the other sessions this was very informative and I personally learned a lot out of it.  Sukumar gave an insight about the core reasons behind the meltdown and how it might affect India. The following are some of the quotes which I noted during that talk.

 

The world nearly came to an end in 2008

 

 

If you borrow 5 lakhs, you will be afraid of the bank, but if you borrow 500 cores, the bank will be afraid of you.

 

 

There is one more time bomb which is waiting. US has around 1.6 trillion dollars in credit card balance.

 

 

The western press is misleading. They talk only about ideology and not about common man.

 

Aswin anand has a nice write-up about the other sessions, so I am not going to repeat them here. Thanks Aswin, you saved a couple of key strokes for me. 🙂

Wifi

If you ask me, one thing which really sucked was wifi. It was very slow and most of the time it timed out. I was planning to do live tweeting during the event, but because of wifi and my laptop battery, I only managed a few.

Photos

I took a couple of photos during the event with my amazing Powershot S5 and you can view them in Flickr. You can also do a search in Flickr with the term bcc2 to get other photos.

Verdict

Overall, it was a very nice event, well planned and executed. Without any doubt I could say that it was a huge success. The credit goes to the organizers for taking extra effort to make the event a success. Thanks guys and eagerly waiting for BarCamp Chennai 3 🙂

Posted in Events/Conferences | Tagged , | 1 Comment

BarCamp Chennai 2nd Edition

The second edition of BarCamp Chennai will happen this weekend (Oct-17 and 18) at IIT Madras. 

BarCamp Chennai

The first edition which happened in April 2006 and was a great success and I hope it will the same this year too. It has already started to get some press coverage and you can find the article from Decaan Chronicle here, kudos to the organizing team.

I will be attending the sessions scheduled for the second day and let me know if you are coming and we can meet up.

More details about the BarCamp can you found at the official BarCamp Chennai Website.

Posted in Events/Conferences | Tagged , | 2 Comments

Two more reasons to like jQuery

Out of the numerous JavaScript libraries which are available, jQuery is my favourite. There are couple of reasons for this and now I have two more reasons added to that list. 

First jQuery is going to be supported by Microsoft and is going to be shipped with Visual Studio, which is great news for people who are addicted to intellisense (like Yuvi 😉 ). 

Second Nokia is going to support it and jQuery will be used to develop applications on the new WebKit-based Web Run-Time which will be distributed with Nokia phones.

I think this is great news for jQuery and it is time for me to start hacking it again. 😉

Posted in JavaScript/jQuery | Tagged , , | Leave a comment

Post2FF now supports scheduled posts

Yet another update to my Post2FF WordPress Plugin. Now the latest version (v0.5) supports scheduled posts too. You can download the latest version from my Plugin page.

Special thanks to Cmiper and Phill Price for reporting the bug. FriendFeed community really rocks! 🙂

Posted in Plugin Releases | Tagged , , , | 3 Comments

Updated my Post2FF WordPress Plugin

Just a quick note to let you know that I have updated my Post2FF WordPress Plugin to v0.4, which I released last week.

Now there is a new option to specify the number of images that needs to be posted to FriendFeed. Earlier, it was taking all the images, but now you can control the number of images that needs to be posted by specifying it in the options page.

post2ff WordPress Plugin Options page

post2ff WordPress Plugin Options page

You can download the new version from the Plugin page. Don’t forget to reactivate the Plugin after uploading.

As always let me know if you have any feedback/issues.

Posted in Plugin Releases | Tagged , , , | Leave a comment

WordPress to FriendFeed Plugin

Yesterday Thomas Hawk posted a message in FriendFeed saying that he is going to drop his blog from FriendFeed account and then going to manually share items, since FriendFeed posts blog posts without images.

There were lot of comments for that message and some felt that removing the blog from FriendFeed profile could result in identity loss.

I looked into FriendFeed API and found it to be very powerful and easy to use. So, using it I have created a WordPress Plugin, which will automatically post a message to your FriendFeed account with all the images in the post, every time you publish a new post in WordPress.

You can download the Plugin file from my Plugin page and then upload it to your wp-contents directory. Once activated, you have to enter your nickname and remote key in the settings page. You can get the remote key from FriendFeed API page.

Please note that currently it is only in the beta stage right now. I am planning to add more features to this Plugin, so if you have a nice feature in mind, let me know and I will try to implement it. Also let me know if you are facing any issues/bugs with the Plugin.

Posted in Plugin Releases | Tagged , , , | 1 Comment