Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: SA™ on May 09, 2011, 03:24:34 AM

Title: [WIP] SA Twitter Integration
Post by: SA™ on May 09, 2011, 03:24:34 AM
my latest mod

once installed creat an app on twitter
https://dev.twitter.com/apps/new

Application Website: your site url

Callback URL: website url plus ?action=twitter
example
http://siteurl/index.php?action=twitter

fill in the other stuff then once you have done that and got your keys
goto twitter admin and add your keys

feedback good or bad is appretiated

http://custom.simplemachines.org/mods/index.php?mod=3055
Title: Re: [WIP] SA Twitter Integration
Post by: Masterd on May 09, 2011, 06:40:30 AM
This is nice. Keep up the good work. :)
Title: Re: [WIP] SA Twitter Integration
Post by: SA™ on May 09, 2011, 01:58:34 PM
thanks Masterd
Title: Re: [WIP] SA Twitter Integration
Post by: SA™ on May 10, 2011, 01:14:36 PM
package update fixed many errors and added admin panel

live demo
http://www.sa-mods.info/index.php
Title: Re: [WIP] SA Twitter Integration
Post by: SA™ on May 11, 2011, 02:25:03 AM
wow two days and one reply no one interested in this? or am i just being ignored :(
Title: Re: [WIP] SA Twitter Integration
Post by: Dreko on May 11, 2011, 03:08:46 PM
Exelent!
Title: Re: [WIP] SA Twitter Integration
Post by: SA™ on May 15, 2011, 02:11:59 AM
any body else writes a mod and people are on it like flys around s*** i write a mod and get ignored what gives?

it sure makes me think why the helll do i bother

/me gives up

Title: Re: [WIP] SA Twitter Integration
Post by: DoctorMalboro on May 15, 2011, 12:47:18 PM
Excelent mod. I tried to wrote something like this many times, but OAuth beat me... You are a hell of a coder to make this effort and give it for free...

Most people won't thank you because, well, the world is selfish. So, thank you for sharing and I hope to see it out of the wip soon... ;)
Title: Re: [WIP] SA Twitter Integration
Post by: Matthew K. on May 15, 2011, 12:55:56 PM
DoctorMalboro is right. Most people don't appreciate what people contribute and take it for granite, which is why I think most modders who write big mods eventually move to paid mods to at least regain something from donating so much time and effort into big projects.

Keep up the good work SA!
Title: Re: [WIP] SA Twitter Integration
Post by: SA™ on May 15, 2011, 01:00:46 PM
thanks guys :)
Title: Re: [WIP] SA Twitter Integration
Post by: ~DS~ on May 15, 2011, 01:23:37 PM
I am there SA, you know it. ;)
Title: Re: [WIP] SA Twitter Integration
Post by: SA™ on May 15, 2011, 02:03:41 PM
 :D
Title: Re: [WIP] SA Twitter Integration
Post by: Douglas on May 18, 2011, 02:35:39 AM
Didn't go as planned, files are not going into the right directory.  After I manually moved Twitter.php to the correct directory, gave me the white screen of death.

