]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/OpenID/OpenIDPlugin.php
Squashed commit of the following:
[quix0rs-gnu-social.git] / plugins / OpenID / OpenIDPlugin.php
index ff2e2adb5b9aa1237df3153dc8d6cb1ae07bd256..3d8dab8213c30f94d11889ae5090ad1e4924029b 100644 (file)
@@ -362,10 +362,9 @@ class OpenIDPlugin extends Plugin
             require_once dirname(__FILE__) . '/' . strtolower(mb_substr($cls, 0, -6)) . '.php';
             return false;
         case 'User_openid':
-            require_once dirname(__FILE__) . '/User_openid.php';
-            return false;
+        case 'User_openid_prefs':
         case 'User_openid_trustroot':
-            require_once dirname(__FILE__) . '/User_openid_trustroot.php';
+            require_once dirname(__FILE__) . '/' . $cls . '.php';
             return false;
         case 'Auth_OpenID_TeamsExtension':
         case 'Auth_OpenID_TeamsRequest':
@@ -574,6 +573,8 @@ class OpenIDPlugin extends Plugin
                                                  null, false),
                                    new ColumnDef('modified', 'timestamp')));
 
+        $schema->ensureTable('user_openid_prefs', User_openid_prefs::schemaDef());
+
         /* These are used by JanRain OpenID library */
 
         $schema->ensureTable('oid_associations',
@@ -826,15 +827,20 @@ class OpenIDPlugin extends Plugin
     
     function onOtherAccountProfiles($profile, &$links)
     {
-        $oid = new User_openid();
+        $prefs = User_openid_prefs::staticGet('user_id', $profile->id);
+
+        if (empty($prefs) || !$prefs->hide_profile_link) {
 
-        $oid->user_id = $profile->id;
+            $oid = new User_openid();
 
-        if ($oid->find()) {
-            while ($oid->fetch()) {
-                $links[] = array('href' => $oid->display,
-                                 'text' => _('OpenID'),
-                                 'image' => $this->path("icons/openid-16x16.gif"));
+            $oid->user_id = $profile->id;
+
+            if ($oid->find()) {
+                while ($oid->fetch()) {
+                    $links[] = array('href' => $oid->display,
+                                     'text' => _('OpenID'),
+                                     'image' => $this->path("icons/openid-16x16.gif"));
+                }
             }
         }