]> git.mxchange.org Git - friendica.git/blobdiff - addon/twitter/twitter.php
saved searches on search page, templates: Invalid argument supplied for foreach(...
[friendica.git] / addon / twitter / twitter.php
index 1c5fe4e4ad0bc6d888b2cae27fd8a261427b5b6f..b1c8a0a897a3b388663b39d82f1ba7d452a8a9a9 100644 (file)
@@ -182,9 +182,10 @@ function twitter_settings(&$a,&$s) {
                        $s .= '<div id="twitter-enable-wrapper">';
                        $s .= '<label id="twitter-enable-label" for="twitter-checkbox">'. t('Allow posting to Twitter'). '</label>';
                        $s .= '<input id="twitter-checkbox" type="checkbox" name="twitter-enable" value="1" ' . $checked . '/>';
-                        $s .= '</div><div class="clear"></div>';
+                        $s .= '<div class="clear"></div>';
                         $s .= '<label id="twitter-default-label" for="twitter-default">'. t('Send public postings to Twitter by default') .'</label>';
                         $s .= '<input id="twitter-default" type="checkbox" name="twitter-default" value="1" ' . $defchecked . '/>';
+                       $s .= '</div><div class="clear"></div>';
 
                        $s .= '<div id="twitter-disconnect-wrapper">';
                         $s .= '<label id="twitter-disconnect-label" for="twitter-disconnect">'. t('Clear OAuth configuration') .'</label>';
@@ -224,6 +225,10 @@ function twitter_post_hook(&$a,&$b) {
                        $twitter_post = intval(get_pconfig(local_user(),'twitter','post'));
                        $twitter_enable = (($twitter_post && x($_POST,'twitter_enable')) ? intval($_POST['twitter_enable']) : 0);
 
+                       // if API is used, default to the chosen settings
+                       if($_POST['api_source'] && intval(get_pconfig(local_user(),'twitter','post_by_default')))
+                               $twitter_enable = 1;
+
                        if($twitter_post && $twitter_enable) {
                                logger('Posting to Twitter', LOGGER_DEBUG);
                                require_once('library/twitteroauth.php');