]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
add remote subscribe button for not-logged-in users looking a profile list with local...
authorEvan Prodromou <evan@status.net>
Wed, 3 Mar 2010 19:32:03 +0000 (14:32 -0500)
committerEvan Prodromou <evan@status.net>
Wed, 3 Mar 2010 19:32:03 +0000 (14:32 -0500)
plugins/OStatus/OStatusPlugin.php

index e371f72f989ab4df1d07b8a9b672c37be8bf7fa3..da7ca2fe2b0dba8d0dd54645adfe65ece16dffa0 100644 (file)
@@ -111,11 +111,11 @@ class OStatusPlugin extends Plugin
             $acct = 'acct:'. $action->profile->nickname .'@'. common_config('site', 'server');
             $url = common_local_url('xrd');
             $url.= '?uri='. $acct;
-            
+
             header('Link: <'.$url.'>; rel="'. Discovery::LRDD_REL.'"; type="application/xrd+xml"');
         }
     }
-    
+
     /**
      * Set up a PuSH hub link to our internal link for canonical timeline
      * Atom feeds for users and groups.
@@ -229,7 +229,6 @@ class OStatusPlugin extends Plugin
         return false;
     }
 
-
     /**
      * Check if we've got remote replies to send via Salmon.
      *
@@ -587,7 +586,6 @@ class OStatusPlugin extends Plugin
             // Drop the PuSH subscription if there are no other subscribers.
             $oprofile->garbageCollect();
 
-
             $member = Profile::staticGet($user->id);
 
             $act = new Activity();
@@ -806,4 +804,28 @@ class OStatusPlugin extends Plugin
 
         return true;
     }
+
+    function onStartProfileListItemActionElements($item)
+    {
+        if (!common_logged_in()) {
+
+            $profileUser = User::staticGet('id', $item->profile->id);
+
+            if (!empty($profileUser)) {
+
+                $output = $item->out;
+
+                // Add an OStatus subscribe
+                $output->elementStart('li', 'entity_subscribe');
+                $url = common_local_url('ostatusinit',
+                                        array('nickname' => $profileUser->nickname));
+                $output->element('a', array('href' => $url,
+                                            'class' => 'entity_remote_subscribe'),
+                                 _m('Subscribe'));
+                $output->elementEnd('li');
+            }
+        }
+
+        return true;
+    }
 }