+ /**
+ * Add version information for this plugin.
+ *
+ * @param array &$versions Array of associative arrays of version data
+ *
+ * @return boolean hook value
+ */
+ function onPluginVersion(array &$versions)
+ {
+ $versions[] =
+ array('name' => 'Require Validated Email',
+ 'version' => GNUSOCIAL_VERSION,
+ 'author' => 'Craig Andrews, '.
+ 'Evan Prodromou, '.
+ 'Brion Vibber',
+ 'homepage' =>
+ 'http://status.net/wiki/Plugin:RequireValidatedEmail',
+ 'rawdescription' =>
+ // TRANS: Plugin description.
+ _m('Disables posting without a validated email address.'));
+
+ return true;
+ }
+
+ /**
+ * Show an error message about validating user email before posting
+ *
+ * @param string $tag Current tab tag value
+ * @param Action $action action being shown
+ * @param Form $form object producing the form
+ *
+ * @return boolean hook value
+ */
+ function onStartMakeEntryForm($tag, $action, &$form)
+ {
+ $user = common_current_user();
+ if (!empty($user)) {
+ if (!$this->validated($user)) {
+ $action->element('div', array('class'=>'error'), _m('You must validate an email address before posting!'));
+ }
+ }
+ 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::getKV('id', $profile->id);
+ if ($user && !$this->validated($user)) {
+ $result = false;
+ return false;
+ }
+ }
+ return true;
+ }
+
+ function onLoginAction($action, &$login)