Hello,
I am not here to cut up the twitter module or bring it down. We use it and it works well for multi-user sites.
We have found the Twitter module way to heavy for a basic sites with one user or only one twitter account.
What we ended up doing was dropping some custom php code into a block and got a way faster alternative.

So we have been working on a Simple Twitter module.
It only stores your Twitter Username and Password in the Variables table.
If you do not provide your password it will only pull your tweets.
Provides a block of tweets.
There could be some other basic features but we want to keep it neat. For lots of features we would use the Twitter Module.
It is a small module but works well.

I am asking if there is a requirement to post this module on Drupal.org or this can be added into the main Twitter Module as a sub module.
If this was to be added to the Twitter Module and used the Twitter_api module, could this module bypass alot of the code an database queries to keep this module lean?

The whole reasoning is to keep this lean and for one Twitter Account. It has a very easy setup and is intuitive.

Thanks for your time.

chris bovard

Comments

alexbovey’s picture

Hi Chris,

I'd be very interested in having a look at this as an alternative if you could provide me with a copy? It would suit my requirements more closely.

Thanks very much,

Alex

cbovard’s picture

Hello,
I just need to clean it up a bit tonight and I will post it.

Thanks for your interest.

chris

cbovard’s picture

StatusFileSize
new3.7 KB

Hello,
Sorry about the delay.
Attached is the module. I hope people like it.

Thanks for the request.

chris bovard
www.chrisbovard.com

clintcar’s picture

i'm really happy to see different flavors of modules like this. I also had found the twitter module too heavy for my needs and I'll be happy to use this. Thanks for the work.

iainp999’s picture

Hi guys,

This looks like just what I need for the site I'm working on.

I'm very new to Drupal and have been struggling to find much (noob) info on how to work with the Twitter module and views, and style it the way I need to. I'm sure that will become easier with experience of the way Drupal works, but for now this looks great for my needs.

Thanks!

fuzzion’s picture

Great little module Chris!
Are you able to add some code so the Twitter user image is shown next to the message?

Thanks!

izmeez’s picture

subscribing

cbovard’s picture

Hello,
We are waiting to do anymore development with this until Twitter implements Open Auth. http://apiwiki.twitter.com/FAQ#WhenwillTwittersupportOAuth

We are trying to keep this module lean. There is more work do be done with retweets and such.

There is a $twitters variable being passed around. print_r and maybe you can get it going.

Sorry to pass the buck but I am very busy right now.

Thanks for the comments.

chris bovard

www.chrisbovard.com

drupaledmonk’s picture

Sweet module. I am having a problem with the way simple tweet is handling my links. The url from the twitter message has a number of '-'(dash) and the url gets cutoff at the first '-' and remaining part is displayed as a simple text. My project is almost complete and I am left with this one issue. If I am not clear with issue kindly check the url. In the bottom right there is a quick tab with testimonal and twitter.

http://115.119.54.226/arasan1/

mattiasj’s picture

I will try this out aswell!

cbovard’s picture

StatusFileSize
new6.15 KB

Hello,
Here is the updated version for the URL dash issue. I tested it.
Sorry about the zip.

chris bovard

www.chrisbovard.com

drupaledmonk’s picture

Thanks a lot today seems to be a very good day. The issue is fixed and I recieved my drupalgardens invite also xD.

netentropy’s picture

does this module tweet also or just show tweets on the our drupal site?

drupaledmonk’s picture

It only shows tweets of a particular user I guess.

BenK’s picture

Subscribing...

cbovard’s picture

Hello All,

This module only collects tweets from one user.

It does not tweet when a node is updated or added or anything else really.

If you need more features then collecting tweets from one user then use the main Twitter module.

Sorry but it defeats the purpose and scope of why we built this module.

Thanks for your time and interest.

chris bovard

www.chrisbovard.com

Thomasr976’s picture

Was wondering if the Simple Twitter Module is going to made part of the Twitter Module or will be undergoing more developement? Thanks

cbovard’s picture

Hello Tom,
At this point (besides fixing bugs), we are not going to add anymore features to the Simple Twitter Module until Twitter implements the OpenAuth into their API.
Unless you can contribute something to make it better?

