Manual Wordpess Version Check

December 15, 2009 · Posted in wordpress · Comment 

When a new wordpress version is released you'll probably find out about it sooner then it will be available for automatic installation in your wordpress admin.

This is because wordpress checks for new versions twice a day,but the check is scheduled based on the time when you installed wordpress so unless you're lucky you'll have to wait for up to 12 hours before the update shows up in your wordpress admin and use it.

This gave me the idea that it would be nice if you could check manually as soon as you find out about the upgrade, so I created this plugin that just gives you a button that you click and it will check to see if there's an update available right away. If it finds on it shows you the upgrade link.

Download: WP Version Check-0.1 (95.2 KB)

To check for an update go to wordpress admin -> Tools -> Version Check

  • Twitter
  • Digg
  • Reddit
  • del.icio.us
  • Slashdot
  • StumbleUpon
  • DZone
  • NewsVine
  • Technorati
  • Simpy
  • email
  • Facebook
  • Google Bookmarks
  • Live
  • Sphinn
  • co.mments
  • SphereIt
  • Wikio
  • FSDaily
  • Mixx
  • RSS
  • Tumblr
  • Yahoo! Bookmarks

OpenID server on php 5.3

November 26, 2009 · Posted in wordpress · Comment 

You want to turn your blog into an OpenID server so you can login to sites accepting OpenID with your own OpenID url.One nice advantage of this is that if you're already logged into your blog you don't have to provide a username and password anymore.

The Problem

You install the OpenID plugin, configure it as a server, but you run php 5.3 and the server part of this plugin doesn't work with PHP 5.3.

The Solution

Download my patch ( for OpenId 3.3.2 plugin ) :OpenID Server php 5.3 patch-0.1 (907 bytes)

Copy to wp-content/plugins and run:

patch < openid-server-php.5.3.diff

For the lazy ones here's a version of the OpenID plugin that's already patched: OpenID Server php 5.3 Patched Plugin-3.3.2 - 0.1 (402.61 KB)

Just install it instead of the original plugin.

You want to turn your blog into an OpenID server so you can login to sites accepting OpenID with your own OpenID url.One nice advantage of this is that if you're already logged into your blog you don't have to provide a username and password anymore.
  • Twitter
  • Digg
  • Reddit
  • del.icio.us
  • Slashdot
  • StumbleUpon
  • DZone
  • NewsVine
  • Technorati
  • Simpy
  • email
  • Facebook
  • Google Bookmarks
  • Live
  • Sphinn
  • co.mments
  • SphereIt
  • Wikio
  • FSDaily
  • Mixx
  • RSS
  • Tumblr
  • Yahoo! Bookmarks

Follow Self Pings

October 5, 2009 · Posted in wordpress · 14 Comments 

The Problem

Wordpres creates all links to comment author's site or pingbacks/trackbacks with "nofollow external" . This includes links to your own blog. Apparently this is bad for your pagerank according to this post:Pinging Your Own Blog Posts? Good or Bad?

The Solution

On that article mentioned above, the author suggested that you can use a plugin that would make wordpress stop creating pingback links to your own blog. I didn't like that idea so here's mine: a plugin that will make wordpres NOT add "external nofollow" to the pings to your own blog.

The plugin doesn't require any configuration, just download, install , activate and forget about it.

Download

UPDATE: The plugin is now hosted in wordpress plugins directory. That means you can install it dirrectly from  your wordpress admin or go to it's page to download it: Follow Self Pings Plugin

The first version of the plugin had a small but that prevented it from working on blogs that were installed in one director and had the home page pointing to something else. This bug is fixed in version 0.2 . You should be able to  update it from the plugin admin.

  • Twitter
  • Digg
  • Reddit
  • del.icio.us
  • Slashdot
  • StumbleUpon
  • DZone
  • NewsVine
  • Technorati
  • Simpy
  • email
  • Facebook
  • Google Bookmarks
  • Live
  • Sphinn
  • co.mments
  • SphereIt
  • Wikio
  • FSDaily
  • Mixx
  • RSS
  • Tumblr
  • Yahoo! Bookmarks

Faster wordpress page admin

September 24, 2009 · Posted in wordpress · 4 Comments 

In a recent post about wordpress I explained how you can create a lot of pages really fast.  If that went well and you inserted a few thousand pages in your wordpress blog  the page admin became useless. Displaying the list of pages would take 3 minutes for 7000 pages on my test server.

