Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/Code)
 Twitter MOD version 2.0
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

iane87
Starting Member

USA
42 Posts

Posted - 07 October 2010 :  13:25:28  Show Profile  Visit iane87's Homepage  Reply with Quote
Twitter MOD 2.0 has been released. It now uses the new OAuth authentication method which is now required by Twitter. The Twitter MOD will automatically post a tweet to Twitter every time someone posts on your forum with a shortened link back to the page where the entire post can be viewed. Also, upon deletion of a Reply, Topic, Forum or Category the related tweets will also be deleted.

Database modification is required, but the set up script will take care of this automatically.

This MOD will greatly increase traffic to your site.

You may download the Twitter MOD version 2.0 from:

http://freesupport.fixonefree.com/topic.asp?TOPIC_ID=489&CAT_ID=12

If you do not wish to create an account to download this file you may log in as
Username: demo
Password: demo

However, please create your own account if you would like to post on our forums.

Twitter MOD | Search Provider MOD | W3C Valid RSS MOD | Google Translate MOD

Lon
Starting Member

USA
47 Posts

Posted - 30 October 2010 :  09:57:50  Show Profile  Reply with Quote
This MOD has my interest, however I think I may not have something setup correctly on my server. Any assistance would be appreciated.


ISSUE #1:
When I run http:\\mydomain.com\twittermod
I get the sign in with twitter, however when I press that link I get a popup window with this:

Server object error 'ASP 0178 : 80070005'

Server.CreateObject Access Error

/twittermod/oauth/cLibOAuth.Utils.asp, line 189

The call to Server.CreateObject failed while checking permissions. Access is denied to this object.


So I tried the same link on your example sites and it does bring up the correct popup window, so the issue is not with my local pc. Assuming the code is identical, that leaves permissions on my host server.


ISSUE #2:
The setup is not a typical mod setup where one would run from inside the forum, a direct run from twittersetup.asp, I received this error:

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near the keyword 'IF'.

/twittermod/twittersetup.asp, line 33
Go to Top of Page

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 30 October 2010 :  14:54:01  Show Profile  Reply with Quote
Save the following as "dbs_twitter.asp" and run from admin console:


Twitter Mod 2.0

[CREATE]
TWEETS

REPLYID#VARCHAR(10)#NOTNULL##
TOPICID#VARCHAR(10)#NOTNULL##
FORUMID#VARCHAR(10)#NOTNULL##
CATID#VARCHAR(10)#NOTNULL##
TWITTERID#VARCHAR(20)#NOTNULL##
[END]
Go to Top of Page

iane87
Starting Member

USA
42 Posts

Posted - 31 October 2010 :  23:00:51  Show Profile  Visit iane87's Homepage  Reply with Quote
Issue #1

This is a permissions issue on your server. However, I think we can work around it. I would recommend that you comment out or delete the following lines of code from /twittermod/oauth/cLibOAuth.Utils.asp

Dim objWshShell : Set objWshShell = Server.CreateObject("WScript.Shell")
			m_intOffsetMinutes = objWshShell.RegRead("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation\ActiveTimeBias")
			Set objWshShell = Nothing


What the above code does is gets the time offset in minutes from GMT for your time zone. So you will need to figure out what that will be for your time zone. For example I'm on Mountain time which is 7 hours from GMT. So I would multiply 7 * 60 which equals 420. You will need to calculate this number based on your time zone. For Mountain Time zone I would replace the above code with this.

m_intOffsetMinutes = 420


If you still have problems you can try logging in via my web site at
http://freesupport.fixonefree.com/twittermod/

Then just copy your token and token secret from there into TwitterMOD/twitter.asp and then make a post to test and see if the tweet is posted to twitter.

Issue #2

Looks like my old setup script does not work on Microsoft SQL server. I designed and tested it on a MySQL server.

I have now included dbs_Twitter.asp in the download from my site to ensure compatibility with all databases. (same link as above) Copy this file to your forum directory and run this file through the MOD setup in the admin section of your forum. You may also use the code Carefree posted as they are essentially the same.

Twitter MOD | Search Provider MOD | W3C Valid RSS MOD | Google Translate MOD

Edited by - iane87 on 31 October 2010 23:21:54
Go to Top of Page

