Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#109 2010-08-23 06:06:35

jstubbs
Moderator
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: TXP Tweet: arc_twitter and arc_twitter_intents

Hi Mike, I came across this too. Either try and change /textpattern to /admin in the URL bar (it worked before for me but not on the latest version of arc_twitter) or edit the plugin by finding this line in the callbackURL() in the arc_twitter class:

public function callbackURL($event,$step)
    {
        return hu.'textpattern/index.php?event='.$event.'&step='.$step;
    }

Change textpattern to admin and it will work fine.

Offline

#110 2010-08-23 16:42:13

maverick
Member
From: Southeastern Michigan, USA
Registered: 2005-01-14
Posts: 976
Website

Re: TXP Tweet: arc_twitter and arc_twitter_intents

Thanks Jonathan!

You nailed!

In case anyone else has issues, and my experience can help:

I got part way there trying to change the url, and finally decided that editing the code was the better long term option.

For some reason, even though my user name was showing in admin->preferences->advance, it was not showing on the arc_twitter options page (it wasn’t logging in). Yet I had logged into twitter using the plugin, and had authorized it.

I had to uninstall the plugin, use smd_prefalizer to remove all arc_twitter preference (deleting it didn’t delete them for some reason), and start all over wit the modified version of the plugin. I also “deauthorized” the plugin at twitter so I could start clean there as well.

This time it worked as advertised.

Mike

Offline

#111 2010-08-23 18:21:42

jstubbs
Moderator
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: TXP Tweet: arc_twitter and arc_twitter_intents

I also found difficulties since I use several Twitter accounts – I first had to sign out of Twitter before arc_twitter was able to connect to Twitter. That was problematic because Twitter was not destroying the session effectively. But it all works in the end!

Offline

#112 2010-08-23 18:27:33

monkeyninja
Plugin Author
From: Sheffield, UK
Registered: 2008-10-14
Posts: 239
Website

Re: TXP Tweet: arc_twitter and arc_twitter_intents

jstubbs wrote:

I also found difficulties since I use several Twitter accounts – I first had to sign out of Twitter before arc_twitter was able to connect to Twitter. That was problematic because Twitter was not destroying the session effectively. But it all works in the end!

Unfortunately there’s not a lot that can be done about the sign-in process as it is part of Twitter’s new authentication system. It is meant to reassure the end user that they are using a genuine Twitter app I believe.

I am busily putting together version 2 of the plugin which will have loads of new features including the new Tweet button (I have that working in an alpha version of the plugin if anyone’s interested in testing it out). The focus is very much on the front-end aspects of the plugin, but if I have chance I will try and address the multisite issue that people are experiencing.

Offline

#113 2010-08-23 22:50:22

johnnie
Member
Registered: 2007-03-10
Posts: 58

Re: TXP Tweet: arc_twitter and arc_twitter_intents

First of all, thank you for this great plugin.

I’d like to contribute a bit, because I ran into a problem related to the usage of file_get_contents to grab the shortened URL. file_get_contents is disabled on many hosts due to safety concerns and is supplanted by cURL, which is the new standard for inter-domain requests. I have therefore done a slight rewrite of your URL shorten-function to make use of cURL instead of the file_get_contents. Perhaps useful to those who can’t get tinyURL or is.gd to work because of host restrictions:

/*
 * Shorten URLs using various methods
 */
function arc_shorten_url($url, $method='', $atts=array())
{
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_HEADER, 0);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	curl_setopt($ch, CURLOPT_TIMEOUT, 10);

   switch ($method) {
        case 'smd': // create a shortened URL using SMD Short URL
            return ($atts['id']) ? hu.$atts['id'] : false; break;
        case 'isgd':

            $u = 'http://is.gd/api.php?longurl='.urlencode($url);
            curl_setopt($ch, CURLOPT_URL, $u);

            $tinyurl = curl_exec($ch);
            if ($tinyurl!='Error' && $tinyurl!='') {
                return $tinyurl;
            } else {
                trigger_error('arc_twitter failed to get a is.gd URL for '
                    .$url,E_USER_WARNING);
            }
            break;

        case 'tinyurl': default: // create a shortened URL using TinyURL

            $u = 'http://tinyurl.com/api-create.php?url='.urlencode($url);
            curl_setopt($ch, CURLOPT_URL, $u);
            $tinyurl = curl_exec($ch);
            if ($tinyurl!='Error' && $tinyurl!='') {
                return $tinyurl;
            } else {
                trigger_error('arc_twitter failed to get a TinyURL for '.$url,E_USER_WARNING);
            }

    }

    return false; // fail

}

Offline

#114 2010-08-24 18:40:48

monkeyninja
Plugin Author
From: Sheffield, UK
Registered: 2008-10-14
Posts: 239
Website

Re: TXP Tweet: arc_twitter and arc_twitter_intents

johnnie wrote:

First of all, thank you for this great plugin.

I’d like to contribute a bit, because I ran into a problem related to the usage of file_get_contents to grab the shortened URL. file_get_contents is disabled on many hosts due to safety concerns and is supplanted by cURL, which is the new standard for inter-domain requests. I have therefore done a slight rewrite of your URL shorten-function to make use of cURL instead of the file_get_contents. Perhaps useful to those who can’t get tinyURL or is.gd to work because of host restrictions:

