[ABD] Twitter Auto Tweeter - 0.0.1

Any abandoned MODs will be moved to this forum.

WARNING: MODs in this forum are not currently being supported or maintained by the original MOD author. Proceed at your own risk.
Forum rules
IMPORTANT: MOD Development Forum rules

WARNING: MODs in this forum are not currently being supported nor updated by the original MOD author. Proceed at your own risk.
tbxn
Registered User
Posts: 7
Joined: Mon Aug 24, 2009 3:16 pm

Re: [BETA] Twitter Auto Tweeter - 0.0.1

Post by tbxn »

Thanks for all the code tweaks. Hopefully the mod author takes a look at this and incorporates a few of these fixes. It's a nice mod.

beyondbg
Registered User
Posts: 58
Joined: Mon Jul 27, 2009 9:01 am

Re: [BETA] Twitter Auto Tweeter - 0.0.1

Post by beyondbg »

It seems to add the post to twitter ,but everytime the viewtopic id is: http://hahh.info/viewtopic.php?t=0 ,I'm using SEO urls. (http://hahh.info/test-t4.html)

Treben Media
Registered User
Posts: 33
Joined: Tue Sep 29, 2009 11:50 pm
Contact:

Re: [BETA] Twitter Auto Tweeter - 0.0.1

Post by Treben Media »

beyondbg wrote:It seems to add the post to twitter ,but everytime the viewtopic id is: http://hahh.info/viewtopic.php?t=0 ,I'm using SEO urls. (http://hahh.info/test-t4.html)
Take a look at this post. I think it will solve your problem.

mreider
Registered User
Posts: 98
Joined: Fri Sep 19, 2003 9:30 pm

Re: [BETA] Twitter Auto Tweeter - 0.0.1

Post by mreider »

Is there a way to set this up to tweet out when a topic becomes 'hot'? I'm just thinking that for busy boards, there would be lots of tweets. But maybe if you could set a threshold like "If this reply is the 15th post in a thread, tweet the thread"

What ya think?

User avatar
stickerboy
Former Team Member
Posts: 7349
Joined: Mon Mar 29, 2004 2:27 pm
Location: Airdrie, UK (127.0.0.1)
Name: Kenny Cameron
Contact:

Re: [BETA] Twitter Auto Tweeter - 0.0.1

Post by stickerboy »

Finally got around to testing this out, works great on my music site for auto-tweeting announcements. Thanks to all that posted. Going to implement on my MODs site now :)
I'm a web-designing code-decrypting tech-support musician
|| Twitter || Flickr || phpBB Snippets ||
Formerly known as cherokee red

whocarez
Registered User
Posts: 146
Joined: Sat Apr 18, 2009 9:19 pm

Re: [BETA] Twitter Auto Tweeter - 0.0.1

Post by whocarez »

As a workaround for that "viewtopic.php?t=0" error, I changed the code to show only the related forum. It works for me with php 3.0.5
Maybe it is useful for someone else ...

Code: Select all

// auto_twitter_mod

    if($config['enable_autopost'] && $mode == 'post') {
         $username = $config['twitter_username'];
         $password = $config['twitter_password'];
         $message = $post_data['post_subject']." ". generate_board_url()."/viewforum.php?f=$forum_id - ".$user->data['username'];
         $message = urlencode(stripslashes(urldecode($message)));
         $url = 'http://twitter.com/statuses/update.xml';
         $curl_handle = curl_init();
         curl_setopt($curl_handle, CURLOPT_URL, "$url");
         curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);
         curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
         curl_setopt($curl_handle, CURLOPT_POST, 1);
         curl_setopt($curl_handle, CURLOPT_POSTFIELDS, "status=$message");
         curl_setopt($curl_handle, CURLOPT_USERPWD, "$username:$password");
         $buffer = curl_exec($curl_handle);
         curl_close($curl_handle);
         }

// auto_twitter_mod


ljgoho4it
Registered User
Posts: 6
Joined: Mon Oct 26, 2009 2:43 am

Re: [BETA] Twitter Auto Tweeter - 0.0.1

Post by ljgoho4it »

Hello everyone,

So maybe someone can help.

I want to use the MOD but would like to filter out most of my forums. Right now - I would like only one forum to make auto tweets to twitter. I've seen the code to stop tweets from one forum, however I'm looking for a change that could filter some forums to update twitter and others not - based off forum ID or if this could be added some how in the ACP - that would be best.

Any Ideas?

THANKS

