Digg Integrator Plugin Fix

The Digg Integrator plugin v1.1 for WordPress hasn’t been working correctly. The author, WildBil, has been working on a fix for the last week or so. I got tired of waiting for a fix lastnight and took it upon myself to create one.

In addition to the referring Digg URL not being detected, I think there’s also a problem when submitting a site to Digg that has a “Preferred Digg Topic” set. The preferred topic is never sent along to Digg because the variable containing the preferred topic isn’t being called correctly in diggIntegrator.php.

All of the fixes I mention here are to be made within the wjt_diggThisPost function inside diggIntegrator.php. That function starts on line 225.

Now, moving on. The problem with the referring digg URL not being captured is extremely simple, I think. The function that captures the referring digg URL is simply not being called correctly. Basically, it’s not being run when it needs to. Look at line 278 in diggIntegrator.php:

wjt_diDetect; // looks for incoming links from digg and helps this function continue appropriately

See, it’s calling the wjt_diDetect function, partially. I modified that line to look like this:

wjt_diDetect(); // looks for incoming links from digg and helps this function continue appropriately

Notice the added parentheses at the end of the wjt_diDetect function? Simply adding those parentheses will cause the referring Digg URL to be detected and inserted as meta data for the given post. Just as should happen.

Now for the preferred topic not being sent to Digg. This is a very simple fix as well. Take a look at line 298 in diggIntegrator.php:

'&topic='.diggTopic. //collect the topic (doesn't need encoding)

See the .diggTopic. part? Well, “diggTopic” isn’t a variable in diggIntegrator.php, obviously. However “$diggTopic” is. To get the plugin to send the preferred topic to Digg when digging a new URL, change line 298 to look like this:

'&topic='.$diggTopic. //collect the topic (doesn't need encoding)

Notice all that’s added is the dollar sign ($) to the front of “diggTopic”. Pretty simple.

If you’d like to download a fixed copy of diggIntegrator.php, you can get it from right here. I have only made the changes listed above to that script. I’m sure WildBil will release a more all-inclusive fix as there may be a few things I missed here. All I know is once I made the changes above, the incoming Digg URL was successfully detected and inserted. I tested on multiple URL’s of mine.

Let me know if this works for you guys or not.

UPDATE: WildBil posted version 1.2 of the Digg Integrator plugin. Instead of downloading that fixed diggIntegrator.php above, just head over to his site to get the newest version. Version 1.2 includes the fixes I mentioned here and a new feature that includes a sample of the button generated by wjt_diggThisPost. Go get it.