';
}
}
-function twitter_post_start(&$a,&$b) {
- if(! local_user())
- return;
-
- if((x($b,'twitter_enable')) && (intval($b['twitter_enable'])))
- set_pconfig(local_user(),'twitter','enable','1');
- else
- del_pconfig(local_user(),'twitter','enable');
-
-
-}
-
-
function twitter_settings_post ($a,$post) {
if(! local_user())
return;
+ // don't check twitter settings if twitter submit button is not clicked
+ if (!x($_POST,'twitter-submit')) return;
+
if (isset($_POST['twitter-disconnect'])) {
/***
* if the twitter-disconnect checkbox is set, clear the OAuth key/secret pair
@@ -99,7 +92,7 @@ function twitter_settings_post ($a,$post) {
if (isset($_POST['twitter-pin'])) {
// if the user supplied us with a PIN from Twitter, let the magic of OAuth happen
logger('got a Twitter PIN');
- require_once('addon/twitter/twitteroauth.php');
+ require_once('library/twitteroauth.php');
$ckey = get_config('twitter', 'consumerkey' );
$csecret = get_config('twitter', 'consumersecret' );
// the token and secret for which the PIN was generated were hidden in the settings
@@ -134,6 +127,7 @@ function twitter_settings(&$a,&$s) {
$osecret = get_pconfig(local_user(), 'twitter', 'oauthsecret' );
$enabled = get_pconfig(local_user(), 'twitter', 'post');
$checked = (($enabled) ? ' checked="checked" ' : '');
+ $s .= '
';
$s .= '
'. t('Twitter Posting Settings') .'
';
if ( (!$ckey) && (!$csecret) ) {
@@ -153,7 +147,7 @@ function twitter_settings(&$a,&$s) {
* which the user can request a PIN to connect the account to a
* account at Twitter.
*/
- require_once('addon/twitter/twitteroauth.php');
+ require_once('library/twitteroauth.php');
$connection = new TwitterOAuth($ckey, $csecret);
$request_token = $connection->getRequestToken();
$token = $request_token['oauth_token'];
@@ -167,14 +161,14 @@ function twitter_settings(&$a,&$s) {
$s .= '';
$s .= '';
$s .= '';
- $s .= '
';
- $s .= '';
+ $s .= '
';
+ $s .= '';
} else {
/***
* we have an OAuth key / secret pair for the user
* so let's give a chance to disable the postings to Twitter
*/
- require_once('addon/twitter/twitteroauth.php');
+ require_once('library/twitteroauth.php');
$connection = new TwitterOAuth($ckey,$csecret,$otoken,$osecret);
$details = $connection->get('account/verify_credentials');
$s .= '