So I got Dugg -- but I'm convinced this trivial WordPress Plugin is part of what helped me top the Digg charts for so long. All it does is examine every incoming HTTP_REFERER, and if a Digg URL (of a specific Digg) hits a blog post URL, it assumes that it's a Digg of that post. Then the plugin automatically stores that URL and inserts the Digg button code. It's not perfect, but it should mostly work automagically. Just call the function within your template somewhere. If you find any bugs, leave a comment. Here it is:
<?
/*
Plugin Name: Digg
Plugin URI: http://www.seoegghead.com/
Description: Creates an interactive Digg button.
Author: Jaimie Sirovich
Version: 1.0
Author URI: http://www.seoegghead.com/
*/
function _scrape_check_digg($digg_link, $the_permalink)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $digg_link);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$http_result = curl_exec($ch);
curl_close($ch);
$_ = preg_match('#<h3 id="title"><a href="(.*?)">#is', $http_result, $captures);
return ($captures[1] == $the_permalink);
}
function digg_this()
{
global $id;
$digg_link = get_post_meta($id, 'DIGG_CLASS_digg_link', true);
if (is_single() && !$digg_link && preg_match('#^http://(www\.)?digg\.com/.+#i', $_SERVER['HTTP_REFERER']) && !preg_match('#^http://(www\.)?digg\.com/(view|users)#i', $_SERVER['HTTP_REFERER']) && _scrape_check_digg($_SERVER['HTTP_REFERER'], get_permalink())) {
add_post_meta($id, 'DIGG_CLASS_digg_link', $_SERVER['HTTP_REFERER']);
$digg_link = $_SERVER['HTTP_REFERER'];
}
if ($digg_link) {
?><iframe src='http://digg.com/api/diggthis.php?u=<?=urlencode($digg_link)?>' height='82' width='55' frameborder='0' scrolling='no'></iframe><?
}
}
?>