Big thank you for the contribution, I’ve thrown it into the first alpha release of version 2 of arc_twitter for testing purposes. I really welcome code contributions if people have them and they help further and improve the functionality of the plugin.

For those of you interested in testing/trying out the version 2 alpha, or just want to learn the direction the plugin is going, I’ve just posted details about it over on my blog. You can also test out the retweet functionality on the post (there’s a “Tweet this” link on the left-hand-side of the page).

Offline

#115 2010-08-24 19:13:43

johnnie
Member
Registered: 2007-03-10
Posts: 58

Re: TXP Tweet: arc_twitter and arc_twitter_intents

monkeyninja wrote:


Big thank you for the contribution, I’ve thrown it into the first alpha release of version 2 of arc_twitter for testing purposes. I really welcome code contributions if people have them and they help further and improve the functionality of the plugin.

For those of you interested in testing/trying out the version 2 alpha, or just want to learn the direction the plugin is going, I’ve just posted details about it over on my blog. You can also test out the retweet functionality on the post (there’s a “Tweet this” link on the left-hand-side of the page).

Hi Andy,

Thanks for the acknowledgement. I think I also spotted a small bug that might cause URL shrinking to fail for people who use the custom URL field. It is in the part where you select the article from the database, right before feeding it to permlink(). Do you have any particular reason to just select a few columns in the safe_row call? The problem is, that if you don’t select the custom url field along with the article, the permlink() function will create the permlink using the default permlink scheme instead of using the custom URL field the user may have entered. This will mess things up, since the constructed URL will then 404. I replaced the column names with a simple ‘*’ to fix this issue, so now the safe_row call before the URL shortening is invoked looks like this:

$article = safe_row("*", 'textpattern',
            "ID={$article_id} AND Status=4 AND now()>=Posted");

Last edited by johnnie (2010-08-24 19:17:11)

Offline

#116 2010-08-24 20:07:19

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: TXP Tweet: arc_twitter and arc_twitter_intents

arc_twitter v2 is looking sweet, will definitely be installing that.

Is there any chance this could be made to work with bot_write_tab_customize? in that I only really need to display the twitter option for authors in specific sections when writing an article (for example a blog article or news article).

Offline

#117 2010-08-26 17:38:20

monkeyninja
Plugin Author
From: Sheffield, UK
Registered: 2008-10-14
Posts: 239
Website

Re: TXP Tweet: arc_twitter and arc_twitter_intents

philwareham wrote:

arc_twitter v2 is looking sweet, will definitely be installing that.

Is there any chance this could be made to work with bot_write_tab_customize? in that I only really need to display the twitter option for authors in specific sections when writing an article (for example a blog article or news article).

I will investigate as I can see that this could be very useful, but I don’t have much knowledge of bot_write_tab_customize so no guarantees.

Offline

#118 2010-09-09 14:32:06

jstubbs
Moderator
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: TXP Tweet: arc_twitter and arc_twitter_intents

Andy,

Would it be possible/feasible to add a tweet from an article being moderated (mem_moderation)? Its not a big deal but its an extra step (moderate an article, then visit the Write tab to send a tweet from the article) and not the most elegant solution.

Offline

#119 2010-09-22 02:16:42

trailgirl
Member
Registered: 2004-06-04
Posts: 68
Website

Re: TXP Tweet: arc_twitter and arc_twitter_intents

I was running an older version of arc_twitter which I turned off and then deleted and installed version 1.0.4 When I go to options to log into Twitter I get this message:

Fatal error: Call to undefined function hash_hmac() in [actual path removed]/textpattern/lib/txplib_misc.php(594) : eval()’d code on line 1307

I deleted 1.0.4 and installed 2.0Alpha 1 but still get the same error.

I am running Txp 4.2.0

Any suggestions?

Offline

#120 2010-10-18 18:19:07

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: TXP Tweet: arc_twitter and arc_twitter_intents

Few things that caught me on installing this plugin.

I also found difficulties since I use several Twitter accounts – I first had to sign out of Twitter before arc_twitter was able to connect to Twitter. That was problematic because Twitter was not destroying the session effectively. But it all works in the end!

That happened to me too. When clicking on the “Sign in to Twitter” link, on the Options page for arc_twitter, I was being redirected back to TXP admin.
I had to sign out of Twitter, then click on the “Sign in to Twitter” link, login to Twitter using my user/pass, and then it worked. My Twitter account was successfully configured on Textpattern.

I think that a simple, short note, both in Plugin’s help and next to the “Sign in to Twitter” link, saying “(you may need to log out from your Twitter account first, for the configuration process to work)” may really help.

Re: /textpattern/ vs /admin/, on multi-site installs.

Adding this to your .htaccess:

Redirect 301 /textpattern /admin

Should be enough to fix any plugin/script/stuff, not just arc_twitter, that has /textpattern hardcoded on it. It worked flawlessly for me on a few TXP installs.
(There you have a TXPTip, Jonathan! :) )

@Andy, I think arc_twitter should honor, if possible, the tempdir preference (on Admin -> Advanced Preferences), not the usual default (/textpattern/tmp) as arc_twitter currently does, when not specifying a particular caching directory for arc_twitter.

Last edited by maniqui (2010-10-18 18:19:39)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

Board footer

Powered by FluxBB