Will have to delete all files and DB (kind of annoyed, but it wasn't a production site) and reload the forums from scratch.

You need to check your coding/installation package.  I really want this integration, as it would allow me to ditch WordPress.  :D
Title: Re: [WIP] SA Twitter Integration
Post by: ~DS~ on May 18, 2011, 06:45:17 AM
Fancy seeing you here, Douglas. I'm beta testing this, and don't have this issue. It's still WIP so there might be bugs...
Title: Re: [WIP] SA Twitter Integration
Post by: SA™ on May 18, 2011, 07:45:40 AM
i have tried this on sevaral sites myself and have not had that problem ive even got it on my live site with no problems
ill do more testing later with it
Title: Re: [WIP] SA Twitter Integration
Post by: Douglas on May 18, 2011, 11:20:15 AM
To be fair, I also did a small update from RC4 to RC5 before doing the package installation.  I'm gonna go ahead and blow out the forum install and do a fresh one and then try to do the upgrade again.

I should note that I didn't see the key/secret variables in the {$smf}_settings table, only the enabled one.  (Can you tell just how much I want this working?  HAH!)
Title: Re: [WIP] SA Twitter Integration
Post by: SA™ on May 18, 2011, 12:46:59 PM
there is no default setting for key/secret variables so it wont show in your db untill you add the keys

im using updateSettings() to install default settings but it seems to overwrite the settings each time you reinstall so i took the default settings for the keys out
Title: Re: [WIP] SA Twitter Integration
Post by: Douglas on May 18, 2011, 01:36:28 PM
Okay, same exact errors on a brand new RC5 installation (no other mods installed).

QuoteNotice: Undefined index: tw_app_id in /home/gh/public_html/forums/Sources/Twitter/TwitterHooks.php on line 30

Notice: Undefined index: tw_app_key in /home/gh/public_html/forums/Sources/Twitter/TwitterHooks.php on line 31

Warning: require_once(/home/gh/public_html/forums/twitterauth/lib/Twitter.php) [function.require-once]: failed to open stream: Not a directory in /home/gh/public_html/forums/Sources/Twitter/TwitterHooks.php on line 191

Fatal error: require_once() [function.require]: Failed opening required '/home/gh/public_html/forums/twitterauth/lib/Twitter.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/gh/public_html/forums/Sources/Twitter/TwitterHooks.php on line 191

What's interesting is that the installation package created a 0 byte file called "lib" in the "twitterauth" directory.  This means that "Twitter.php" is not going into the right directory (it placed it in the Sources/Twitter folder.

UPDATE:  Got the dreaded white screen again.  When I "breaK" TwitterHooks.php by leaving an unclosed comment, the page loads up (albeit with an error message)

The culprits seem to be on
   $consumer_key = $modSettings['tw_app_id'];
   $consumer_secret = $modSettings['tw_app_key'];

It's important to note that when I have those enabled or commented out completely that I get the WSOD.

Also, I went to your site and was going to sign up via my Twitter account, however, it still asked me for a username, email, etc etc.  This needs to be seamless for people.  :)

(Again, if you can get this working properly, severa people would be extremely grateful, including myself. If it works EXACTLY as intended, I may implement this on Hogville.)
Title: Re: [WIP] SA Twitter Integration
Post by: SA™ on May 20, 2011, 01:26:33 AM
QuoteAlso, I went to your site and was going to sign up via my Twitter account, however, it still asked me for a username, email, etc etc.  This needs to be seamless for people.

you can not get the users email with twitter api
password is for secrity
and name well explains it self :P

anyway you only need to do this once any logins after that are seamless

QuoteUPDATE:  Got the dreaded white screen again.  When I "breaK" TwitterHooks.php by leaving an unclosed comment, the page loads up (albeit with an error message)

can you try it now i just updated the package?
Title: Re: [WIP] SA Twitter Integration
Post by: Douglas on May 20, 2011, 09:35:49 PM
Okay, the WSOD error was a PEBCAK error on my part.

One thing that needs to be fixed in your integration is that every time I log in via my Twitter account, it asks me to authorize the app. It should only take me to that screen once, on registration.

Getting there. :)
Title: Re: [WIP] SA Twitter Integration
Post by: ~DS~ on May 21, 2011, 12:47:20 AM
Quote from: Douglas on May 20, 2011, 09:35:49 PM
One thing that needs to be fixed in your integration is that every time I log in via my Twitter account, it asks me to authorize the app. It should only take me to that screen once, on registration.
Not sure about this, this could be the limit or how twitter does in their API for authentication. Added to the tracker.
Title: Re: [WIP] SA Twitter Integration
Post by: SA™ on May 21, 2011, 02:58:30 AM
fixed seem i was always sending user to

http://twitter.com/oauth/authorize
all the time instead of just once

had to modify the api to make it work as it should
to go to
http://twitter.com/oauth/authenticate


Quote from: Douglas on May 20, 2011, 09:35:49 PM
Okay, the WSOD error was a PEBCAK error on my part.

