]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Ticket #2999: RequireValidatedEmail plugin now also prevents group creation by unvali...
authorBrion Vibber <brion@pobox.com>
Thu, 20 Jan 2011 21:05:58 +0000 (13:05 -0800)
committerBrion Vibber <brion@pobox.com>
Thu, 20 Jan 2011 21:05:58 +0000 (13:05 -0800)
plugins/RequireValidatedEmail/RequireValidatedEmailPlugin.php

index 6c0ef37d519b4f44d5d4b0636069ec6964fbe71e..980b7beb6e3f9fd362c36da0f97c912eb724d05b 100644 (file)
@@ -235,4 +235,24 @@ class RequireValidatedEmailPlugin extends Plugin
         }
         return true;
     }
+
+    /**
+     * Prevent unvalidated folks from creating spam groups.
+     *
+     * @param Profile $profile User profile we're checking
+     * @param string $right rights key
+     * @param boolean $result if overriding, set to true/false has right
+     * @return boolean hook result value
+     */
+    function onUserRightsCheck(Profile $profile, $right, &$result)
+    {
+        if ($right == Right::CREATEGROUP) {
+            $user = User::staticGet('id', $profile->id);
+            if ($user && !$this->validated($user)) {
+                $result = false;
+                return false;
+            }
+        }
+        return true;
+    }
 }