As for melding this module with the main Twitter Module, I am not sure. I have not heard anything except the postings on this thread.

regards,

chris bovard

www.chrisbovard.com

sunchaser’s picture

awesome work
would love to see a version of this simplified twitter module to be used with a hashtag search result twitter feed :)

I could give it a try myself but then, by the year 2013, we still wouldn't have a working module :)

yaworsk’s picture

Hi all,
this module is great, thanks for posting it. I tried this morning to add in the ability for users to dynamically choose how many tweets to show in a block but had some trouble and thought someone might be able to help out (I'd post the code but I'm at work and can't access it right now).

So, in the admin.inc file, I added another variable under the $form section - I simply copied the user name code replacing it with a new variable, etc. Using the devel module, i was able to confirm that the value provided by the user is being captured in the #value of the new variable.

Then, in the .module file, I added $number_of_tweets and used variable_get to get the value from the input captured by the admin.inc. I then changed line 62, replacing the 1 with the variable, $number_of_tweets.

However, when I checked my block, it showed all tweets, not the number provided by the user. To me, it seems like $number_of_tweets is being passed an empty value though I couldn't check the actual $number_of_tweets value (via the devel module) passed into the block b/c all the function showed was a xml variable that wasn't expandable and I was short on time and couldn't play around with it this morning.

Sorry for not being able to post the code (or waiting until I got home) but this is still really bugging me b/c I can't figure out why the value isn't being transferred correctly into the .module file. I thought it might have to do with collecting an integer in a textfield?

Any help is greatly appreciated and if we can get this to work, I'll post the code tonight.

Thanks,
pete

cbovard’s picture

Hello,
Post the module and we will take a look at it.
Thanks for helping out with this.

For the hash tag search feature, it goes beyond the scope of what we were trying to do.
Does the main Twitter Module do this?

chris bovard

www.chrisbovard.com

yaworsk’s picture

StatusFileSize
new2.49 KB

Hi Chris,
success. On a seperate post, someone mentioned using the drupal message function to see what value was being passed to the variable I created and I realized I was using the variable_get() function in the wrong place (line 133 instead of line 41). I changed that up and bam, works like a charm.

I've uploaded a zip file with both updated files here. sorry, i dont know how to create a patch or anything (if you were thinking that...)

As a summary, I added code line 17-21 in the admin.inc to get the value from the user (if they don't provide one, it is defaulted to 1). I added code line 41 in the .module and edited 63 to call the variable.

Let me know what you think. If this works, I'd be glad to do the same for the tweets page.

Pete

cbovard’s picture

Hello Yaworsk,
Sorry about the delay but work has been busy. I will be focusing on this today and next week.
I am going to move the Simple Tweet Module to Github too.

Thanks for your patience.

chris bovard

www.chrisbovard.com

cbovard’s picture

Hello Everyone,

Ok, I added the changes from Peter Yaworski (thanks for the help Peter).
I added a single Tweet Block.
There is also a Multiple Tweet Block using Peter Yaworski's addition.
There is also a page being created that you can change the path and page title for. This page will show your most recent tweets.
At this time there is no plans to show all your tweets or pagination for this page.

Here is the link to the code on Git Hub: http://github.com/cbovard/simple_tweet
You will see, on the page above, a button called "Download Source". This will let you download the folder with the files needed.
YOU WILL NEED TO CHANGE THE FOLDER NAME TO: simple_tweet or it will not work. Git Hub changes the folder name.

I would apply for a Drupal CVS account and contribute this module but because it falls under this statement "Module 'Foo' is just too complex so I have written a much simpler version." stated on this page: http://drupal.org/node/539608 so am not going to bother.

If anyone has a better idea, let me know.

Enjoy and thanks for the support.

chris bovard

www.chrisbovard.com

yaworsk’s picture

hey chris,
i'm glad my changes worked. I think you're right about the CVS account, its too bad but I think you've found a decent alternative.

let me know if i can help out in any other way,
pete

Wutimer’s picture

subscribing...

The module works well. It would be nice to add in a field to select the number of recent tweets to list - shall I send the code.

www.intriguedesign.ca
www.intriguedevelopment.com

yngens’s picture

subscribing.

will a separate module page created for this work?

cbovard’s picture

Hello David,
In response to your comment:
It would be nice to add in a field to select the number of recent tweets to list
If this is referring to the number of tweets in the block? This has been already added.

Hello Yngens,
I will apply for a cvs account today and see what happens.

Thank you for your interest.
chris bovard

www.chrisbovard.com

NPC’s picture

Subscribing as well, looks very interesting.

cbovard’s picture

Hello,
Here is a bit of an update on my application for a CVS account:
http://drupal.org/node/756454

I got denied because of this clause from this page: http://drupal.org/node/539608
Module 'Foo' is just too complex so I have written a much simpler version. This is just straight duplication of functionality and applications like this will almost certainly be declined. It is worth remembering that many modules start out simple also and, over time, grow into more complex systems. If you have the know how to write a "simple version" from scratch rather than work out how a complex module works then maybe your effort would be better spent making the existing complex module easier to use (improve it's UI, write documentation, etc).

This will not stop development or bug fixes with this module. We use it alot where I work so I am not going to give up.

It will remain on GitHub.

Thanks for the support:

chris bovard

NPC’s picture

Hmm, this is odd, especially in the light of site performance becoming an important factor of site's success - there is a trade off between flexibility and lightness, and it would be good to have a choice depending on the task at hand.

Chris, thank you very much for continuing with your efforts!

YK85’s picture

subscribing

kotnik’s picture

subscribing

youkho’s picture

+1 Thanks for your hard work we appreciate it

dawansv’s picture

Thanks Chris for this module. I was looking for a straight forward way to post tweets from our organization's twitter account on our site's front page and this is it!

I would resubmit your module for a CVS account. I think the rejection came from the fact that your description starts with "This project was developed because we found the Twitter Module (http://drupal.org/project/twitter) was too heavy of a module for a one person Website"

In fact, I think this module is not a simple version of the twitter module, but serves a totally different purpose. I tried the Twitter module first, but then went looking for another solution because I thought what I was doing was a silly use of the module. The Twitter module, as its description clearly states, is user centric: it is designed for users to submit and retrieve tweets, and the functionality is build around user account features. Even if is has a site-wide display of tweets, it does so by grouping tweets connected to particular users.

The Simple Tweet module is site centric: it is designed to retrieve and display tweets from a single feed, probably a feed attached to the site (so this is not just for individuals with blogs, but for any organization or group that has a twitter account and wants to display tweets on their site front page).

The fact that you could achieve the same result by using the Twitter module I think is beyond the point: this would be a silly use of a user-centric module: just allowing tweets for one user (the admin user for instance) then displaying them using the "all tweets" blocks which is normally designed to group tweets from all users.

So I would resubmit the module with its own description, and then noting the difference with the twitter module by saying that this is a site-centric module, not a user-centric module. This is definitely not a "straight duplication of functionality"...

My 2 cents.... (long 2 cents...)

cbovard’s picture

Hello and thanks for the support.
I am wondering if I should reopen my CVS application or just start a new one?

Thanks for the support.

chris

dawansv’s picture

I don't have first hand experience with CVS application but I would lean towards reopening the current one with an updated explanation...

cbovard’s picture

dawansv - No issue. I wil reopen the cvs ticket.

On another note: 7 Weeks Until the Twitter OAuthoclypse - http://www.sitepoint.com/blogs/2010/05/07/twitter-oauth-authentication/

Edited---
We have looked at the Simple Tweet Module and implementing the open auth. It is not needed.
The beauty of this module (being simple and all that), is that it just has to pull the tweets of a user.
You do not need to login to get the user's rss feed. EX: http://twitter.com/statuses/user_timeline/15926720.rss

So I am going to do the updates and resubmit this module to Drupal.org.

Looking at what will happen with the Twitter Module. They will have to implement the OpenAtuh Module somehow.

Our module will get simplier. Only a URL is needed.

Thanks again everyone.

chris

ldheyn’s picture

nice module
just what I needed
easy to install, works flawless, superduper fast...
thumbs up!

cbovard’s picture

Hello All,
I have updated Github with the new Simple Tweet Module
Here is the link: http://github.com/cbovard/simple_tweet

This will use your Twitter RSS feed. No Basic Auth or OAuth.

I have reapplyed for a CVS application to have this module part of the drupal.org projects.

Please let me know if there is any issues.

Enjoy!

chris

yaworsk’s picture

hey chris,
a client pointed out to me that there is no "follow us" link or anything like that. I was thinking of playing with the module to add that functionality, allowing the site admin to specify the follow us link on the simple tweet menu and then adding some simple text somewhere on the block.

Anyone else interested in that type of functionality if I do it?

pete

cbovard’s picture

Hello,
I have updated the module to allow this for the blocks. There has been another request to be able to change the title of these links also.
I had a review of the code and I will be working on this starting monday.

The newest version is on github.

Let me know if you have issues with the most recent copy here: http://github.com/cbovard/simple_tweet

I will post here when I am done the update.

chris

cbovard’s picture

Hello,
I updated the Simple Tweet module: http://github.com/cbovard/simple_tweet

Enjoy.

chris

shellbot’s picture

Everything I needed for my site and, most importantly, no more than that.

Thanks so much for this module, a lot of people appreciate the effort regardless of where it's hosted.

petercamburn’s picture

Subscribing.

Works Great!

yaworsk’s picture

Hi all,
FYI - I got these warnings today from the simple tweet module which resulted in the white screen of death for a client:

warning: SimpleXMLElement::__construct() [function.SimpleXMLElement---construct]: Entity: line 107: parser error : Premature end of data in tag user line 107 in /home/httpd/vhosts/[SITE]/httpdocs/sites/all/modules/simple_tweet/simple_tweet.module on line 149.

warning: SimpleXMLElement::__construct() [function.SimpleXMLElement---construct]: in /home/httpd/vhosts/[SITE]/httpdocs/sites/all/modules/simple_tweet/simple_tweet.module on line 149.

warning: SimpleXMLElement::__construct() [function.SimpleXMLElement---construct]: ^ in /home/httpd/vhosts/[SITE]/httpdocs/sites/all/modules/simple_tweet/simple_tweet.module on line 149.

I haven't had time to check them out yet but thought I would post in case anyone had any info. Weird thing is, I didn't install anything new / make any updates when I received the errors - I had just deleted a ubercart product node. Obviously [SITE] is the name of the site where the error occurred...

Also - is there a thread specifically for Simple Tweet? Seems like we hijacked a thread from the Twitter module...

Pete

yaworsk’s picture

Interesting, Twitter is down right now and I get the impression that might have something to do with the error. While I don't have the code for the simple tweet module in front of me, I don't recall there being any code to handle a situation where the module might not be able to pull data from twitter? Am I right Chris?

If so, that could pose a problem if the module couldn't reach twitter to pull data as the module would have nothing to return...

pete

cbovard’s picture

StatusFileSize
new2.29 KB

Hello,
There is an issue with curl getting the rss feed.

I have attached the new module file.

Here is the function that has changed:

/**
 * Get Tweets
 */
function _simple_tweet_get_twitters() {  
  //get rss url
  $rss_url = variable_get('simple_tweet_rss_url', '');
  if (!$rss_url) {
    drupal_set_message(t('Please set your Twitter User RSS Feed.'), 'error');
	//get out
	return;
  }else{
	  //if the tweets rss feed has an error
	  if (preg_match('/^http?:\/\/.+/', $rss_url)) {
		$twitter_xml = file_get_contents($rss_url);
		//parse the data 
		$twitters = new SimpleXMLElement($twitter_xml);
		//return tweets
		return $twitters;  
	  }else{
		//log error
		watchdog('simple_tweet', 'There is an issue with the RSS twitter Feed');
		//get out
		return;
	  }
  }
}

If anyone can make this better and find a way to put an error handler in for the "SimpleXMLElement($twitter_xml);" please let me know.

chris

dawansv’s picture

Twitter is having some problems today and truncating the rss feeds, hence the problem...

Don't have time to investigate further right this minute, but what about using simplexml_load_string instead of just declaring a new SimpleXMLElement... simplexml_load_string is supposed to return false if it fails... http://php.net/manual/en/function.simplexml-load-string.php

--Vincent

yaworsk’s picture

Hey Chris,
I'm not getting any info using the new .module file and in watch dog I'm getting the message there is an issue with teh RSS twitter feed as per line 209. However, I've checked the rss link and its fine.

I'm looking at the code now...

yaworsk’s picture

Got it. Line 201 wasn't being evaluated as true so the xml feed was not being converted and the module was returning the watchdog message. Change line 201 to

if (preg_match('/^http?:\/\/.+/', $rss_url)==0) {

and we're good.

Pete

cbovard’s picture

Thanks vincent.. I will look into this and test it out.
TWITTER .. .ahrhrhrhrjjr

chris

cbovard’s picture

Hello,
I have tested out that function and added it. It works well and passes a FALSE if there is an issue.
Here is the link to the github http://github.com/cbovard/simple_tweet

Pete, as for this - if (preg_match('/^http?:\/\/.+/', $rss_url)==0) {
This did not work so I left it out.

I have not heard anything back about starting a project for this. So there is no concern and I am not going to push for it.

sincerely.

chris bovard
www.chrisbovard.com

kjshaw’s picture

Chris,

First, God bless you for this fantastic module! It's just what I needed.

I'd like to change one thing, though. I'd like to change the more link at the bottom of the block to point to twitter.com/twittername, rather than example.com/our-tweets. I looked at the module code, but I'm not a coder.

Thanks in advance for any help.

Kevin

kjshaw’s picture

Chris,

Never mind, I got it.

Thanks again for this!!

Kevin

cbovard’s picture

coolio

yaworsk’s picture

Hey Chris,
I just realized there may be an issue with the module for users with larger scale sites - Twitter has a built in rate limiting system which only allows you to make 150 requests an hour. Exceed it and you could be facing some form of 'twitter justice'. For the smaller sites, this won't be a problem but for larger sites it could be. Twitter recommends caching tweets. The July issue of Practical WebDesign discusses it.

I'm not sure how Drupal would handle requests from site visitors for simple tweet. Would it call _simple_tweet_get_twitters each time a new visitor loaded the simple tweet block / page or would drupal cache results itself?

Thoughts?
pete

cbovard’s picture

Pete,
I am using the rss feed, not the API.

I do not think after 150 rss feed requests they turn it off for a specific IP.

regards,

chris bovard

www.chrisbovard.com

abraham’s picture

Chris:

Twitter's RSS feeds are ratelimited. Look for X-RateLimit-Remaining in the following link. If you send the request a couple more times you will see it decrease.

http://hurl.it/hurls/bd8c2cf6298bcb7c9be31379c27cc874b76409b8/0cafd448c9...

cbovard’s picture

Hello,
I will work on a cache_get cache_set for this so that the tweets are only refreshed every 5 to 10 min.
I cannot work on this for a week or so.

Also I did well over 200 page requests to the rss feed in 10 min and there was no error.

chris

mshepherd’s picture

Hi,
I'd be really interested to know if your simple tweet module has or will be updated for the new OAUTH twitter authentication?
I'm in agreement - the main twitter module (great though it is) is too heavy for my needs.
Matthew

cbovard’s picture

Hello Everyone,
Sorry about the delay. I am going to update as soon as I can.
This module uses the RSS feed that you can ping 150 times a day.

No OAuth

chris bovard
www.chrisbovard.com

rv0’s picture

subscribing

nice work.

josepvalls’s picture

subscribing

Dubber Dan’s picture

subscribing

Starting the long read through all the posts to see what it's latest feature set is and wondering if it might make sense to make this a module in it's own right so it's easy for others to find?

visitor82’s picture

steinmb’s picture

Version: 6.x-2.6 » 6.x-3.x-dev
Status: Active » Fixed

OAuth in not needed to read a twitter profile. All you need is to enable twitter module core, non of the other twitter sub modules.

dawansv’s picture

Also one can look at http://drupal.org/project/twitter_pull as an alternative to twitter module when all is needed is to pull site-wide data from twitter.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.