WordPress.org

Forums

[Plugin: Sociable] Patch to support bit.ly (14 posts)

  1. isra17
    Member
    Posted 5 years ago #

    Hey,
    I'm here to share some code I wrote today. Sociable only supports awe.sm at the moment. I wanted to use an url shortener like bit.ly, so I hacked into the core of the plugin to support more url shortener. At the moment, I support bit.ly with an API key. Feel free to request more url shorteners. You can find the patch and the new files there.

  2. delugeia
    Member
    Posted 5 years ago #

    I downloaded the zip file, but unfortunately the bit.ly.php file is empty, zero length.

  3. isra17
    Member
    Posted 5 years ago #

    Thank you to report this bug. This is really strange because on the FTP the file is fine, but when I download it the bitly.php is empty :/.
    Anyway, I put the file outside from wordpress folder and it work. Get it here.

  4. phattrance
    Member
    Posted 5 years ago #

    thank you, it works great now!

  5. hearmegrrl
    Member
    Posted 5 years ago #

    Hi, I implemented these files (copied them into the sociable dir), and then edited the sociable settings to select bit.ly and put in my bit.ly username and API key. However, nothing is any different on the blog...when I click on the Twitter icon for example, the URL is the same and does not shorten. Am I missing a step?

  6. hearmegrrl
    Member
    Posted 5 years ago #

    Actually, nevermind, I got it to show up on the page...BUT, when I click the link and it takes me to the bit.ly.php page to translate the link, it just displays a blank page and doesn't ever translate/resolve to the social network site. Here's a sample:

    http://silverpopstaging.beacontec.com/blogs/test1/wp-content/plugins/sociable/bit.ly.php?u=http://twitter.com/home?status=This%20is%20a%20Test%20-%20PERMALINK&t=http%3A%2F%2Fsilverpopstaging.beacontec.com%2Fblogs%2Ftest1%2Funcategorized%2Fthis-is-a-test.html

  7. archetypemkt
    Member
    Posted 5 years ago #

    I can't get this patch to work. Has anyone been able to get it to work? I have the same issues as hearmegrrl with the long links that lead back to an error page on my blog.

  8. Baden
    Member
    Posted 4 years ago #

    @isra17 - Great patch! Worked like a charm
    @archetypemkt - verify that you did the following:
    1. copy the contents of the .zip file into the sociable folder
    2. verify the sociable plugin is activated
    3. from the wp dashboard: options > sociable make sure that:
    a) Url shortener: as bit.ly radio button checked
    b) bit.ly login: enter your bit.ly username
    c) bit.ly API Key: enter your bit.ly API Key
    4. Save changes

  9. apronstringsaflutter
    Member
    Posted 4 years ago #

    This worked great for me, thanks! One question. Is there a way to add "Im reading..." before the actual post name and shortened URL that results in the tweet? If so, where would I add that? Im PHP challenged...

  10. isra17
    Member
    Posted 4 years ago #

    If this isnt working you should make sure that you followed Baden step. I updated the patch today because I just found out that wordpress where using its own custom magic_quote function and when you were trying to use '," or \ in your title they were escaped. Only bit.ly.php has changed.

    @apronstringsaflutter - You can 'hack' through sociable.php in sociable plugin folder and change line 540 into something like
    'url' => 'http://twitter.com/home?status=I%27m%20reading...%20TITLE%20-%20PERMALINK',

    I hope this might help you

  11. maciejplonka
    Member
    Posted 4 years ago #

    Patch works just fine with the exception of one detail - while URLs are shortened, neither Facebook, nor Delicious fetches info like post title. As a result, when sharing through Facebook, bit.ly URL is used as both URL and title, the same goes for Delicious.

    Twitter works great, with certain changes I made:
    'url' => 'http://twitter.com/home?status=TITLE%20|%20BLOGNAME|%20PERMALINK',

    On the other hand, similar changes made to Facebook do not work, post title and blog name are not posted to Facebook:
    'url' => 'http://www.facebook.com/share.php?u=PERMALINK&t=TITLE%20|%20BLOGNAME',

    It all worked without the bit.ly patch.

  12. isra17
    Member
    Posted 4 years ago #

    I didnt change anything in the url list, but you should try to replace the '&' by '&' like others URL.
    Original version (note the &)'url' => 'http://www.facebook.com/share.php?u=PERMALINK&t=TITLE',
    this should look like
    'url' => 'http://www.facebook.com/share.php?u=PERMALINK&t=TITLE%20|%20BLOGNAME',
    hope this help

    Edit: Nevermind, look like & amp; are converted to & by wordpress.

    Edit 2: Found why it happens. This is dumb (I'm using 't' to pass the link throught the bit.ly script but page like facebook use 't' too so its not working well. I will fix it asap.

  13. isra17
    Member
    Posted 4 years ago #

    I did some change. I'm not using facebook tho, so I can't test if it work now, but I think it should. New version here : http://alecto.free-h.net/blog/wp-content/uploads/2011/03/sociable_bitly.zip

  14. maciejplonka
    Member
    Posted 4 years ago #

    Great, I confirm Facebook, Twitter and Delicious working just fine. Thanks a lot for a quick reaction!

Topic Closed

This topic has been closed to new replies.

About this Topic