Lon
Starting Member

USA
47 Posts

Posted - 01 November 2010 :  11:57:03  Show Profile  Reply with Quote
WOOT!!.. it's working...I guess I should have said I use MS SQL...

SOLVED Issue 1, I was able to log in on my server to Twitter, however it still does not issue the Oath Tokens from my system. I did use iane87's link and it worked. So you may still need to work on that part for others.

SOLVED Issue 2, thanks Carefree, that did the trick too.

--------------------------------------------------------
NOW>>>> Not really issues, more of How To's

Issue 3, How can I put in a filter to apply this to only a singel forum. I have a test/admin forum and a couple of private forums that should not be posted to Twitter.

Issue 4, The username is not posted on twitter, Is that by design?

Edited by - Lon on 01 November 2010 11:57:56
Go to Top of Page

iane87
Starting Member

USA
42 Posts

Posted - 01 November 2010 :  20:08:14  Show Profile  Visit iane87's Homepage  Reply with Quote
#3

To make the Twitter MOD post only when the Auth Type of the forum is All Visitors look for the following blocks of code and add the code I marked green.


<!--#INCLUDE FILE="TwitterMOD/twitter/twitter.asp" -->
<!--#INCLUDE FILE="TwitterMOD/ShortURL.asp" -->
<%
Dim blnTweet





if MethodType = "Edit" or _
MethodType = "EditTopic" or _
MethodType = "Reply" or _
MethodType = "ReplyQuote" or _
MethodType = "Topic" or _
MethodType = "TopicQuote" then
	if MethodType <> "Topic" then
		'## Forum_SQL - Find out if the Category, Forum or Topic is Locked or Un-Locked and if it Exists
		strSql = "SELECT C.CAT_STATUS, C.CAT_NAME, " &_
		"F.FORUM_ID, F.F_STATUS, F.F_TYPE, F.F_SUBJECT, F.F_TOPIC_AUTH, " &_
		"T.T_STATUS, T.T_AUTHOR, T.T_SUBJECT " &_
		" FROM " & strTablePrefix & "CATEGORY C, " &_
		strTablePrefix & "FORUM F, " &_
		strActivePrefix & "TOPICS T" &_
		" WHERE C.CAT_ID = T.CAT_ID " &_
		" AND F.FORUM_ID = T.FORUM_ID " &_
		" AND T.TOPIC_ID = " & Topic_ID & ""
	else
		'## Forum_SQL - Find out if the Category or Forum is Locked or Un-Locked and if it Exists
		strSql = "SELECT C.CAT_STATUS, C.CAT_NAME, " &_
		"F.FORUM_ID, F.F_STATUS, F.F_TYPE, F.F_SUBJECT, F.F_TOPIC_AUTH " &_
		" FROM " & strTablePrefix & "CATEGORY C, " &_
		strTablePrefix & "FORUM F" &_
		" WHERE C.CAT_ID = F.CAT_ID " &_
		" AND F.FORUM_ID = " & Forum_ID & ""
        end if
 
	set rsStatus = my_Conn.Execute(strSql)
	if rsStatus.EOF or rsStatus.BOF then
		rsStatus.close
		set rsStatus = nothing
		Go_Result fLang(strLangPost_Info00030), 0
	else
		blnTweet = rsStatus("F_TOPIC_AUTH")
		blnCStatus = rsStatus("CAT_STATUS")
		strCatTitle = rsStatus("CAT_NAME")
		blnFStatus = rsStatus("F_STATUS")
		Forum_ID = rsStatus("FORUM_ID")
		Forum_Type = rsStatus("F_TYPE")
		strForum_Title = rsStatus("F_SUBJECT")
		if MethodType <> "Topic" then
			blnTStatus = rsStatus("T_STATUS")
			strTopicAuthor = rsStatus("T_AUTHOR")
			strTopicTitle = rsStatus("T_SUBJECT")
		else
			blnTStatus = 1
		end if
		rsStatus.close
		set rsStatus = nothing
	end if