One thing that needs to be fixed in your integration is that every time I log in via my Twitter account, it asks me to authorize the app. It should only take me to that screen once, on registration.

Getting there. :)
Title: Re: [WIP] SA Twitter Integration
Post by: FlipPro on May 24, 2011, 01:12:00 PM
I am adding this to my site TWEETFORUM.COM . I am looking for even better twitter integration, I want hashtags and @mentions to automatically link back to twitter, i want to be able to use @in the forums and have it plugin to either the users profile/ or twitter. The user should be able to self define the option they want when someone mentions their name. And I also want people to have the ability to tweet out/in from inside their profile, (i already have it set to tweet out each topic) SA I have worked with you in the past for MoneyMakerForums, and I am willing to beta test/ and work with you HARD. Lets get to work.
Title: Re: [WIP] SA Twitter Integration
Post by: ~DS~ on May 24, 2011, 01:17:50 PM
The @Anywhere feature is being worked on.
Title: Re: [WIP] SA Twitter Integration
Post by: FlipPro on May 24, 2011, 01:48:24 PM
By who? I also want to have a rewriter engine, that automatically rewrites popular phrases and hastags, and @s. I was going to use the censor feature to do this but it is going to have problems if i try to add a link back twitter when converting the words.

edit: didn't realize you were working with him V. I guess you meant you and him are working on it. Thank you sir, I am going to be installing your mod today, and start playing with it. I know I am going to have to learn alot more about the twitter API in order to make this forum into the one that it has potential to be.
Title: Re: [WIP] SA Twitter Integration
Post by: ~DS~ on May 24, 2011, 03:46:42 PM
You can however use my tutorial for @Anywhere hover card in the meantime.

http://www.simplemachines.org/community/index.php?topic=374284.msg2567139#msg2567139
Title: Re: [WIP] SA Twitter Integration
Post by: FlipPro on May 24, 2011, 06:24:03 PM
i have 1.13  :(
Title: Re: [WIP] SA Twitter Integration
Post by: SA™ on May 25, 2011, 12:33:21 AM
this is for smf2 only

package updated

fixed Undefined index: tw_app_api
fixed twitter messing up boardindex
fixed missing text strings
Title: Re: [WIP] SA Twitter Integration
Post by: Douglas on May 25, 2011, 01:55:19 PM
Quote from: SA™package updated
fixed Undefined index: tw_app_api
fixed twitter messing up boardindex
fixed missing text strings
Glad I didn't install .3 then, haha!  I'll test it out today. :)
Title: Re: [WIP] SA Twitter Integration
Post by: Douglas on May 28, 2011, 10:24:17 AM
Looks like it's working, as intended.  Nice work, guys (and thanks!)
Title: Re: [WIP] SA Twitter Integration
Post by: SA™ on May 31, 2011, 03:31:33 PM
ok secrity update package updated

id advise to any using to update your copy asap

big thanks to
Bobomaster for spotting this issue
Title: Re: [WIP] SA Twitter Integration
Post by: SA™ on June 16, 2011, 02:33:42 PM
package updated for smf2.0
Title: Re: [WIP] SA Twitter Integration
Post by: tabletsdroid on June 17, 2011, 03:58:39 AM
this is great SA! just what ive been looking for. after reading Douglas' comment though, I think im going to hold back a while before installing.
Title: Re: [WIP] SA Twitter Integration
Post by: ~DS~ on June 17, 2011, 09:31:58 AM
Quote from: tabletsdroid on June 17, 2011, 03:58:39 AM
this is great SA! just what ive been looking for. after reading Douglas' comment though, I think im going to hold back a while before installing.
He just said it was working. ???
Title: Re: [WIP] SA Twitter Integration
Post by: tabletsdroid on June 18, 2011, 10:10:44 PM
Quote from: ~DS~ on June 17, 2011, 09:31:58 AM
Quote from: tabletsdroid on June 17, 2011, 03:58:39 AM
this is great SA! just what ive been looking for. after reading Douglas' comment though, I think im going to hold back a while before installing.
He just said it was working. ???

