New here? Read Greetings Earthling!

Joost De Valk (aka Yoast.com) - Authority In Wordpress Plugins?

I really noticed this guy when I read a comment on a blog talking about a subject I covered a long time ago and will cover again: X-Robots-Tag! The comment really caught my eyes as Joost was calling the poor guy a stupid fuck.

In my opinion, you can be my homie, but if you call me a stupid fuck or disrespect me, I'm a bitchslap your sorry ass (hood-style :)). Some respect has to exist.

And it kind of stuck in my mind. I choose my words wisely everytime I open my mouth.

I checked out his plugins

These days, as I'm writing Wordpress plugins like possessed, I peeped at his wordpress plugins. Noticed this one doing something one of mine does (SEO friendly ditching query strings that are not meant to exist) and was curious of his approach. This below is his source code and we'll carry on afterwards.

<?php /* Copyright 2008 Joost de Valk */ function clean_permalink() { if ($_GET || $_SERVER['QUERY_STRING'] != "" || substr($_SERVER['REQUEST_URI'],-1) == "?") { if (!is_search() && !is_preview()) { if (is_single() || is_page()) { $url = get_permalink($post->ID); } else if (is_category()) { $url = get_category_link($cat); } else if (is_tag()) { $url = get_tag_link($tag_id); } else { $url = get_bloginfo('url'); } wp_redirect($url,301); } } } add_action('get_header','clean_permalink',0); ?>

I've pasted the code here to stay into eternity and in case he takes my advice and fixes the shit. The license info (GPL) was stripped but you will find it in the original download. And now, after you seen the previous code ... find the nearest wall and bang your head against it. Read the code again and bang some more. Then come back and read.

Try it on yourself!

Download the plugin and try it on. See it will not work and not only it won't work, but it'll generate ugly errors.

If we look at it we notice 3 variables: $post->ID, $cat, $tag_id. These variables are used to generate permalinks for posts, categories, tags. But those variables have no globals defined hence are unreachable in the current functions scope?!?! WTF? How can one publish plugins without testing them ... at all.

To make this plugin actually work one has to do this: global $post, $cat, $tag_id.

My version of this plugin

I like to keep things simple and my plugin works a bit differently but also applies to archives with query strings where his plugin fails.

Zone unavailable to unregistered users.
Registration is quick, painless and worth its weight in gold.

The lesson for today!

Let's learn a few things from this:

  1. Nobody is a super guru
  2. Never bet your life on someone else's code
  3. Know the minimum to fix others' fk ups
  4. Try not to fkup publicly ... anyways ... not in an obvious manner (errors vs. bugs)
  5. 5ubliminal PWNS

... and ... last but not least ... think twice before calling this polite and kind individual a wordpress authority grease monkey as most of his amateur fans call him. Real coders test and fix code. But most important, they don't publish broken code.

5ubliminal Rant,
Over and out!

... cough ... off to check my own stuff for errors :)

Category: Rants, Wordpress Plugins

11 Responses

  1. I hope your day is a bit better now :) For the record, on the comment to Patrick Altoft: I know him personally, and consider him a friend, don’t judge on the language people use towards other people if you don’t know their relationship.

    Permalink redirect is one of my oldest (and absolutely worst) plugins out there, and you’re quite right in your comments about the code, I’ll have a look. If you call me names, fine, if you call my so called “fans” names, not so fine. You’ve just crossed the line of drawing people in who don’t have anything to do with you or me, so I’d refrain from doing that.

    • $@5ubliminal34:361 — #1 says:

      About your plugin, old or new … I really hope you don’t use it :)

      PS: Calling people ’stupid fucks’ … let’s just say … diminishes their authority (with readers …). It’s offensive even if you’re brothers.

  2. Well let’s not get into a discussion about how I should call my buddies :) as for the plugin: A it’s fixed, and B no I don’t use it (anymore), funny thing is I used to use it, and it worked, so I’ve changed something at some point, pretty stupid :)

  3. Just thinking out loud here, but maybe the plugin was written when it was common to have registerglobals set?

    TTFN

    BFG

    • $@5ubliminal35:361 — #1 says:

      Register Globals exposes GETs, POSTs, COOKIEs as global variables.
      It has nothing to do with variable scope: global, function, class.

  4. … & next time I’ll read the post properly before jumping in with an answer….
    I’ll disappear back into my hole now & keep my mouth shut!

    TTFN

    BFG

    • $@5ubliminal36:361 — #1 says:

      Don’t take it like that. I sound a bit harsh but I’m a nice guy … deep inside ;)

      PS: I appreciate any comment, whether wrong or right.

  5. Ar trebui sa ascultzi cel putzin de el cand recomanda ca post-urile sindicate pe RSS sa fie in FULL :D.

    Glumesc, nu ma doare sa dau click, shi sunt interesant in contributziile tale.

    • $@5ubliminal37:361 — #1 says:

      Nu sunt adeptul full-post in RSS.
      Pe site pot sa mai expun vizitatorul si la alte kestii gen … reclame ;) In RSS nu.
      De asemenea post-urile sunt mult prea usor de copiat.

      Orice blog care urmareste (mai devreme sau mai tarziu) si un potential castig trebuie sa aduca vizitatorul pe site.

  6. +Chris1:1 — #94 says:

    http://www.trekkers.se/foto/31_087fight.jpg

    let the battle of the nerds begin….lol