'## Twitter Mod ##
		if MethodType = "Topic" then
			strReturnURL = "topic.asp?TOPIC_ID=" & NewTopicID
			strReturnTxt = fLang(strLangPost_Info00770)
			strSql = "INSERT INTO " & strTablePrefix & "TWEETS (TOPICID, CATID, FORUMID, TWITTERID) VALUES ('" & NewTopicID & "', '" & Cat_ID & "', '" & Forum_ID & "', '"
		elseif MethodType = "Reply" or MethodType = "ReplyQuote" or MethodType = "TopicQuote" then
			strReturnURL = "topic.asp?whichpage=-1&TOPIC_ID=" & Topic_ID & "&REPLY_ID=" & NewReplyID
			strReturnTxt = fLang(strLangPost_Info00780)
			strSql = "INSERT INTO " & strTablePrefix & "TWEETS (REPLYID, TOPICID, CATID, FORUMID, TWITTERID) VALUES ('" & NewReplyID & "', '" & Topic_ID & "', '" & Cat_ID & "', '" & Forum_ID & "', '"
		elseif MethodType = "EditTopic" then
			strReturnURL = "topic.asp?TOPIC_ID=" & Topic_ID
			strReturnTxt = fLang(strLangPost_Info00780)
			strSql = "INSERT INTO " & strTablePrefix & "TWEETS (TOPICID, CATID, FORUMID, TWITTERID) VALUES ('" & Topic_ID & "', '" & Cat_ID & "', '" & Forum_ID & "', '"
		elseif MethodType = "Edit" then
			strReturnURL = "topic.asp?whichpage=-1&TOPIC_ID=" & Topic_ID & "&REPLY_ID=" & Reply_ID
			strReturnTxt = fLang(strLangPost_Info00780)
			strSql = "INSERT INTO " & strTablePrefix & "TWEETS (REPLYID, TOPICID, CATID, FORUMID, TWITTERID) VALUES ('" & Reply_ID & "', '" & Topic_ID & "', '" & Cat_ID & "', '" & Forum_ID & "', '"
		else
			strReturnURL = chkString(Request.Form("refer"),"refer")
			strReturnTxt = fLang(strLangBack_Forum00010)
		end if

		if blnTweet = 1 then
			Dim strTweetURL, strBitURL, strTweetID
			if instr(strTweetURL,"http") then 
				strTweetURL = strReturnURL
			else
				strTweetURL = strForumURL & strReturnURL
			end if
			strBitURL = " " & BitLy(strTweetURL)
			strTweetID = Tweet(mid(txtMessage, 1, 140 - Len(strBitURL)) & strBitURL)
			strSql = strSql & strTweetID & "')"
			my_Conn.execute(strSql)
		end if
		'## End Twitter Mod ##


#4

If you want to include member names in the posts you can change the following line of code. However, you are limited to 140 character posts with twitter. If the user has long username it can take up a good portion of your twitter post.

strTweetID = Tweet(mid(txtMessage, 1, 140 - Len(strBitURL)) & strBitURL)


to


strTweetID = Tweet(mid(txtMessage, 1, 138 - Len(strBitURL) - Len(strDBNTUserName)) & " " & strDBNTUserName & " " & strBitURL)

Twitter MOD | Search Provider MOD | W3C Valid RSS MOD | Google Translate MOD
Go to Top of Page

Lon
Starting Member

USA
47 Posts

Posted - 02 November 2010 :  00:13:08  Show Profile  Reply with Quote
Excellent... I really appreciate your help on these. Oh, I think the twitter jpg is missing from the zipfile of version 2, I pulled mine from the first version.

Solved Issue 3, I tried to do what you posted, however my system stopped updating twitter and it just said POSTED. So I hard coded it to using
If FORUM_ID = 3 then
This solved my request and no other mods to the code, thou not a overall solution.

Solved Issue 4, I ended up using
strTweetID = Tweet(strDBNTUserName & ": " & mid(txtMessage, 1, 138 - Len(strBitURL) - Len(strDBNTUserName)) & " " & strBitURL)

-----------------------------------------
Which leads me to

Issue 5, the BitUrl is not posting. They seem to be posting in the public area in the BitLy web site, so the problem is probably the return of data or the posting of it to twitter.
Go to Top of Page

iane87
Starting Member

USA
42 Posts

Posted - 02 November 2010 :  11:28:07  Show Profile  Visit iane87's Homepage  Reply with Quote
Oh yeah I think I forgot to add the twitter logo in the new version. I'll update that tonight.

