Sailing the seas of online marketing and plundering the riches as an affiliate pirate.

Thursday, February 24, 2011

Remove Wordpress Admin Top Bar in 3.1

The popular blogging platform Wordpress was recently updated to version 3.1. One of the new features is the "admin bar" that is shown to logged in users and allows them quick access to posting new content and administrating their blog. While that certainly can be useful, some people (including myself) don't find much use for it, or just want to see the site in the same way as regular visitors see it. Or maybe they just hate these "tool bars" with a passion :)

Disabling it is easy enough, if you know where the option is hidden. It's actually changed on per-user basis, so you have to go to Users in your dashboard, and manually uncheck the option for every user that doesn't want the admin bar (simple enough if you're the only one):

But what if you want to disable it for hundreds of users at the same time, or maybe remove it for specific parameters (like adding ?bar=none" to your blog URL)? Not to worry, has posted detailed instructions on more complex modifications of the behaviour of Wordpress 3.1 admin bar:

Tuesday, February 15, 2011

Invalid Account Nickname / Password at ClickBank

I am unable to login to my Clickbank account right now. It gives me the following error message:
Invalid Account Nickname And/Or Password, Please Try Again.

Things like that really scare me, I mean, who wouldn't freak out if they lost all their CB affiliate commissions?  But in this case, it seems Clickbank is having some technical issues. So if you get the same message while trying to login to your Clickbank account, don't panic or start request your password - simply try later.

Update: Clickbank gives a proper maintenance message when trying to login now:
Scheduled Maintenance

Sorry, we're performing some scheduled maintenance.
HopLinks and Orders are NOT affected by this maintenance and are functioning properly.

The entire ClickBank site is temporarily unavailable.

We're sorry for any inconvenience. Please check back soon.

Wednesday, February 9, 2011

How to Disable HTML Links in Wordpress Comments

One of the most annoying things that a blogger (Wordpress or otherwise) has to deal with is comment spam. Both spam bots and human spammers leave comments with links to various sites in hopes to improve their Google ranking or even get some direct visitors. Take away their ability to post active links in your comments, and you've won most of the battle. Regretfully, for some reason Wordpress both turns inactive text URLs into active hyperlinks, and it allows a href HTML code in the comments by default. To fix this we'll need to implement two modifications in the Wordpress code:

1. Prevent Wordpress from turning text URL addresses into clickable links. This can be achieved easily by modifying the functions.php file of your theme using the editor in Wordpress admin area. All you have to do is add the following filter somewhere in there between the opening and closing php tags:
 remove_filter('comment_text', 'make_clickable', 9);
And if your theme doesn't have a functions.php file, you can simply create one, add the opening php tag, and paste in the filter afterwards.

2. Disable HTML links in Wordpress comments. This part is a tad harder, because you actually have to edit a Wordpress core file. That's right, believe me or not, as of 3.0.5 version of Wordpress, there's still no other way to disable certain tags in comments but to edit the kses.php core file (which gets overwritten with every update, so you have to add your hack again). Hopefully they will add a setting for this in your admin area in the future.

So, find the kses.php file in your wp-includes folder. Locate the part which says * @global array $allowedtags and comment out (e.g. add a double slash before) the tags we want to disallow in the comments (in our case we want to disable active links, so you'll want to comment out lines like 'a' and 'href'). Here's an example of how that part of a modified kses.php file looks:
     * Kses allowed HTML elements.
     * @global array $allowedtags
     * @since 1.0.0
    $allowedtags = array(
        //'a' => array(
        //    'href' => array (),
        //    'title' => array ()),
Of course, you could simply delete the lines and it would have the same effect, but commenting out is preferred in case you will want to turn them back on sometime.

As I mentioned before, this hack will disappear every time you upgrade your Wordpress, so keep a note handy somewhere so you will know what to edit.

Friday, February 4, 2011

Wordpress Strips New YouTube iframe Embed Code

I frequently use Youtube videos on my Wordpress-based gaming blog to show off new game trailers. Youtube recently introduced a new kind of embed code which uses iframe HTML element rather than object element as before. This causes some problems with Wordpress editor, since apparently it strips iframe tags from the post.

You can, of course, simply use the old code that uses the object element, but we can't be sure Youtube will keep supporting the old embed code forever. Also, the new code provides support for HTML5 videos.

There is an easy workaround to make iframe work in Wordpress post editor:

1. Use HTML mode when editing posts. Paste in the new Youtube iframe embed code and publish the post while still in HTML editing mode. Do NOT switch to Visual mode, as this will cause all iframe tags to disappear!

2. Use a Wordpress plugin that prevents it from stripping iframe elements. Frankly, I prefer using as little plugins as possible to keep the installation uncluttered and reduce CPU and RAM usage on my shared hosting account. However, if you want to keep using the Visual mode and keep Youtube iframes from disappearing, then using a plugin is a valid choice.

Which plugin to use? I know at least two that do the job:
  • IFRAME Embed For YouTube adds a quicktag to the Wordpress Post Editor - you simply post the Youtube video URL into this additional tag, and when the post is published the iframe embed code will be displayed correctly.
  • TSL iframe unfilter is a much more simple plugin that simply prevents Wordpress from stripping any iframe tags in the post editor.

Now you know how to use the new Youtube iframe embed code on Wordpress without problems. I am sure the future versions of Wordpress will fix this little inconvenience so you'll be able to embed Youtube videos without the need for any plugins or additional hassle.