so he did!
Title: Re: [WIP] SA Twitter Integration
Post by: Apllicmz on July 08, 2011, 02:59:02 AM
Yes thank you
Work Fine
Translate in portugues done




Edit ....Api
How can resolv that error
thank you
Title: Re: [WIP] SA Twitter Integration
Post by: twitter on July 08, 2011, 04:32:08 AM
A newbie question. Where can I download this mod from?
Title: Re: [WIP] SA Twitter Integration
Post by: ~DS~ on July 08, 2011, 10:46:36 AM
Quote from: twitter on July 08, 2011, 04:32:08 AM
A newbie question. Where can I download this mod from?
First post of this topic?
Title: Re: [WIP] SA Twitter Integration
Post by: twitter on July 08, 2011, 12:13:48 PM
Hasnt the package been updated a couple of times since then?
Title: Re: [WIP] SA Twitter Integration
Post by: twitter on July 10, 2011, 03:49:40 PM
Guys is this MOD production ready? I really love the mod but I am seeing a significant performance degradation after installing this mod. The minute I uninstall this mod the performance goes back up. Am I doing something wrong?

Here is what I have done:

1. Vanilla Installed SMF 2.0
2. Installed Pretty URL and RSS Feeder MODS.
3. Installed SA Twitter Mod.

Title: Re: [WIP] SA Twitter Integration
Post by: AD/vh on July 29, 2011, 06:57:45 PM
Hi,

I LOVE that you've done this, I can't wait to try it out... BUT.  The setup page in the admin section asks for the consumer key, consumer secret, and API key.  There's nothing in the app setup area on Twitter labeled "API Key", and the dev forum people are saying that the consumer key IS the api key.  If this is the case, I'm thinking the admin page ought to say so, otherwise it's reeeeeally confusing for those of us who are less than clueful...  and if it's NOT what I'm supposed to enter, where am I going wrong?
Title: Re: [WIP] SA Twitter Integration
Post by: nolageek on September 23, 2011, 05:24:12 PM
Any way to get this working in 1.1.*? :)
Title: Re: [WIP] SA Twitter Integration
Post by: ~DS~ on September 24, 2011, 01:07:00 AM
Quote from: nolageek on September 23, 2011, 05:24:12 PM
Any way to get this working in 1.1.*? :)
No, I don't think anyone will backport to 1.1 series. 2.0 is already official out, you might want to upgrade.
Title: Re: [WIP] SA Twitter Integration
Post by: nolageek on September 26, 2011, 11:41:44 AM
I can't because I need a module that's only available for 1.1.* (Mailing List) - such is the problem with having two supported versions. :)
Title: Re: [WIP] SA Twitter Integration
Post by: BPLive on October 07, 2011, 05:46:58 AM
Thanks for the mod SA.

I have fb mod working nicely also.  but twitter seems more confusing... especially for current members.   If a member clicks 'login with twitter'......  ok you sign into twitter but then it brings you to  'Register Twitter'  <<<  what the heck does that suppose to mean?  therefore I and other people fill in something and it registers a whole new name.  because people don't know that they have to click to their profile to sync up twitter.  Therefore it should be explained on that  'Register Twitter'  page to not sign up for an account better with directions for profile sync.    Strange.    FB mod people understand better.

Get what I'm saying? 

PS. I left a FB error log issue at your site forum for days that I'd like at least an answer to  :)  thanks.
Title: Re: [WIP] SA Twitter Integration
Post by: BPLive on October 14, 2011, 07:08:55 AM
Quote from: BPLive on October 07, 2011, 05:46:58 AM
Thanks for the mod SA.

I have fb mod working nicely also.  but twitter seems more confusing... especially for current members.   If a member clicks 'login with twitter'......  ok you sign into twitter but then it brings you to  'Register Twitter'  <<<  what the heck does that suppose to mean?  therefore I and other people fill in something and it registers a whole new name.  because people don't know that they have to click to their profile to sync up twitter.  Therefore it should be explained on that  'Register Twitter'  page to not sign up for an account better with directions for profile sync.    Strange.    FB mod people understand better.