#3 Just realized that my above code will only work if you are running another MOD for forum authentication.

Try this instead for private forums

<!--#INCLUDE FILE="TwitterMOD/twitter/twitter.asp" -->
<!--#INCLUDE FILE="TwitterMOD/ShortURL.asp" -->
<%
Dim blnTweet





if MethodType = "Edit" or _
MethodType = "EditTopic" or _
MethodType = "Reply" or _
MethodType = "ReplyQuote" or _
MethodType = "Topic" or _
MethodType = "TopicQuote" then
	if MethodType <> "Topic" then
		'## Forum_SQL - Find out if the Category, Forum or Topic is Locked or Un-Locked and if it Exists
		strSql = "SELECT C.CAT_STATUS, C.CAT_NAME, " &_
		"F.FORUM_ID, F.F_STATUS, F.F_TYPE, F.F_SUBJECT, F.F_PRIVATEFORUMS, " &_
		"T.T_STATUS, T.T_AUTHOR, T.T_SUBJECT " &_
		" FROM " & strTablePrefix & "CATEGORY C, " &_
		strTablePrefix & "FORUM F, " &_
		strActivePrefix & "TOPICS T" &_
		" WHERE C.CAT_ID = T.CAT_ID " &_
		" AND F.FORUM_ID = T.FORUM_ID " &_
		" AND T.TOPIC_ID = " & Topic_ID & ""
	else
		'## Forum_SQL - Find out if the Category or Forum is Locked or Un-Locked and if it Exists
		strSql = "SELECT C.CAT_STATUS, C.CAT_NAME, " &_
		"F.FORUM_ID, F.F_STATUS, F.F_TYPE, F.F_SUBJECT, F.F_PRIVATEFORUMS " &_
		" FROM " & strTablePrefix & "CATEGORY C, " &_
		strTablePrefix & "FORUM F" &_
		" WHERE C.CAT_ID = F.CAT_ID " &_
		" AND F.FORUM_ID = " & Forum_ID & ""
        end if
 
	set rsStatus = my_Conn.Execute(strSql)
	if rsStatus.EOF or rsStatus.BOF then
		rsStatus.close
		set rsStatus = nothing
		Go_Result fLang(strLangPost_Info00030), 0
	else
		blnTweet = rsStatus("F_PRIVATEFORUMS")
		blnCStatus = rsStatus("CAT_STATUS")
		strCatTitle = rsStatus("CAT_NAME")
		blnFStatus = rsStatus("F_STATUS")
		Forum_ID = rsStatus("FORUM_ID")
		Forum_Type = rsStatus("F_TYPE")
		strForum_Title = rsStatus("F_SUBJECT")
		if MethodType <> "Topic" then
			blnTStatus = rsStatus("T_STATUS")
			strTopicAuthor = rsStatus("T_AUTHOR")
			strTopicTitle = rsStatus("T_SUBJECT")
		else
			blnTStatus = 1
		end if
		rsStatus.close
		set rsStatus = nothing
	end if






