Archive for April, 2011

New WordPress security release is out: 3.1.2

Wordpress 3.1.2 security release

WordPress 3.1.2 is now available and it’s a security release for all previous WordPress versions.

According to wordpress.org, this release “addresses a vulnerability that allowed Contributor level users to improperly publish posts”.

The WordPress team suggests you update to 3.1.2 promptly, “especially if you allow users to register as contributors or if you have untrusted users. This release also fixes a few bugs that missed the boat for version 3.1.1.”

Download WordPress 3.1.2 or update automatically from the Dashboard > Updates menu in your site’s admin area.

(Image: Creative Commons)

How to open the comments author link in a new window

Posted on: 1 Comment

On most wordpress stock themes, you will find that when the user clicks on the comment author link. It opens directly in the same page, taking the user away from the site.

Ideally when the user clicks, it should open the commenters site in a new window. After all, they are being directed to a new website.

Amazingly it seems most suggestions you will find on Google for this is to modify the wp includes core files. This is never ideal and the better approach is to use WordPress’s filters instead. After all, this is exactly what they are for!

What we are going to do is add a new function that includes the link structure how we want it, using the original structure as a base, then run a filter on the “get_comment_author_link” to change it with our new function.

So open up your themes functions.php file and somewhere at the bottom, add the following. I have added comments on each section of the function so you can easily understand whats happening.


function comment_author_add_blank() {
	global $comment;
	//get url
	$url    = get_comment_author_url();
	//get author
	$author = get_comment_author();
	// check if user added a url or not
    // if no url, return author
	if ( empty( $url ) || 'http://' == $url )
		$return = $author;
	// if has url, return url with new format and _blank
	else
		$return = "<a href='$url' rel='external nofollow' target='_blank'>$author</a>";
	return $return;
}
// now run the filter on our new function
add_filter('get_comment_author_link', 'comment_author_add_blank');

Thats all folks!

WordPress 3.1.1 is out – upgrading is easy

Knowing when a new version of WordPress has been released is easy thanks to the automatic update notifications in your WordPress admin. The simple upgrading process really leaves you with no excuse to run your site on an old version – just a click or two and you’re done (after backing up, of course).

(more…)