September 17th, 2006 at 4:37 pm
Hello,
I don't quite understand how this works or how it helps. Could you explain it for the laymen out there? Thanks.
All the best,
Moshe
September 17th, 2006 at 5:59 pm
So if I wanted to add this to my anonymous confession website www.sosecret.com, where would I put it?
September 17th, 2006 at 6:00 pm
And what would it do for www.sosecret.com
This is lame and too easy. Go ahead and delete lol
September 17th, 2006 at 6:12 pm
Where do you put the digg URL?
September 17th, 2006 at 6:32 pm
Where do I need to put this?
September 17th, 2006 at 6:38 pm
Basically what happens is, if he gets dugg then that button appears on his page. So when people view the page they're being asked to digg it.
That's how I understand it anyway.
September 17th, 2006 at 7:01 pm
that "digg it" button drives me nuts because it doesn't render correctly in safari. yeah, yeah, 3% of the market, but digg has a big mac user following.
I'm sure it could be corrected easily, yet I never seem to hear anyone complain about it. Makes me not want to click it for some reason.
September 17th, 2006 at 7:08 pm
Hello, I thanks for the plugin. I had just integrate it into my site and wrote a guide on how to do it. You can check it out at http://www.thedarkestsociety.com/2006/09/18/simple-step-by-step-guide-to-install-digg-in-your-wordpress/
Cheers,
lXciD
September 17th, 2006 at 7:27 pm
Wow I must admit this is brilliant. It's not perfect however, but brilliant nonetheless. I'll keep on the look out for bugs.
Keep up the good work!
--Jon Z | http://jzencovich.blogspot.com/
September 17th, 2006 at 7:59 pm
Something's wrong in Safari. The bottom of the button is cropped in Safari. You can only see the top half of "digg it".
September 17th, 2006 at 8:11 pm
I get the following error when I try to activate this plugin:
--
Warning: Cannot modify header information - headers already sent by (output started at /home/northwes/public_html/blog/wp-content/plugins/Digg.php:29) in /home/northwes/public_html/blog/wp-admin/plugins.php on line 22
--
September 17th, 2006 at 8:53 pm
When it detects incoming links to your site from digg it parses the URL to see if you've been submitted to digg. It then inserts that "digg" button on your blog.
September 17th, 2006 at 9:02 pm
The DiggThis Wordpress Plugin exists for almost a year now.
Here is the Original Digg This Wordpress Plugin
September 17th, 2006 at 10:09 pm
Hey can you give a more detailed explanation on how to install this?
Thanks
Wayne
September 18th, 2006 at 4:35 am
Hi wayne,
I posted before in here that I does have a more detail explanation on how to install this on my site. I even have it installed. Check it out at my website.
http://www.thedarkestsociety.com/2006/09/18/simple-step-by-step-guide-to-install-digg-in-your-wordpress/
Cheers,
lXciD
September 18th, 2006 at 5:59 am
Nice idea in concept, but it fails in execution.
People can post urls in the digg comments section and so if someone clicks a link coming through a digg comment, your blog would assume that the page the user came from is a digg of your site - when in reality, it could be the competitors site (most likely is if someone is posting your url in the digg comments).
So in doing this, you've essentially left yourself open to advertising your competitor. Also note the predicament that occurs when two or more diggs have been submitted about an article - you'll end up with more then 2 digg items on your site, and if someone wants to be malicious they can digg your article several times using slight variations of the url - thus making it possible to 'spam' your page with these digg buttons.
One thing to fix it, is to check the url referrer and ensure that it contains "/design/" or whatever other digg categories there are, that way only if the incoming digg.com referrer has one of those category labels in its url will the digg button be added.
Very Simple solution.
September 18th, 2006 at 6:09 am
me again, I tested it out and I was right!
Check out this section:
http://www.seoegghead.com/blog/category/cloaking/
The digg will digg an item about some new tech advance in Apple, essentially I can hijack any page so that instead of digging the actual post the user ends up digging whatever post I selected. It only works if the article/page has not been dugg before, so the main thing is to digg your article first - otherwise you can easily get ppl to vote for your article.
I strongly recommend making the corrections I mentioned in the last post, and digging it immediately - it's pretty critical when you essentially create an exploit that makes the entire digg system vulnerable.
September 18th, 2006 at 6:09 am
TVFree,
You have a point -- and to be honest, they wouldn't need to do it with a comment. They could just create a malicious post in the first place. What I could do is fetch the referer and scrape out the URL it points to to verify.
I do check if the URL is a category URL. That's why I exclude view|users. Checking for the actual categories would be much more annoying and error-prone.
September 18th, 2006 at 6:54 am
yes, but if you checked if the url exists it would take up too much cpu time and would slow the load of the page. Even if you only do it once, it would be very easy to set up a script (cron job) that basically sends tons of requests to your article using fake headers, and because your script is checking the existence of each -it would slow your page load. Trust me it's never a good idea to begin parsing items, and also the way I mentioned above would result in the digg article being real. I tested it out with an article on digg currently, and it worked perfectly - the digg article existed in the first place, so even if the script checked it - it would still result positive. The problem is that a script like this can not be done properly because its very easy to exploit the system with referrers, there is no real way to do is securely.
BUT I'd recommend searching the referrer string for the digg categories, not the users label. Check out "http://www.seoegghead.com/blog/category/cloaking/", I tested it out and I was able to get the article to link to another digg article. Unfortunately for some reason, your blog seemed to change all the articles to this digg link (I didn't intend on doing this, but it's yet another thing to look into - it thereby causes every article to have the same digg link, meaning that a user spam an entire blog very easily).
The only real solution I see, is to check the incoming referrer variable to see if it contains (instr) any of the following text "/design/", "/gaming/", "/politics/", etc.. If it finds the text in the referrer, and if it finds "digg.com" in the text as well - then it records the referrer url and saves it. Otherwise it shows nothing, or displays an error. If you don't put that in, anybody can easily post links to the article and have it show up. See 'cloaking' section of your site to see it.
September 18th, 2006 at 7:16 am
I fixed most of these issues. Seriously, though, if someone kept getting digged, I'd expect they'd notice if someone maliciously set up a fake digg. And the malicious user would have to anticipate which post it is that breaks loose in the first place. This will never happen in practice.
And it would be quickly discovered when/if it did. I think you're overreacting. In any case, I fixed it. Theoretically it opens another pandora's box, but I'm OK with that one.
The issue with the categories URL is a simple oversight. I'm very green with WP, and I checked that it's not the homepage, not that it is a single-page. Since I rarely look at category pages, I overlooked it. That's fixed.
The plugin will only work for individual posts now. That makes sense anyway.
September 18th, 2006 at 8:26 am
[...] Permanent Link | Del.icio.us | Cosmos | Digg | Slashdot [...]
September 18th, 2006 at 1:50 pm
[...] This is a follow up article on “How to Get Dugg More: Digg for WordPress Plugin“. [...]
September 18th, 2006 at 4:43 pm
I used to have Digg plugin on some of the posts in my WordPress website too. Not sure if that belongs to you.
September 19th, 2006 at 7:29 am
[...] Like getting Dugg? Want to get Dugg more often? Use WordPress? Well then your in luck. Using this pretty nice plugin, you can add a Digg counter just like on the main Digg website to your blog. This counter will display how many Diggs that article has on Digg.com at that time. [...]
September 20th, 2006 at 10:27 pm
[...] 8. Leave a Hook for Improvement & Editorials:Leave a hook for others to add value or explain your post. Sometimes explaining things badly actually helps! Another blogger will clarify your message and link to you. I did this with this post and someone took the bait. If you say everything, they have less of a reason to link to you. [...]
September 22nd, 2006 at 5:25 am
A Diggable List of Lists on How to Get Dugg on Digg...
A guide on how to get your site into Digg....
September 25th, 2006 at 7:32 am
[...] Funny enough, I came accross this mod on Digg. It’s a plugin that displays the ammount of diggs your story has gotten as well as a Digg link for others to do the same. The block looks just like what you see on the homepage, so users will recognize it right away. It’s extreamly easy to use, just copy the code thats in this article, and save it as a php file and drop it in your template’s folder. Once you have done that, just call up the function using the following line of code (I found that this code was missing from the original article, so I decided to add it): [...]
September 25th, 2006 at 10:44 am
I need to get digged
September 27th, 2006 at 9:07 am
[...] 1) A wordpress plug-in by SEO Egghead [...]
September 29th, 2006 at 12:05 pm
[...] 1. Streamline Social Bookmarking Functionality. People = Lazy. Social bookmarking sites allow users to bookmark and tag content with certain attributes. The aggregate of this information is used both to cite popular content within certain timeframes, as well as over time. Adding icons and buttons to content facilitates the process of bookmarking and likely increases number of users who bookmark your web site. I discussed effective ways to do this (with code!) here, here, and here. [...]
October 1st, 2006 at 9:13 pm
Why not just have a bookmark menu like on this site?
Anonymous confessions
October 17th, 2006 at 7:40 pm
I think this is a cool idea. Can it be coded in such a way as to catch any incoming url and insert a differnt icon based on the website. Like in the options tab have an admin panel that allows you to select a certain url and the code that should be inserted into the post based on that info?
October 20th, 2006 at 2:48 am
Great one, will soon to be added to my blog. i am quite an idiot to php and coding but i think i can make it. have to thanks lXciD for his details step-by-step guides as well!
just one questions...can i customize the logo of digg it? (or make it smaller to fit in to my blog design?)
December 27th, 2006 at 6:10 am
[...] How To Get Dugg More: Digg for WordPress Plugin [...]
April 16th, 2007 at 4:55 pm
[...] http://www.seoegghead.com/blog/seo/how-to-get-dugg-digg-for-wordpress-plugin-p113.html [...]
April 18th, 2007 at 4:02 pm
Do we need to put this code into file and upload to our plugins folder ?
May 4th, 2007 at 8:11 am
[...] to php.ini. After a quick search, I found another plugin with similar functionality on SEOEgghead. Their script makes the same requests to Digg as Digg This, but does them more efficiently with [...]
June 28th, 2007 at 1:27 am
[...] http://www.seoegghead.com/blog/seo/ how-to-get-dugg-digg-for-wordpress-plugin-p113.html [...]
August 17th, 2007 at 9:18 pm
I plan to use digg with my site www.eruptingmind.com this looks interesting
August 18th, 2007 at 6:04 am
[...] Egghead: How to Get Dugg More: Digg for Wordpress Plugin Although Digg do have their own tools for this now aswell, its great to see what works and [...]
August 21st, 2007 at 9:44 pm
Did everything you said on my seo blog:
SEO Blog, however, still did not see the digg showing. I am using wordpress 2.2
August 30th, 2007 at 8:39 am
It's a nice plugin but i cant get it to work on my wordpress blog. I'll keep trying but i was hoping to get on of those plugins that you upload like a folder on the plugins folder for wordpress.