Social Web CMS
February 09, 2010, 06:43:33 am *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: For the latest news and updates, please follow us on Twitter! http://twitter.com/HotaruCMS
 
   Home   Help Search Login Register  
Pages: [1] 2 3 4
  Print  
Author Topic: Tweet this! Module v.0.4  (Read 6268 times)
Nick
Administrator
Hero Member
*****
Offline Offline

Posts: 668



View Profile WWW
« on: December 05, 2008, 11:22:06 am »

Description of Tweet This! Module v0.4

Updated to version 0.4 - February 12th 2009

Twitter is a powerful tool for promoting your site. Even if you don't use Twitter yourself, your users might be regular Twitterers. So what if you put a "Tweet this!" link on every story on your site? Without even needing to register, people who find an interesting story can tweet it to their friends -and some people have hundreds or thousands of friends on Twitter!

The Twitter post includes the title of the link, and an automatically shortened url to the story on your site. Unlike the "Add this link to..." functionality which posts the original story to Digg, StumbleUpon, etc. the "Tweet this!" module promotes the submitted story instead. That means your site gets new visitors from Twitter, the person who submitted the story will get more votes on it, and the original author will still get hits. Everyone's a winner!

Okay, enough promotion, here are the details...

Instructions
  • 1. Upload the tweet_this folder to your modules folder. Install it from Module Management in Admin.
  • 2. You'll need the following in /templates/your_template/link_summary.tpl:
          {checkActionsTpl location="tpl_link_summary_pre_report"}
        before this block of code:
Code:
{if $link_shakebox_currentuser_votes eq 0 && $link_shakebox_currentuser_reports eq 0}
<span id="xreport-{$link_shakebox_index}"><span id="linksummaryBury"><a href="javascript:{$link_shakebox_javascript_report}">{#PLIGG_Visual_Vote_Bury#}</a></span></span>
{/if}

    Notes
    When you click the Tweet this! link under a story, this module checks the database to see if a shortened link exists. If not, it uses http://th8.us/ to create a short link and stores it in the database. If another user tweets the same story, the short link from the database is used, rather than creating a new one.

    Credits
    Many thanks to Richard X. Thripp who created http://th8.us/ and the Tweet This plugin for Wordpress which this module is based on.

    Revision History
    • v0.4 2009/02/12 Nick - Fix to make this module compatible with changes at th8.us.
    • v0.3 2009/01/20 Nick - Renamed module hook for compatibility with other modules.
    • v0.2 2008/01/09 Nick - Fixed url location issue and user page issue as noted by ditto here and landshark here in the comments.
    • v0.1 2008/12/05 Nick - first version.

    IMPORTANT: The story submission approval module and block discarded stories are encouraged with any "add to any" or tweet modules like this one. A spammer can tweet the story on step 3 since the story's url has been already set!
    Story submission approval -
    http://forums.socialwebcms.com/index.php?topic=414.0
    block discarded stories -
    http://forums.socialwebcms.com/index.php?topic=284.0


    * tweet_this_image.jpg (172.68 KB, 500x658 - viewed 327 times.)
    * tweet_this.zip (20.78 KB - downloaded 160 times.)
    « Last Edit: April 02, 2009, 10:51:49 pm by catchpen » Logged

    Reinventing SWCMS at HotaruCMS.org - testers, designers and developers wanted!
    bbrian017
    Full Member
    ***
    Offline Offline

    Posts: 190



    View Profile WWW
    « Reply #1 on: December 07, 2008, 01:39:10 pm »

    What an awesome little mod Smiley I like it very much!
    Logged

    hanskainz
    Newbie
    *
    Offline Offline

    Posts: 20



    View Profile
    « Reply #2 on: December 09, 2008, 04:26:34 am »

    Best Module ever, thx so much!
    Logged
    corbybender
    Newbie
    *
    Offline Offline

    Posts: 34



    View Profile WWW
    « Reply #3 on: December 18, 2008, 04:45:23 pm »

    Just installed, works perfectly.  Your directions were excellent.  Thumbs up and thanks for the module!

    -Corby-
    http://www.blogfloat.com
    http://www.nerdnology.com
    Logged

    landshark
    Newbie
    *
    Offline Offline

    Posts: 36


    View Profile
    « Reply #4 on: January 05, 2009, 01:08:31 pm »

    LCD,

    I just noticed that my shortened url's are not working properly. I have my SWCMS installed in a sub directory (/main) and getthe following link generateed.

    http://www.mysite.com/main//main/story.php?title=blah-blah-blah

    any ideas?
    Logged
    Nick
    Administrator
    Hero Member
    *****
    Offline Offline

    Posts: 668



    View Profile WWW
    « Reply #5 on: January 05, 2009, 10:33:17 pm »

    I have my SWCMS installed in a sub directory (/main) and get the following link generated: http://www.mysite.com/main//main/story.php?title=blah-blah-blah

    Hmm... this is a bit tricky....

    1. Open tweet_this_main.php in the tweet_this module folder.
    2. Look for the function called get_tweet_this_short_url at around line 72.
    3. Have a look at this line:
    Code:
    $url = file_get_contents('http://th8.us/api-tt.php?url=' . my_base_url . my_pligg_base . "/" . $link->get_internal_url());

    I think the problem you're having is with my_base_url and my_pligg_base.

    I'm guessing that you've got my_base_url set as http://www.mysite.com/main/ and my_pligg_base set as /main/ or something like that. If you want to check your settings, look in the config table in the database, they should be near the top, most likely with ids 7 and 8.

    Anyway, for now, the easiest way to get Tweet This working is just to change the line to:

    Code:
    $url = file_get_contents('http://th8.us/api-tt.php?url=http://www.mysite.com/main/' . $link->get_internal_url());

    You'll have to test it on a different url because the ones you've already tried have been stored in the database so no new url will be created (unless you remove the broken urls from the link_tinyurl field in the links table in the database.)

    Let me know how you get on.  Smiley


    « Last Edit: January 06, 2009, 06:37:18 pm by longcountdown » Logged

    Reinventing SWCMS at HotaruCMS.org - testers, designers and developers wanted!
    landshark
    Newbie
    *
    Offline Offline

    Posts: 36


    View Profile
    « Reply #6 on: January 06, 2009, 03:33:49 pm »

    LCD,
    I tried to hard code the url like you advised but got the following error

    Quote
    Parse error: syntax error, unexpected T_STRING in /home/digest/public_html/main/modules/tweet_this/tweet_this_main.php on line 80

    any ideas?

    Logged
    landshark
    Newbie
    *
    Offline Offline

    Posts: 36


    View Profile
    « Reply #7 on: January 06, 2009, 03:48:13 pm »

    ok just checked my location settings and another site url was entered this was left over from when we were hacked a while back.

    I have changed them back to what they are supposed to be and now how do I clear the old generated "link_tinyurl" can I simply go and delete them?

    Logged
    Nick
    Administrator
    Hero Member
    *****
    Offline Offline

    Posts: 668



    View Profile WWW
    « Reply #8 on: January 06, 2009, 06:36:48 pm »

    Quote
    Parse error: syntax error, unexpected T_STRING in /home/digest/public_html/main/modules/tweet_this/tweet_this_main.php on line 80
    Whoops, that last quote after main/ should have been a single quote not a double quote. I've just fixed my original post. Sorry about that.

    how do I clear the old generated "link_tinyurl" can I simply go and delete them?
    In PHPmyAdmin, click to edit the link then just backspace out the tinyurl field and save. Don't go deleting the whole row!  Wink
    Logged

    Reinventing SWCMS at HotaruCMS.org - testers, designers and developers wanted!
    meckenrode
    Newbie
    *
    Offline Offline

    Posts: 27


    View Profile
    « Reply #9 on: January 08, 2009, 06:03:51 pm »

    sweet plugin. thank you!
    Logged
    ditto
    Jr. Member
    **
    Offline Offline

    Posts: 54



    View Profile
    « Reply #10 on: January 09, 2009, 07:00:35 am »

    This is a great module, longcountdown. Thank you!

    3. Have a look at this line:
    Code:
    $url = file_get_contents('http://th8.us/api-tt.php?url=' . my_base_url . my_pligg_base . "/" . $link->get_internal_url());

    I had the same problem with the double slashes // in the URLs, but instead of hardcoding the above code with the domain name, i just removed "/" from the line of code quoted above, so that it becomes like this:
    Code:
    $url = file_get_contents('http://th8.us/api-tt.php?url=' . my_base_url . my_pligg_base . $link->get_internal_url());

    One other thing: On the users profile pages (under the tabs with users history), the «Tweet This!» link don't work, because the link on those pages don't have the id number. I have not found a fix for that, but instead i just removed the «Tweet This!» link from the users profile pages with this code in link_summary.tpl:

    Code:
    {if $pagename eq "user"}
    {else}{checkActionsTpl location="tpl_link_summary_tweet_this"}{/if}

    I don't think it is important to have the link on the users profile pages, so i am very happen with the end result.

    Again, i really love your mod, longcountdown, thanks for sharing!
    Logged
    Nick
    Administrator
    Hero Member
    *****
    Offline Offline

    Posts: 668



    View Profile WWW
    « Reply #11 on: January 09, 2009, 07:20:18 am »

    Good tips ditto, thank you! Smiley

    I never even noticed the user page issue.  Embarrassed
    Logged

    Reinventing SWCMS at HotaruCMS.org - testers, designers and developers wanted!
    Nick
    Administrator
    Hero Member
    *****
    Offline Offline

    Posts: 668



    View Profile WWW
    « Reply #12 on: January 09, 2009, 10:01:43 am »

    Thanks to previous feedback from landshark and ditto, I have updated Tweet This! to version 0.2.

    The url issue mentioned first by landmark is fixed in v.0.2. Also, Tweet This! now works on user page links.

    Four files have changed in this version so I recommend upgrading. You will need to disable v.0.1 from Module Management and then install v.0.2.
    Logged

    Reinventing SWCMS at HotaruCMS.org - testers, designers and developers wanted!
    ditto
    Jr. Member
    **
    Offline Offline

    Posts: 54



    View Profile
    « Reply #13 on: January 17, 2009, 07:32:44 am »

    Thank you for the new version with the fixes. I have added the changes, and it works very well.  Smiley
    Logged
    Nick
    Administrator
    Hero Member
    *****
    Offline Offline

    Posts: 668



    View Profile WWW
    « Reply #14 on: January 20, 2009, 05:31:51 am »

    Tweet This! Module updated to v.0.3

    Changes:
    Module hook renamed for compatibility with other modules.

    If you're upgrading from v.0.1 or v.0.2...
    Change: {checkActionsTpl location="tpl_link_summary_tweet_this"}
    To: {checkActionsTpl location="tpl_link_summary_pre_report"}
    Logged

    Reinventing SWCMS at HotaruCMS.org - testers, designers and developers wanted!
    Pages: [1] 2 3 4
      Print  
     
    Jump to:  

    Powered by MySQL Powered by PHP Powered by SMF 1.1.9 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!