'## Twitter Mod ##
		if MethodType = "Topic" then
			strReturnURL = "topic.asp?TOPIC_ID=" & NewTopicID
			strReturnTxt = fLang(strLangPost_Info00770)
			strSql = "INSERT INTO " & strTablePrefix & "TWEETS (TOPICID, CATID, FORUMID, TWITTERID) VALUES ('" & NewTopicID & "', '" & Cat_ID & "', '" & Forum_ID & "', '"
		elseif MethodType = "Reply" or MethodType = "ReplyQuote" or MethodType = "TopicQuote" then
			strReturnURL = "topic.asp?whichpage=-1&TOPIC_ID=" & Topic_ID & "&REPLY_ID=" & NewReplyID
			strReturnTxt = fLang(strLangPost_Info00780)
			strSql = "INSERT INTO " & strTablePrefix & "TWEETS (REPLYID, TOPICID, CATID, FORUMID, TWITTERID) VALUES ('" & NewReplyID & "', '" & Topic_ID & "', '" & Cat_ID & "', '" & Forum_ID & "', '"
		elseif MethodType = "EditTopic" then
			strReturnURL = "topic.asp?TOPIC_ID=" & Topic_ID
			strReturnTxt = fLang(strLangPost_Info00780)
			strSql = "INSERT INTO " & strTablePrefix & "TWEETS (TOPICID, CATID, FORUMID, TWITTERID) VALUES ('" & Topic_ID & "', '" & Cat_ID & "', '" & Forum_ID & "', '"
		elseif MethodType = "Edit" then
			strReturnURL = "topic.asp?whichpage=-1&TOPIC_ID=" & Topic_ID & "&REPLY_ID=" & Reply_ID
			strReturnTxt = fLang(strLangPost_Info00780)
			strSql = "INSERT INTO " & strTablePrefix & "TWEETS (REPLYID, TOPICID, CATID, FORUMID, TWITTERID) VALUES ('" & Reply_ID & "', '" & Topic_ID & "', '" & Cat_ID & "', '" & Forum_ID & "', '"
		else
			strReturnURL = chkString(Request.Form("refer"),"refer")
			strReturnTxt = fLang(strLangBack_Forum00010)
		end if

		if blnTweet = 0 then
			Dim strTweetURL, strBitURL, strTweetID
			if instr(strTweetURL,"http") then 
				strTweetURL = strReturnURL
			else
				strTweetURL = strForumURL & strReturnURL
			end if
			strBitURL = " " & BitLy(strTweetURL)
			strTweetID = Tweet(mid(txtMessage, 1, 140 - Len(strBitURL)) & strBitURL)
			strSql = strSql & strTweetID & "')"
			my_Conn.execute(strSql)
		end if
		'## End Twitter Mod ##


#5 You added another character to the tweet and twitter will cut you off after 140 characters so you need to adjust the code

strTweetID = Tweet(strDBNTUserName & ": " & mid(txtMessage, 1, 137 - Len(strBitURL) - Len(strDBNTUserName)) & " " & strBitURL)


If it is not posting the link at all make sure you updated shortURL.asp with your bitly username and API key.

To test the link shortenter put this in a file called test.asp in the TwitterMOD/twitter folder.

<!--#INCLUDE FILE="ShortURL.asp"-->
<%
response.write BitLy("http://fixonefree.com")
%>


If its working correctly you should see a shortened url appear.

Twitter MOD | Search Provider MOD | W3C Valid RSS MOD | Google Translate MOD
Go to Top of Page

Lon
Starting Member

USA
47 Posts

Posted - 02 November 2010 :  19:37:06  Show Profile  Reply with Quote
Sweet... Thanks for your help.. It's nice to have a MOD that is up with modern day trends.

I have not added a MOD in years, I like working with code.

The Delete part does not work for me yet, however it is not much of a concern at this moment. I'll get back to you on that when I'm ready to tackle that.

So far my users love it.
Go to Top of Page

iane87
Starting Member

USA
42 Posts

Posted - 03 November 2010 :  13:14:22  Show Profile  Visit iane87's Homepage  Reply with Quote
Glad you liked it.

Twitter changed the text that was returned and my code was no longer storing the Tweet ID correctly.

I updated the code again. If you download the MOD from my site again and replace the file /TwitterMOD/twitter/twitter.asp on your site the deletion of tweets will start working again.

Twitter MOD | Search Provider MOD | W3C Valid RSS MOD | Google Translate MOD
Go to Top of Page

Zenfor
Junior Member

372 Posts

Posted - 31 July 2012 :  16:27:50  Show Profile  Reply with Quote
quote:
Originally posted by iane87

Twitter MOD 2.0 has been released...


Is this still ok to install? What exactly does it do? I am getting more and more information via twitter and was looking for a good way to incorporate it to my forum. Thanks!
Go to Top of Page

iane87
Starting Member

USA
42 Posts

Posted - 31 July 2012 :  17:12:02  Show Profile  Visit iane87's Homepage  Reply with Quote
Yes it is ok to install. It will automatically tweet to twitter every time someone creates a new topic or replies to a topic. And it will also delete the tweet if that reply, topic, forum or category is deleted. If you have any problems let me know and i can help you get it working.

Twitter MOD | Search Provider MOD | W3C Valid RSS MOD | Google Translate MOD
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.18 seconds. Powered By: Snitz Forums 2000 Version 3.4.07