User avatar
stickerboy
Former Team Member
Posts: 7349
Joined: Mon Mar 29, 2004 2:27 pm
Location: Airdrie, UK (127.0.0.1)
Name: Kenny Cameron
Contact:

Re: [BETA] Twitter Auto Tweeter - 0.0.1

Post by stickerboy »

Following 's post [url=http://www.phpbb.com/community/viewtopi ... 5#p9789515]here[/url - using the information at the end of the post and adding code to includes/function_posting.php instead on posting.php.
This is the code that I use on my forums - It pulls posts from only 1 forum (forum_id 20) and posts it to my twitter account.

Code: Select all

    if($config['enable_autopost'] && $mode == 'post' && $forum_id == 20 && !$preview && !$refresh)
    {    
        $username = $config['twitter_username'];
        $password = $config['twitter_password'];
        $message = "New Post: $subject - " . $generate_board_url() . "/viewtopic.php?id=$topic_id";
        $url = 'http://twitter.com/statuses/update.xml';
        $curl_handle = curl_init();
            curl_setopt($curl_handle, CURLOPT_URL, "$url");
            curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);
            curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
            curl_setopt($curl_handle, CURLOPT_POST, 1);
            curl_setopt($curl_handle, CURLOPT_POSTFIELDS, "status=$message");
            curl_setopt($curl_handle, CURLOPT_USERPWD, "$username:$password");
            $buffer = curl_exec($curl_handle);
            curl_close($curl_handle);
    } 
the !$preview && !$refresh were added because the tweet would send on a a preview of the post or a refresh of the posting page ;) Hope this helps anyone :)
I'm a web-designing code-decrypting tech-support musician
|| Twitter || Flickr || phpBB Snippets ||
Formerly known as cherokee red

ljgoho4it
Registered User
Posts: 6
Joined: Mon Oct 26, 2009 2:43 am

Re: [BETA] Twitter Auto Tweeter - 0.0.1

Post by ljgoho4it »

Thanks Cherokee Red - I'll try to implement what you have and see how it goes. Just to clarify you took lrgrthnlf's code which is used in "includes/functions_posting.php". I would need to modify this file and restore the "posting.php" to original.

Do you know if you can add more forum ID's to that line?? - for example:

Code: Select all

if($config['enable_autopost'] && $mode == 'post' && $forum_id == 20, 1, 4 && !$preview && !$refresh)
I'm assuming separating with a comma is the wrong syntax and it will not work :roll:. Ideally I would like 2-3 forums to auto tweet. Also I think this is how yours is setup, but I would like only topics to be tweeted and not replies - replies would generate to many tweets and be confusing since the actual Subject does not get updated.

Anyway - Thanks again and hope you can take a look at multiple forum ID's.

User avatar
stickerboy
Former Team Member
Posts: 7349
Joined: Mon Mar 29, 2004 2:27 pm
Location: Airdrie, UK (127.0.0.1)
Name: Kenny Cameron
Contact:

Re: [BETA] Twitter Auto Tweeter - 0.0.1

Post by stickerboy »

ljgoho4it wrote:Just to clarify you took lrgrthnlf's code which is used in "includes/functions_posting.php". I would need to modify this file and restore the "posting.php" to original.
Yes, that's correct
ljgoho4it wrote:Do you know if you can add more forum ID's to that line??
Shouldn't be a problem. Try something like this [Note: I haven't tested this as I don't have the ability to at the moment, but it should work :P]:

FIND:

Code: Select all

if($config['enable_autopost'] && $mode == 'post' && $forum_id == 20 && !$preview && !$refresh) 
REPLACE WITH:

Code: Select all

$tweet_forums = array('2', '10'); // replace with your forums id's - as many as you need
if($config['enable_autopost'] && $mode == 'post' && in_array($forum_id, $tweet_forums) && !$preview && !$refresh) 
ljgoho4it wrote: Also I think this is how yours is setup, but I would like only topics to be tweeted and not replies.
If you wanted to tweet replies to a topic, I think you would have to include a && $mode == 'reply' into the code. As it stands, it should only send a tweet when a new topic is posted :)
I'm a web-designing code-decrypting tech-support musician
|| Twitter || Flickr || phpBB Snippets ||
Formerly known as cherokee red

ljgoho4it
Registered User
Posts: 6
Joined: Mon Oct 26, 2009 2:43 am

Re: [BETA] Twitter Auto Tweeter - 0.0.1

Post by ljgoho4it »

