How to use StumbleUpon’s su.pr URL shortener in leenk.me

I recently wrote about using the bit.ly URL shortener in leenk.me and was doing some research into adding the StumbleUpon social sharing site to the leenk.me plugin. However, I was saddened to find that StumbleUpon does not have a public API. So there isn’t a way to publicize your posts directly to StumbleUpon, like you can with Facebook, Twitter, etc.

However, StumbleUpon does have a URL shortener called Su.pr. The su.pr URL shortener is basically like adding your site to StumbleUpon… it’s the only way leenk.me can use the service. So if you want people to be able to “Stumble Upon” your site, try this code:

function custom_leenkme_url_shortener( $api_url, $url ) {

    $supr_api ="http://su.pr/api/simpleshorten";

    $supr_args = array(
                            'url' => $url
                        );

    return $supr_api . '?' .  http_build_query( $supr_args );

}
add_filter( 'leenkme_url_shortener', 'custom_leenkme_url_shortener', 10, 2 );

Or, if you want to track your Stumbles, you can sign up at su.pr and use this code:

function custom_leenkme_url_shortener( $api_url, $url ) {

    $supr_api ="http://su.pr/api/simpleshorten";

    $supr_args = array(
                            'url' => $url,
                            'login' => 'ENTER_YOUR_SUPR_NAME',
                            'apiKey' => 'ENTER_YOUR_SUPR_APIKEY'
                        );

    return $supr_api . '?' .  http_build_query( $supr_args );

}
add_filter( 'leenkme_url_shortener', 'custom_leenkme_url_shortener', 10, 2 );
This entry was posted in Custom URL Shorteners, News. Bookmark the permalink.


9 Responses to How to use StumbleUpon’s su.pr URL shortener in leenk.me

  1. 3dgamer says:

    very helpful, thanks buddy

  2. Joseph says:

    Lew – I look forward to seeing this in the WP admin section – so those who don’t like to get into the code can take advantage of this great alternative to tinyurl.

  3. Joseph says:

    Lew – this and the bit.ly url shortener do not seem to work for me with the Old Post Promoter (OPP) plugin active. I’m guessing that the fix leenk.me did to work with OPP is short circuited by this change to my theme’s function.php file.

  4. Joseph says:

    I noticed that su.pr links place a StumbleUpon helper bar across the top of pages linked to. Su.pr also replaces the favicon with the StumbleUpon favicon – and continues to do that with EVERY page of the site linked to. I really don’t like StumbleUpon replacing my blog’s favicon or placing their bar across the top of my carefully crafted blog. The su.pr tracking could be useful, I suppose, but I’m already using Google Analytics. Mostly I’m not happy about the “helper” bar and replaced favicon.

    • Lew Ayotte says:

      That’s probably because of the su.pr bar, it is actually loading your site in an iframe through su.pr. I like this because it offers another way for people to share your site. If the user clicks the “X” on the bar, it will load your site like normal, with your favicon.

      To each his own :).
      Lew

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>