Closed (won't fix)
Project:
Twitter
Version:
5.x-1.x-dev
Component:
Code
Priority:
Critical
Category:
Task
Assigned:
Reporter:
Created:
3 Oct 2008 at 18:39 UTC
Updated:
7 Aug 2011 at 21:18 UTC
Jump to comment: Most recent file
I took the time to backport the current release of the twitter
module as it currently stands for Drupal 6 to Drupal 5. Obviously
this does not make use of Views the way that the d6 version makes
use of Views 2 but otherwise it's pretty much working the same as
a default install of twitter for d6 works.
I volunteer to try and maintain this d5 backport for the time being
if the developers want to add me to CVS for this project. In the
meantime I've attached a tarball of the files for use by others
and for the developer's eyes.
| Comment | File | Size | Author |
|---|---|---|---|
| #61 | twitter_mod.zip | 18.48 KB | dhroople |
| #57 | twitter_p.zip | 36.9 KB | dhroople |
| #41 | twitter.zip | 39.63 KB | moonray |
| #40 | twitter.zip | 40.11 KB | moonray |
| #33 | twitter-D5-33.zip | 15.29 KB | joachim |
Comments
Comment #1
Robin Millette commentedI'd like to see Drupal 5 still supported too. I tried your version but didn't get far not much time to look at the problem closely yet. I see the general twitter settings under admin, then the twitter tab under my user account, but the latter is empty. Glancing at the code, it seems twitter account info must be entered along with the new content, am I right?
I'll look at this further when I have a moment.
Unrelated, but I'm interested in adding identica/laconica support since that software also makes use of the twitter api. It shouldn't be too hard to make the module support any site using the twitter api. I also spoke to walkah and eaton about it and they were both glad to hear that.
Comment #2
stevebayerin commentedWorks but even though I set it to post only blog posts to twitter, the twitter modules has all node types checked when I create a new node (eg. page nodes on creation have post to twitter checked even though blog posts are the only posts meant to post to twitter.)
Comment #3
jaydub commented#2 yeah I just realized that the per node type settings don't work in the d6 version either which I based the backport on. The admin settings are there but there is no implementation of the per node type settings in the hook_form_alter implementation used to add the post to twitter form to node add pages.
I'll roll a new patch which that addition and submit the patch for the d6 version as well.
#1 yes a user that wants to use the drupal twitter module has to enter their twitter account details on their user profile page for the module to do anything.
Comment #4
jaydub commentedOk I've attached a small patch to the d6 version for checking the node type as well as reposting the tarball of the d5 version from above with the update for checking the node type.
Comment #5
Clint Eagar commentedI just installed the D5 module from post #4 and get this error when trying to add my twitter account.
Comment #6
jaydub commentedmissed that one from the d6 version...here's a replacement for twitter.inc
Rename this file from twitter.inc.patch to twitter.inc . This is NOT a patch
file but is the whole file. d.o. doesn't let you attach files that don't end
with certain extensions such as gz, patch, diff, etc...
Comment #7
jaydub commentedDisregard the file in #7 and use this one instead.
Comment #8
cogdog commentedThanks for the backport effort, but I am running into one problem after another, and am out of ideas. I have enabled creating twitter accounts in my user/roles setting and am trying for now just tweeting from a blog post
Problem #! - the last patch posted has an error on line 401 - it is missing a "}" before the "else" statement
Problem #2 - on a first test, my logs stated there was a missing twitter.js file in the modules/twitter folder. In total guess mode, I uploaded the twitter.js file from the 6.x version
Problem #3 - When I enter a twitter user name /password on the User /edit screen, the account never "sticks"- when I return to this editing page, the fields are blank, so it is looking like the account info is never stored (I have not yet peeked into the database). Statuses are never shown for the twitter tab on my account
Problem #4 - When I publish a new blog post, it says that it posted to Twitter, but the tweet never appears
I'd really like to avoid having to climb down into the code, but am at a wall as our site is not ready yet for 6.x
Thanks for any help, I really need this module!!
Update Not sure what I did (re-uploaded the twitter.inc file) but it is now working. except for problem #3- it still is not showing that an account is entered....
Comment #9
jaydub commenteddid you try entering the account details again after you re-added the twitter.inc file?
Comment #10
cogdog commentedYep, it happens every time I enter the account details; they never stick. The swapping of the twitter.inc file was on my dev server- I moved the clean files to my production server and it happens there. Am trying to follow the logic of the account fetching part to see where it is losing data. Is it meant to populate the form fields with default values of an existing account?
Comment #11
jaydub commentedare you able to check your logfiles for any possible PHP errors? It could be that there is a problem but if you have error reporting turned off or only shown in the logfiles that you are missing something. If you have the watchdog enabled maybe check that after trying again to see if any PHP errors show up.
I don't have any trouble myself but it's been awhile since I checked this out again. I'll try to remove my account and re-enter again to see that is stores ok.
Comment #12
jaydub commentedI just checked again and was able to remove my account and re-add it back successfully.
If anyone else following this issue can chime in if they have trouble...
Comment #13
jaydub commentedand it should go without saying but the account info you enter if for your Twitter account. If you don't enter the proper username/password then it won't work either.
Comment #14
cogdog commentedThanks for the efforts. Per your questions:
* There are no PHP errors, checked the apache error logs
* There is no problem entering the account information, it is all being correctly registered in the database tables for this module- I can see all the accounts, and the tweets are properly displayed for the account. There is, at least on my site, some problems with the part of the code that display the accounts.
* Account information is verified; I tested by giving wrong information, and it caught that error
I am an experienced PHP developers but still new at the drupal structure. I traced the steps with a lot of outputting of variable values and var_dumps of arrays. I finally got the display to work, with a bit of ugliness. What I found:
* twitter.module line 31: not sure why an array of a user id is passed; I just changed it to:
'callback arguments' => $user->uid* twitter.inc function twitter_get_user_accounts : simplified from arrays of a single id integer to
* The biggest mystery makes no sense but I confirmed it 5 times. In twitter_pages.inc function twitter_user_settings gets a correct value for the array of twitter accounts $twitter_accounts, but when it was passed to function twitter_account_list_form this value ended up as NULL. I could not make any sense of it, and ONLY got the display to list accounts by instead making this a global variable. It is an ugly way
I appreciate the efforts, and now at least my users when they create accounts will see them as listed.
Comment #15
jaydub commentedRegarding some of your comments:
The arguments must be in an array. See: http://api.drupal.org/api/function/hook_menu/5
specifically: "callback arguments": An array of arguments to pass to the callback function. "
This portion of the code is from the original authors and has not been changed for d5. The change you've made is not needed and in fact not the 'Drupal way'. The original code uses a placeholder for the user id (int) of %d. The array of the user id is passed to the query function and the %d is replaced with the value.
This is the standard Drupal query method. See: http://api.drupal.org/api/function/db_query/5
specifically: User-supplied arguments to the query should be passed in as separate parameters so that they can be properly escaped to avoid SQL injection attacks.
NOW that being said, I did find a couple problems that I think I've resolved. They were due to subtle changes in the port from the d6 version to d5 that were overlooked.
Please try using the attached files and reserve the two changes you made that are referenced above. Just remove the .txt extension to use.
Comment #16
cogdog commentedThanks so much, your changes work perfectly in my D5 sites!
I am still learning the "drupal way" and was just hacking to get the code to work. Very much appreciate the quick responses.
Comment #17
Boinng commentedThanks for all the work backporting, it's a shame 5.x isn't getting better support - I've installed this with the various patches above and it seems to be working for the most part (I can add my twitter account, have my tweets on my profile page, and send a tweet when creating a new story etc.
The biggest problem so far is that enabling the module for posting from any new content (eg story, forum topic, blog etc) seems to break the "create content" form's javascript for anyone who does NOT have their Twitter account setup (IE gives the "Done with errors" message, and the various options links dont work). I know very little about JS, but what appears to be happening is the twitter.js file is loading whether the user uses Twitter or not - if they do, then all form elements work fine, but if they don't then the JS doesn't tie up with the form and it all gets broken. Does that make any sense, and is their a simple fix, or is this something peculiar with my site?
Comment #18
cogdog commentedI cannot replicate what you describe in my site; on my test account that has not set up a twitter account, all of my content creation forms work w/o error in Firefox and MSIE.
That likely does not help you identify your problem, but it seems at least from my one site to be something about yours.
Comment #19
adub commentedCouldn't get it to work and hacked around found a couple of things:
1. Passwords hadn't been stored (possibly because I set the accounts up with an early version here)
2. this section at line 140 twitter.inc twitter_set_status() - needs to be removed/commented out:
I also changed the functionality to post to the currently logged in user's twitter account rather than the author's - so for example an editor of a multi-author blog can post selected items to a twitter account for that blog (e.g. for a magazine site etc.):
In twitter.module twitter_nodeapi()
Comment #20
duckjerk commentedI am having the same issue as cogdog but mine still doesn't seem to work. I my accounts don't seem to stick this is what my account page looks like. Thanks for your help.
Comment #21
jaydub commentedRegarding #19, why did you need to make the change you outlined in 2)??
As for the other change you made in twitter_nodeapi(), that's up to you. The D5 backport is meant to reflect what is in the D6 module only. But if it works for your needs then go for it!
Comment #22
adub commented@jaydub It didn't appear on twitter with that code in but did when I commented it out. I didn't dig in to find out why so this is just a bit of hacking but might be a starting point if anyone else has the same problem.
Comment #23
FatPitchFinancials commentedThanks for backporting this module to Drupal 5. I ran into two issues after installing the latest version of this backport.
1. The profile Twitter tab does not appear publicly. It seems to only be visible to the user that added the Twitter account. I would like my users to browse each other's tweets. How do I do that?
2. The output of the Tweets page does not have hyperlinks or @names hyperlinked. I noticed in the module code there is a function that is suppose to do this, but it doesn't appear to be working.
On a positive note, when new nodes are added, the titles and urls are posted to Twitter. However, I had to change the default tweet format, since it enclosed the !url in parentheses link (!url) and that trailing ) would get added to the link and cause it to break. I suggest changing the default in the next version of this module to leave out the problematic parentheses.
Finally, has anyone tried to integrate this with Views 1. I would really like to create a page displaying the latest tweets of all the users on my site. Thanks.
Comment #24
sinmao commentedI can't find the twitter login/pw anywhere in the user profile page (user/1/edit). I have twitter checked for authenticated users in user roles section too. Applied the latest version on post #15. I renamed "twitter.pages_.inc_.txt" to "twitter.pages.inc". Is that right?
Comment #25
SimonV commentedSame issue as above. I see the Twitter tab, but I see nothing after I click that tab. I had a db error when I first went to that page and had to create the tables manually.
Comment #26
funana commented@sinmao you probably forgot to put all needed files into the /twitter module folder.
I repacked all needed files into the attached archive. Works like a charm on my D5 site.
How do we get it to work with Views now? Would be great to use the tweets in Views!
Comment #27
funana commentedYeah, that's something I miss too. Tried to add 'access' => user_access('access content'), but did not work...
Wohaa, that would be a great feature! How to fix this?
Comment #28
webchickMarking needs review, since this is a patch.
Comment #29
mdowsett commentedthe tarball in #26 worked for me....but only after knowing to go to user/1/edit/twitter to enter my Twitter account info. There was no additional tab in my user edit page to get to it.
Is it just me (my theme?) or is it a bug for every one? My general users would have no idea to go there to add their Twitter account info...
Comment #30
mdowsett commentedI switched my theme back to Garland and I couldn't get to it either....must be a bug then.
Comment #31
jasonflenniken commentedthe hyperlinks are implemented as a filter hook.
make sure you go to site config->input filters, and for any enabled filters go into their config and make sure the 2 twitter filters defined there are checked/enabled.
Comment #32
joachim commentedTried the tarball in #26.
- as mentioned above, 'user/UID/edit/twitter', doesn't show as a tab. This happens if profile module isn't installed or if there is only one profile field category. See line 835 of user.module. We should really add $category['name'] == 'account' as a MENU_DEFAULT_LOCAL_TASK
- also, I don't understand the UI here once an account has been entered. The form below the listed account is blank -- does that mean that entering a username here adds a second account? If so, how do I change the username of the existing one? Or can I only delete it?
- You're missing a hook_update_N, or documentation to say that the module needs to be reinstalled... I had previously installed the 5-dev version and that doesn't create any tables, so once I unpacked the files from the tarball I got error messages about tables.
- 'title' => t('Twitter setup'), -- 'setup' is redundant here. We're in the configuration menu already.
- there is no way for an admin user to set up a twitter account for someone else, because of the way hook_menu checks the user id. I don't know if this is a missing feature in 6 too though -- but I know a site admin is bound to say to me "I have a user who can't set his twitter account up and I can't get in to do it for him"
- hook_form_alter: only require twitter.inc if we need to do something.
- twitter_link_filter: I don't think it's good form to call this once with defaults and once without. Defaults should be a null case, rather than something that has meaning like filtering the @usernames. THough again, 6 might do this, I don't know.
Works nicely once set up.
Minor fixes needed but it would be nice if a maintainer could commit this and then we can submit minor patches.
Comment #33
joachim commentedHere's an updated version of that zip with a few fixes I've made:
- set page title when editing an account (otherwise for an account not your own, you just get "user".
- fix tabs not showing when profile module not installed or has no categories.
- allow admins to edit twitter settings of other accounts.
- the side-effect is that this also allows tweets of other users to be seen in the user account tabs. I don't know if that's desirable or not, but a simple access check can restore current behaviour where you can only see your own tweets.
Comment #34
joachim commentedOne fix to the above:
The call to get the twitter_add_account form should be:
for reasons I can't fathom... seems that the 2nd param gets eaten somewhere and the form builder only sees param 3.
Also, a bug: trying to add a twitter account that doesn't exist produces LOTS of ugly XML error messages. It should instead just give a human-readable warning.
Comment #35
twirlingsky commentedsubscribing
Comment #36
plan9 commentedJust wanted to say thanks to everyone who's contributed to this backport,
great work guys - and it's good to see 5.x still being supported.
There are lot's of us still unable to make the leap to 6
Keep up the good work!!!
G
Comment #37
lunarbear commentedsubscribing
Comment #38
moonray commentedDid anyone backport the twitpocalypse patch yet?
Comment #39
ambereyes commentedsubscribe
Comment #40
moonray commentedHere's an updated version with the "twitpocalypse" patch.
Comment #41
moonray commentedSorry, use this archive instead.
It differs slightly from #33. There is also an additional block which adds a feed from the twitter feed of user 1. This can be used if you want to have a twitter feed displayed on your site as the "official" twitter feed.
If you want just the "twitpocalypse" fixes, all you need is the updated twitter.inc file and the updated twitter.install file.
Comment #42
Taliesan commentedNVM - Found what I was after.
Comment #43
funana commentedThank you very much moonray. Very appreciated. Keeping the D5 version alive :)
Comment #44
taqwa commentedsubscribing. love you guys...
Comment #45
taqwa commentedI installed the version from #41 on my site. Here are the issues I'm currently having:
1) I created a brand new twitter account. I then signed in as a user on my site (not admin) and visited the edit/twitter page. After entering the twitter account info the image under the name field fails to load.
2) I disabled importing tweets from the admin account through the Twitter setup page. However, for my non admin user, import is checked by default. I think it makes more sense for that option to disappear when importing is disabled. On my site I would like for users to only be able to post their submissions as tweets.
3) I don't see the option for a user to enable posting his or her submission on twitter. I thought it was an access control issue but all I see on that page is "Add Twitter account". Ideally, I think this option should be on the edit/twitter page.
Thanks for the hard work you guys have put into this so far. I imagine the issues I'm bringing up are simple tweaks/explanations for those of you who are already familiar with this module. If not, I'll take a dive into the code and see if I can figure out what's going on.
Comment #46
joachim commentedCould either of the maintainers either commit one of the above patches or appoint someone to maintain the D5 branch please? It's starting to get too complicated keeping track of the changes.
Comment #47
sinasalek commentedSubscribed...
Comment #48
wflorian commentedLike Joachim already said: Could one of the maintainer commit the above patches to the D5 brach please?
Everybody else: Thank you for keeping up the work on the D5 release of this module!
Comment #49
sinasalek commentedYes, please commit it.
Comment #50
dandaman commentedFolks, the current status says "needs review". If you have adequately reviewed and tested the code, I believe it is protocol to change it to "reviewed and tested by the community". That may be what the current developers are expecting to see before they come in, review the issue and the code and then commit the code.
I may be wanting to use this code for a client on 5.x, so I may be reviewing the code myself if you don't get to it. Thanks!
Comment #51
plan9 commentedI'm getting cron killed by these errors:
SimpleXMLElement::__construct() [function.SimpleXMLElement---construct]: ^ in /var/www/vhosts/site.net/httpdocs/sites/all/modules/twitter/twitter.inc on line 439.
Can we please have this fix in the D5 backport? http://drupal.org/node/550154
Thanks
G
Comment #52
joachim commented> Folks, the current status says "needs review". If you have adequately reviewed and tested the code, I believe it is protocol to change it to "reviewed and tested by the community".
Every module maintainer has their own view of how much testing is enough for a patch. I wouldn't want to presume.
It would be nice to get some sort of sign of life from the maintainers. Both are active in Drupal, but perhaps this module has fallen down their list of priorities. Perhaps someone could ping them on IRC? Or perhaps one of the above commenters could volunteer to maintain the D5 branch?
Comment #53
plan9 commentedThe patch here appears to fix the SimpleXMLElement errors: http://drupal.org/node/475924#comment-1796718 I added the lines manually and the errors have stopped.
Comment #54
plan9 commentedThe SimpleXMLElement errors patch doesn't work.
Comment #55
funana commentedSimpleXMLElement errors patch doesn't work, seems to be a problem with watchdog. How to in D5?
Edit: Sorry, had a typo in code, applied and works. At least the cron runs without errors.
Comment #56
joachim commentedI've requested a maintainer be appointed for the 5 branch: http://drupal.org/node/571414
any volunteers?
Comment #57
dhroople commentedHere is the 5 version It is not able to post to twitter ?
Comment #58
dhroople commentedSoloution needed for above
Comment #59
plan9 commentedI also confirm that this backport has stopped working. I'm using the version posted with comment #41 and tweets are no longer posted. What a shame :(
Recently upgraded to Drupal 5.20 maybe this has relevance?
Comment #60
dhroople commentedHere is the modified version of twitter 5 from #57. It is able to post on twitter but the problem is that only from user 1. Other users post are not posted to twitter. Please provide the soloution and revert back the version to community to get it work better.
Comment #61
dhroople commentedthis is the attachment for above
Comment #62
rkdesantos commentedI'm getting a cron error with the version in #61:
Comment #63
rkdesantos commentedStill having the same problem as noted in #62. Also, any response to request in #56 by @joachim?
Comment #64
rkdesantos commentedHas this effort been abandoned?
Comment #65
plan9 commentedAnyone willing to do an updated D6 backport? I'm no coder but would be happy to test stuff and report back.
Comment #67
michaek commentedComment #68
antiyouth commentedThanks, michaek, for the updated backport.
I'm trying to get this module to work on a client site running 5.19. I've installed the module, but I'm not seeing anywhere to edit my twitter account settings when I look for it on my user account edit page. So as of yet, I haven't figured out to enter my twitter username/password combo. I wonder if I need the Oath module, which at first blush doesn't seem to be available for Drupal 5.x. Any ideas?