]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/TwitterBridge/TwitterBridgePlugin.php
Squashed commit of the following:
[quix0rs-gnu-social.git] / plugins / TwitterBridge / TwitterBridgePlugin.php
index d733f71c56fee621cf6ba084d59977e7d27cd4dd..25d8a423ca403a960fe39a51f6a368364c21663f 100644 (file)
@@ -557,4 +557,32 @@ class TwitterBridgePlugin extends Plugin
         }
         return true;
     }
+
+    /**
+     * Add links in the user's profile block to their Twitter profile URL.
+     *
+     * @param Profile $profile The profile being shown
+     * @param Array   &$links  Writeable array of arrays (href, text, image).
+     *
+     * @return boolean hook value (true)
+     */
+
+    function onOtherAccountProfiles($profile, &$links)
+    {
+        $fuser = null;
+
+        $flink = Foreign_link::getByUserID($profile->id, TWITTER_SERVICE);
+
+        if (!empty($flink)) {
+            $fuser = $flink->getForeignUser();
+
+            if (!empty($fuser)) {
+                $links[] = array("href" => $fuser->uri,
+                                 "text" => sprintf(_("@%s on Twitter"), $fuser->nickname),
+                                 "image" => $this->path("icons/twitter-bird-white-on-blue.png"));
+            }
+        }
+
+        return true;
+    }
 }