Get what I'm saying? 

PS. I left a FB error log issue at your site forum for days that I'd like at least an answer to  :)  thanks.

Still 0 support on this here and in SA Forum for weeks now.   I have the same issues with FB and Twitter in Error log show Critical error:

Apply Filter: Only show the error messages of this URL
http://www.mysite.com/index.php/topic,27799.0.html
The database value you're trying to insert does not exist: current_board
Function: get_boards
File: /home/cd/public_html/forum/Sources/Twitter/TwitterHooks.php
Line: 304


using  SMF 2.0.1
Simple Portal 2.3.3

how my forum is in the /forum dir and the above has the URL as http://www.mysite.com/index.php/topic,27799.0.html without forum dir.  Just don't know how to fix this.
Title: Re: [WIP] SA Twitter Integration
Post by: Ascot on November 21, 2011, 12:27:36 PM
2 questions.
1st where do i get my Api Key?, because it doesn't shows up on my Api details
2nd  is there a code i can use to show a Login button on my current index-template ?

Thanks in advance :)
Title: Re: [WIP] SA Twitter Integration
Post by: ~DS~ on November 21, 2011, 01:19:55 PM
Quote from: Ascot on November 21, 2011, 12:27:36 PM
2 questions.
1st where do i get my Api Key?, because it doesn't shows up on my Api details
2nd  is there a code i can use to show a Login button on my current index-template ?

Thanks in advance :)
1- OAuth settings: Consumer key
2- Like Facebook, there hopefully will be hook.
Title: Re: [WIP] SA Twitter Integration
Post by: SA™ on November 21, 2011, 01:42:52 PM
there is a function to call in next version to show the login button
the api key isnt needed any more you can leave that
Title: Re: [WIP] SA Twitter Integration
Post by: ~DS~ on November 21, 2011, 01:51:58 PM
Quote from: SA™ on November 21, 2011, 01:42:52 PM
there is a function to call in next version to show the login button
the api key isnt needed any more you can leave that
They rename API Key to Consumer key, I think.

Yep. https://dev.twitter.com/discussions/615 ;)
Title: Re: [WIP] SA Twitter Integration
Post by: SA™ on November 21, 2011, 02:14:08 PM
aha thanks for that i wonderd where it went cos @anywhere uses api key
Title: Re: [WIP] SA Twitter Integration
Post by: Ascot on November 21, 2011, 04:23:11 PM
but there's a field for Consumer Key and one for Api key.
Besides that, it works Anyways.

So you say, i'll be able to use login button on mod's next version? or did i misunderstand you?

Thanks 4 your answers  :)
Title: Re: [WIP] SA Twitter Integration
Post by: SA™ on November 21, 2011, 04:36:34 PM
yes cos when i first coded this mod there was an api key but now there isnt consumer key is now the api key aswell besides the api key isnt realy hooked up to anything it was just a start on adding @anywere

QuoteSo you say, i'll be able to use login button on mod's next version? or did i misunderstand you?

correct your be able to call it like so
show_twitter_login(); in the next realse
Title: Re: [WIP] SA Twitter Integration
Post by: Ascot on November 21, 2011, 09:11:00 PM
ok, thank you for the answer :]
Title: Re: [WIP] SA Twitter Integration
Post by: Nitesh Kunnath on March 03, 2012, 08:05:23 AM
Will this mod work fine with Enotify ? will it conflict ?
Title: Re: [WIP] SA Twitter Integration
Post by: SA™ on March 03, 2012, 03:10:51 PM
yes it will your just have to apply this fix
http://www.sa-smf.com/community/index.php?action=kb;area=article;cont=39
Title: Re: [WIP] SA Twitter Integration
Post by: Nitesh Kunnath on March 04, 2012, 04:36:36 AM
Quote from: SA™ on March 03, 2012, 03:10:51 PM
yes it will your just have to apply this fix
http://www.sa-smf.com/community/index.php?action=kb;area=article;cont=39
Thank you :)