]> git.mxchange.org Git - friendica-addons.git/blobdiff - twitter/twitter.php
correction of wrong DE translation for the twitter addon
[friendica-addons.git] / twitter / twitter.php
index ac23b84da417a9dd3ea990fb9b495fcd271373c6..d846b1ada1afef4f5dd5c7b7ce209942389f1766 100644 (file)
@@ -352,7 +352,10 @@ function twitter_settings(App $a, &$s)
 
                                $field_checkbox = Renderer::getMarkupTemplate('field_checkbox.tpl');
 
-                               $s .= '<div id="twitter-info" >
+                               if (property_exists($details, 'screen_name') &&
+                                   property_exists($details, 'description') &&
+                                   property_exists($details, 'profile_image_url')) {
+                                       $s .= '<div id="twitter-info" >
                                        <p>' . L10n::t('Currently connected to: ') . '<a href="https://twitter.com/' . $details->screen_name . '" target="_twitter">' . $details->screen_name . '</a>
                                                <button type="submit" name="twitter-disconnect" value="1">' . L10n::t('Disconnect') . '</button>
                                        </p>
@@ -361,6 +364,12 @@ function twitter_settings(App $a, &$s)
                                                <em>' . $details->description . '</em>
                                        </p>
                                </div>';
+                               } else {
+                                       $s .= '<div id="twitter-info" >
+                                       <p>Invalid Twitter info</p>
+                               </div>';
+                                       Logger::info('Invalid twitter info (verify credentials).', ['auth' => TwitterOAuth::class]);
+                               }
                                $s .= '<div class="clear"></div>';
 
                                $s .= Renderer::replaceMacros($field_checkbox, [
@@ -1900,7 +1909,7 @@ function twitter_update_mentions($body)
 function twitter_convert_share(array $attributes, array $author_contact, $content, $is_quote_share)
 {
        if ($author_contact['network'] == Protocol::TWITTER) {
-               $mention = '@' . $author_contact['nickname'];
+               $mention = '@' . $author_contact['nick'];
        } else {
                $mention = $author_contact['addr'];
        }