User Tools

Site Tools


twitter

NP_Twitter.php

Twitter is a popular microblogging service. This plugin provides integration between Nucleus and Twitter. It can be used as a simple (but not full feature) twitter client.

Feature included:

  • download and archive tweets for a user
  • statistics of a twitter, #friends/#followers
  • send update twitter from Nucleus
  • manage your updates i.e. delete a update
  • Twitthis support
  • build-in tweetlet support
  • provide a simplified twitter web interface from Nucleus


General Plugin info
Author: Edmond Hui
Current Version: v0.91
Download: here
Code: n/a
Demo: here
Forum Thread: here

Installing

  1. download the code from above
  2. unzip and unload NP_Twitter.php to plugin directory
  3. install the plugin from plugin menu
  4. goto member setting to set twitter account and password
  5. edit plugin option to change formating, if desired
  6. add skinvars to sidebar and configure (see below)
  7. setup a cron job to update tweets for all users.
i.e. 4,7,14,21,28,35,42,49,56 * * * * root /usr/bin/GET "http://localhost/blog/action.php?action=plugin&name=Twitter&op=refresh" &> /dev/null

Upgrading

  1. set “Delete tweets cache on uninstall” to no
  2. uninstall the plugin
  3. install the plugin
  4. configure the plugin options
  5. configure user twitter account information

Configure

To setup a twitter badge, simple put <%Twitter(tweets,member,num%> in the sidebar of a skin.

Also, advanced user can create a custom page to put up a twitter user interface on Nucleus similar to twitter's own web interface. This provide a way user to archive his/her tweets locally and use Nucleus as a alternate twitter client.

The setup steps:

  1. create a new skin call “twitter”, this can be clone from an existing skin to provide a consistent layout with the blog.
  2. from the skin's main index, insert <%Twitter(tweets,[member],40)%> and <%Twitter(updatebox)%> to list recent tweets and a update box. If the skin is cloned, likely replacing all contents in the main contents section, and with the sidebar removed.
  3. create a tweet.php to use the new skin, code example here
  4. When calling the Nucleus twitter web interface, parameter ?tpage=1 is required, this will trigger the tweet badge into archive mode. A older/newer link will be shown to allow user to see older updates.

see example

If a Tweetlet function is desired, user can add this to bookmark:

javascript:location.href='http://yourblog.com/blog/action.php?action=plugin&name=Twitter&op=tweetlet&url='+encodeURIComponent(location.href)+'&text='+encodeURIComponent(document.title) 

How to use the plugin

User can use the update box from to send a update.

[reply] button is at the end of a tweet to allow user to reply to another twitter via @someone.

[directmail] button is at the end of a tweet to allow user to replay to another twitter via direct mail

[delete] button is also visible for a login user to delete his/her update.

[favorite] button allow user to make a tweet as favorite

If direct message and favorite are setup, a link is provide to access these tweets

Available SkinVars and/or TemplateVars

SkinVars:

<%Twitter(updatebox)%> - show the twitter update box for the current login user, it should be wrapped with <%if(loggedin)%> and <%endif%> so only display when login.
<%Twitter(tweets,member,num,[text|icon])%> - show a twitter badge of x most recent tweets by a particular member and those he/she followed, the twitter name formating can be overrided by putting optional parameter text/icon at the end
<%Twitter(link,member,link label) - show a link to a member's twitter page
<%Twitter(stats,member)%> - show #friends/follower for a member
<%Twitter(mytweets,member,num,[text|icon])%> - show a twitter badge of x most recent tweets by a particular member only, the twitter name formating can be overrided by putting optional parameter text/icon at the end
<%Twitter(linktodm)%> - add a link to show direct message (for login user only)
<%Twitter(linktofav)%> - add a link to show favorite tweets (for login user only)
<%Twitter(linktoatweet)%> - add a link to show also friends' tweets of a user

TemplateVars:

<%Twitter(twitthis)%> - add a button to allow visitor to tweet about a post using [[http://twitthis.com/|Twitthis]]

Options

Tweets header formating - header for the twitter badge
Tweets formating - formating of each update. Available formating tag: %%TWITTERT%% for twitter name in text, %%TWITTERI%% for twitter name with image, %%TWEET%% for update text, %%TDATE%% - date
Tweets footer formating - footer for the twitter badge
Text to tweet on new post - formatting to use when sending update for a new post . One format per line, will be randomly pick so multiple format is possible. Available formating tag: %l == item url, %t == title, %e == excerpt
Delete tweets cache on uninstall - whether to delete update archive when uninstall
Show Date in Archive - whether to show date to separate tweets in badge

Tips and Tricks

Wishlist

Bugs

The tweetlet will not work if there are ' somewhere in URL…. it's a firefox/javascript not sure how to fix it…

History

  • Version 0.6 first public release
  • Version 0.7
    • add new post tweet override option in bookmarklet/add new post panel
  • Version 0.8
    • support for direct message
    • support for favorite
    • add client source as nptwitter
    • various bug fixes
  • Version 0.90
    • skip CURL returns for sendTweet
    • set VARCHAR size to 255 to support MySQL version < 5.0.3
    • add replyid to update so reply to someone is link properly
    • set fix icon image size
    • download replies (include those twitters I am not following), show all replies
    • properly decode specialchars
    • fix for Twitpocalypse!!!
    • Please uninstall and re-install the plugin in order to fix Twitpocalypse. If you'd like to keep your old tweets, check the plugin option to preserve old tweets.
  • Version 0.91
    • fix special char encoding/decoding
    • no reply button for dm
    • link to @who, #tag

Plugin review

NP_Twitter version 0.6 works with Nucleus CMS 3.31 - 2007-10-29 admun

twitter.txt · Last modified: 2010/09/13 16:48 (external edit)