+ /**
+ * Hide the notice form if the user isn't able to post.
+ *
+ * @param Action $action action being shown
+ *
+ * @return boolean hook value
+ */
+
+ function onStartShowNoticeForm($action)
+ {
+ $user = common_current_user();
+ if (!empty($user)) { // it's a remote notice
+ if (!$this->validated($user)) {
+ return false;
+ }
+ }
+ 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 ||
+ ($this->disallowLogin && ($right == Right::WEBLOGIN || $right == Right::API))) {
+ $user = User::staticGet('id', $profile->id);
+ if ($user && !$this->validated($user)) {
+ $result = false;
+ return false;
+ }
+ }
+ return true;
+ }
+
+ function onLoginAction($action, &$login)
+ {
+ if ($action == 'confirmfirstemail') {
+ $login = true;
+ return false;
+ }
+ return true;
+ }
+}