alright - I gave it a try. Using the code from Cherokee Red http://www.phpbb.com/community/viewtopi ... #p11083075 and http://www.phpbb.com/community/viewtopi ... #p11087185

When I create a new topic in the specified forum - I get a blank page. All other forums are fine creating new topics.

Here is my code from function_posting.php:

Code: Select all

/**
* User Notification
*/
function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id, $topic_id, $post_id)
{
	global $db, $user, $config, $phpbb_root_path, $phpEx, $auth;

	$topic_notification = ($mode == 'reply' || $mode == 'quote') ? true : false;
	$forum_notification = ($mode == 'post') ? true : false;

    $tweet_forums = array('7', '6'); 
    if($config['enable_autopost'] && $mode == 'post' && in_array($forum_id, $tweet_forums) && !$preview && !$refresh) 
        {    
            $username = $config['twitter_username'];
            $password = $config['twitter_password'];
            $message = "New Post: $subject - " . $generate_board_url() . "/viewtopic.php?id=$topic_id";
            $url = 'http://twitter.com/statuses/update.xml';
            $curl_handle = curl_init();
                curl_setopt($curl_handle, CURLOPT_URL, "$url");
                curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);
                curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
                curl_setopt($curl_handle, CURLOPT_POST, 1);
                curl_setopt($curl_handle, CURLOPT_POSTFIELDS, "status=$message");
                curl_setopt($curl_handle, CURLOPT_USERPWD, "$username:$password");
                $buffer = curl_exec($curl_handle);
                curl_close($curl_handle);
        } 
Does anyone see my issue.....THX

User avatar
stickerboy
Former Team Member
Posts: 7349
Joined: Mon Mar 29, 2004 2:27 pm
Location: Airdrie, UK (127.0.0.1)
Name: Kenny Cameron
Contact:

Re: [BETA] Twitter Auto Tweeter - 0.0.1

Post by stickerboy »

It may be a copy/paste error when you posted that code here, but at first glance the only thing I see is a missing } at the end of the function. ie:

Code: Select all

                curl_close($curl_handle);
        }  
should look like:

Code: Select all

                curl_close($curl_handle);
        } 
} 
I'm a web-designing code-decrypting tech-support musician
|| Twitter || Flickr || phpBB Snippets ||
Formerly known as cherokee red

User avatar
eunaumtenhoid
Registered User
Posts: 922
Joined: Wed Jun 03, 2009 12:46 am
Location: ????

Re: [BETA] Twitter Auto Tweeter - 0.0.1

Post by eunaumtenhoid »

can I select a forum id to show in the twitter only the topics done at this forum?

configurate in acp?
My translations of the extensions for Brazilian Portuguese
https://github.com/phpBBTraducoes

User avatar
gabao
Registered User
Posts: 39
Joined: Sat Sep 06, 2008 2:12 pm

Re: [BETA] Twitter Auto Tweeter - 0.0.1

Post by gabao »

lrgrthnlf and eqbeastlord many thanks for solve the bugs in mod and for the twist to show only new topics, working fine in my forum :D

twitter used: http://twitter.com/completosbr
Sorry my bad English, I speak Portuguese
website: http://www.completosbr.org Phpbb Version: 3.0.6 Template: Absolution Mods: phpbb3portal 1.2.2,[BETA] phpBB Twitter,Guest Hide BBCode 1.2.5,Invite A Friend 0.5.4,Prime Quick Reply 1.0.8,NV who was here 1.0.2,Topics descriptions 1.0.0,Topic in who is on line 1.0.2

User avatar
gabao
Registered User
Posts: 39
Joined: Sat Sep 06, 2008 2:12 pm

Re: [BETA] Twitter Auto Tweeter - 0.0.1

Post by gabao »

gabao wrote:lrgrthnlf and eqbeastlord many thanks for solve the bugs in mod and for the twist to show only new topics, working fine in my forum :D

twitter used: http://twitter.com/completosbr
a found a new bug.

the modit is duplicating the posts in the twitter, for each new post he makes 2 in the twitter

any ideas for solve this?
Sorry my bad English, I speak Portuguese
website: http://www.completosbr.org Phpbb Version: 3.0.6 Template: Absolution Mods: phpbb3portal 1.2.2,[BETA] phpBB Twitter,Guest Hide BBCode 1.2.5,Invite A Friend 0.5.4,Prime Quick Reply 1.0.8,NV who was here 1.0.2,Topics descriptions 1.0.0,Topic in who is on line 1.0.2

Locked

Return to “[3.0.x] Abandoned MODs”