]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - classes/Profile.php
Merge branch '0.9.x' into testing
[quix0rs-gnu-social.git] / classes / Profile.php
index 1b9cdb52f9a93ea77a47ba929283ccb086c9749e..03196447b891e31ef5b09e7af9d97b6942cf24dd 100644 (file)
@@ -594,9 +594,14 @@ class Profile extends Memcached_DataObject
 
     function hasRole($name)
     {
-        $role = Profile_role::pkeyGet(array('profile_id' => $this->id,
-                                            'role' => $name));
-        return (!empty($role));
+        $has_role = false;
+        if (Event::handle('StartHasRole', array($this, $name, &$has_role))) {
+            $role = Profile_role::pkeyGet(array('profile_id' => $this->id,
+                                                'role' => $name));
+            $has_role = !empty($role);
+            Event::handle('EndHasRole', array($this, $name, $has_role));
+        }
+        return $has_role;
     }
 
     function grantRole($name)
@@ -711,4 +716,15 @@ class Profile extends Memcached_DataObject
         }
         return $result;
     }
+
+    function hasRepeated($notice_id)
+    {
+        // XXX: not really a pkey, but should work
+
+        $notice = Memcached_DataObject::pkeyGet('Notice',
+                                                array('profile_id' => $this->id,
+                                                      'repeat_of' => $notice_id));
+
+        return !empty($notice);
+    }
 }