It seems this is not a new problem and there is a bug created in 2007 about it. Although it seems like there was a patch to fix this, the problem still exists in the 2.8.4 version.

Why is this so slow ?

Short story: because wordpress is trying to display and sort pages hierarchically .

At first I thought the problem was caused by the sql queries that fetched all the pages ( even though it doesn't display all of them on a page ) but that was not the case.

After profiling the code with xdebug and Kcachegrind I found there were a few parts of the code that were taking the longest time to complete.

The main problem is that wordpress is trying to find the children for all the pages in an inefficient way. There is this function get_page_children in wp-includes/post.php  which was taking about 2 thirds of the total time to complete ( ~ 2 minutes on my example  ).

The Solution

I rewrote that function to make it a lot more efficient. In my case it reduced the time from 2 minute to 1-2 seconds but on other page hierarchy it might take more, the worst case being when every page is the parent of another page.  The diff is here : Fast page_get_children-0.1 (1.05 KB)

The second problem is that wordpress updates the page cache every time you list pages. This was taking almost 1 minute to complete. I'm not sure if it's the right thing to just remove that call to update_page_cache in wp-includes/post.php get_pages , but doing that made the page admin load in about 15 seconds.

Now this might still be annoying but it's way better then 3 minutes. Hopefully at least the new get_page_children function will b included in the next wordpress release... maybe you can help promote this ticket by giving it a positive vote although I'm not sure if those votes actually have any influence.

  • Twitter
  • Digg
  • Reddit
  • del.icio.us
  • Slashdot
  • StumbleUpon
  • DZone
  • NewsVine
  • Technorati
  • Simpy
  • email
  • Facebook
  • Google Bookmarks
  • Live
  • Sphinn
  • co.mments
  • SphereIt
  • Wikio
  • FSDaily
  • Mixx
  • RSS
  • Tumblr
  • Yahoo! Bookmarks

Fast page insert in wordpress

September 20, 2009 · Posted in wordpress · Comment 

You want to create a lot of pages in wordpress using a script to populate a blog with content you might have. To make sure your script will be compatible with future versions of wordpress you want to use wp_insert_post

The Problem

The more pages you add the slower your script will be. With about 700 pages my script took 12 seconds to add a new page.
After digging through the code I found out that wp_insert_code calls $wp_rewrite->flush_rules() every time a new post or page is inserted and that this is what takes the most time to finish.
Now it makes sense, the more pages you have the more rules ( permalinks ) you have and more time it will take to finish that function call.

The Solution

The call to $wp_rewrite->flush_rules() can be disabled by defining WP_IMPORTING. Now inserting a post takes just a second or less. But you still have to call $wp_rewrite->flush_rules() after you're done inserting all posts. This call will take quite a lot depending on the total number of posts/pages you have but it's a lot better to call it only once then a few hundreds or thousand times.

The way wordpress updates it's rules needs to change. Even if we can solve the bulk import problem by calling flush_rules at the end , we end up with a blog with thousands of pages where trying to publish a new post manually might take 30 or more seconds.

  • Twitter
  • Digg
  • Reddit
  • del.icio.us
  • Slashdot
  • StumbleUpon
  • DZone
  • NewsVine
  • Technorati
  • Simpy
  • email
  • Facebook
  • Google Bookmarks
  • Live
  • Sphinn
  • co.mments
  • SphereIt
  • Wikio
  • FSDaily
  • Mixx
  • RSS
  • Tumblr
  • Yahoo! Bookmarks

MYC4 bid Importer plugin

June 8, 2009 · Posted in wordpress · 7 Comments 

MYC4 is a micro credit platform that enables anyone to invest in small businesses and entrepreneurs in poor countries in Africa. MYC4 enables you to help poor people in Africa ( people that can't get a loan from banks ) get a loan to improve their business.

This wordpress plugin will fetch the details of the businesses in which you invest and create posts on your blog from those details.

By using this plugin you can create exposure for those businesses, enabling them to raise the funds they need more quickly and thus to ensure a shorter way to success.

The plugin was developed after an idea by prof. David Costa of Robert Kennedy College. He runs a blog about microfinance and teaches microfinance as part of the investment management course at Robert Kennedy College.

Download the plugin

  • Twitter
  • Digg
  • Reddit
  • del.icio.us
  • Slashdot
  • StumbleUpon
  • DZone
  • NewsVine
  • Technorati
  • Simpy
  • email
  • Facebook
  • Google Bookmarks
  • Live
  • Sphinn
  • co.mments
  • SphereIt
  • Wikio
  • FSDaily
  • Mixx
  • RSS
  • Tumblr
  • Yahoo! Bookmarks

WP-Twitter-ID Social Profiles Integration

December 22, 2008 · Posted in wordpress · 2 Comments 

A few days ago I wrote a post about a wordpress plugin that will add a twitter id field to the comments form and I was reporint two problems with it. One was solved in that post and for the second one I'm going to show you a solution in this post.

The Problem

The second problem was that the twitter id field was show assigned to a comment when a registered user was commenting.

Basically I needed a way to specify the twitter id of a registered user in the profile and then just make the WP-twitip-id plugin use that value form the profile. I could have done this by implementing the necessary code to show the field on the profile page and save it's value when the profile was saved but I was lazy and I wanted a quicker solution.

The Quick Solution

The quick solution was to install the Social Profiles plugin, set my twitter id in my profile and then do a simple modification to wp-twitip-id.

To make the modification just open wp-twitip-id.php in any editor, look for "function addtwitterfieldmeta($comment_data){" and right after that line insert the following code:

if(!empty($_POST['atf_twitter_id'])){
	$twitter=$_POST['atf_twitter_id'];
}else{
	$current_user = wp_get_current_user();
	$user_id = $current_user->ID;
	$twitter=get_usermeta($user_id,'cyc2_twitter');
}

That's it. Simple don't you think ? Now next time you post a comment as a registered user you should see your twitter id in the comment header.

Download

Here's the zip file with all modifications including the one in the previous post.

WP-Twitip-ID-0.9.2 (13.3 KB)
  • Twitter
  • Digg
  • Reddit
  • del.icio.us
  • Slashdot
  • StumbleUpon
  • DZone
  • NewsVine
  • Technorati
  • Simpy
  • email
  • Facebook
  • Google Bookmarks
  • Live
  • Sphinn
  • co.mments
  • SphereIt
  • Wikio
  • FSDaily
  • Mixx
  • RSS
  • Tumblr
  • Yahoo! Bookmarks

Twitter id comment field

December 15, 2008 · Posted in wordpress · 3 Comments 

I saw this post on problogger about how Darren implemented a new field in the comment form for his new blog about twitter tips powered by wordpress. Basically he used a plugin for adding and extra field to the comment form and then modified the comment template to show the link to the twitter profile page.

There are two problems with this approach. #1 Unlike the author name, email and web site, the twitter id field is not saved in a cookie so your comentators will have to fill it in every time they post a comment, this migh be annoying for some of them. the second problem is that if you're logged in and want to reply to a comment there's no way you can set the twitter id.

The first problem was almost solved by a new plugin named wp-twitip-id by Andy Baily specially created for setting up the twitter id field. I said almost solved because this plugin uses javascript to add the new field and in some cases ( depending on the template you are using ) javascript would not be the best way to do this.

Luckily you can use this plugin without javascript and add the new field manually by modifying the comments.php template file but then the cookie would not work anymore so it needs some modification to set the cookie from the php script instead of javascript .

Simply calling setcookie before the comment is saved will do the work, then when you display the form field just use $_COOKIE['atf_cookie'] to set the value of the twitter field.

If you like to modify some plugin code get the wp-twitip-id plugin, open wp-twitip-id.php look for addtwitterfieldmeta function and add

setcookie('atf_cookie',$twitter,time()+60*60*24*60);

right after the line with this code: 'if($twitter){'

Then go into wp-content/themes/<yout_theme>/ edit comments.php  look for the URL field and add a new field after it like this:

<input name="atf_twitter_id" type="text" value="<?php echo $_COOKIE['atf_cookie']?>" />

You might have to add some other html code and css to make the field look like the others but that depends on the theme you are using.

For convenience I have attached the modified plugin but you still have to modify the comments.php file in your theme.
wp-twitip-id-091

Let me know how this works for you. Do you think the twitter id comment field is worth the effort ? Does it bring value to you it as a commentator?

  • Twitter
  • Digg
  • Reddit
  • del.icio.us
  • Slashdot
  • StumbleUpon
  • DZone
  • NewsVine
  • Technorati
  • Simpy
  • email
  • Facebook
  • Google Bookmarks
  • Live
  • Sphinn
  • co.mments
  • SphereIt
  • Wikio
  • FSDaily
  • Mixx
  • RSS
  • Tumblr
  • Yahoo! Bookmarks

wordpress 2.5.1

April 26, 2008 · Posted in wordpress · Comment 

I have just upgraded to wordpress 2.5.1. My upgrade routine worked well without any problem.

The new release seems to bring a few bug fixes to  some annoying issues and a security fix as well as some performance enhancements.

Unfortunately the automatic plugin updater still fails at times and doesn't save the ftp password and the media uploader still renames .tar.gz files in a stupid way.

  • Twitter
  • Digg
  • Reddit
  • del.icio.us
  • Slashdot
  • StumbleUpon
  • DZone
  • NewsVine
  • Technorati
  • Simpy
  • email
  • Facebook
  • Google Bookmarks
  • Live
  • Sphinn
  • co.mments
  • SphereIt
  • Wikio
  • FSDaily
  • Mixx
  • RSS
  • Tumblr
  • Yahoo! Bookmarks

Upgraded wordpress to 2.5

April 3, 2008 · Posted in wordpress · 1 Comment 

I have finally upgraded wordpress to 2.5.

The old version was 2.3.1 ( yeah that old ) and the upgrade was pretty smooth.  I didn't use plugins like instant upgrade for this upgrade but I'm thinking of using for the next upgrades.

How did I do it?

I have my own method for this. It's very similar to what they descibe in the official upgrade docs but a bit modified.

Here are the 7 steps I followed:

  1. backup the database using the backup plugin
  2. remember ( write a list of) active plugins then deactivate all ( so if any plugin will not work in the new version you can still access the blog and the admin interface )
  3. make a backup of all files ( assuming current install is in public_html ):
    cp -rp public_html  wp-2.3.1_backup
  4. download and extract the new version ( it will create a wordpress folder so make sure you don't already have one cause it will overwrite the files in it ) :
    wget http://wordpress.org/latest.tar.gz
    tar -xzpf wordpress-2.5.tar.gz
  5. use rsync to copy the new files over the old files ( note the exclusion of wp-content to preserve the modifications you might have done to themes and plugins ) :
    sync -avz --exclude=wp-content wordpress/ public_html/
  6. call the upgrade.php script, go to : http://your_own_blog.tld/upgrade.php
  7. reactivate the plugins you had active before the upgrade

The whole thing took about 10 minutes and there were no problems encountered except for a few plugins that could not be reactivated because they were incompatible with the new version.

What I like about it?

I like the new interface,it seems friendlier, faster, more slick and  I was getting  bored of the old one.

I don't care much about the dashboard, but I love the way the WYSIWYG editor works.

I think the feature that I love the most is the automatic plugin upgrade but this is also the one that I think it needs more work ( of course there may be others that I did not notice yet )

what id didn't like?

Here are three problems I found with the automatic plugin upgrade:

  1. the first time I tired it id didn't seem to care that I selected "No" for the "Use SSL" option and it just told me it could not connect.
    This was because my ftp server did not have ssl enabled but it was impossible to know this was the cause because it was clear to me from the web interface that it was not using SSL until I went in the code and just run a print_r on the $credentials variable .
    I'm not sure why this happened, I guess a bug. I had to go into the database and manually edit the ftp_credentials option and set ssl to 0 and then the plugin upgrade worked.
  2. It doesn't remember the value of the "Use SSL" option. After I go in to upgrade another plugin the option is set to "yes" even thou in the database it is 0.
  3. it removes the old plugin first and then tries to install the other. If the new version install doesn't work for some reason you are left with no plugin and you will have to go in and install manually the old way. I think a bettwe approach would be to first deactivate the old plugin, make a backup copy, try to install the new one and if it doesn't work restore the old plugin.

Conclusions

Overall wp 2.5 brings good improvements and great new features but as with any new major version increase there are a few minor details not taken good care of. Waiting to see what the 2.5.1 version wil bring on he bug fixing side.

Have you upgraded yet?  what are your thoughts on the 2.5 version ?

  • Twitter
  • Digg
  • Reddit
  • del.icio.us
  • Slashdot
  • StumbleUpon
  • DZone
  • NewsVine
  • Technorati
  • Simpy
  • email
  • Facebook
  • Google Bookmarks
  • Live
  • Sphinn
  • co.mments
  • SphereIt
  • Wikio
  • FSDaily
  • Mixx
  • RSS
  • Tumblr
  • Yahoo! Bookmarks

Next Page »