+ /**
+ * Initialize any flagging buttons on the page
+ *
+ * @param Action $action action being shown
+ *
+ * @return boolean hook result
+ */
+
+ function onEndShowScripts($action)
+ {
+ $action->inlineScript('if ($(".form_entity_flag").length > 0) { '.
+ '$(".form_entity_flag").bind("click", function() {'.
+ 'SN.U.FormXHR($(this)); return false; }); }');
+ return true;
+ }
+
+ /**
+ * Check whether a user has one of our defined rights
+ *
+ * We define extra rights; this function checks to see if a
+ * user has one of them.
+ *
+ * @param User $user User being checked
+ * @param string $right Right we're checking
+ * @param boolean &$result out, result of the check
+ *
+ * @return boolean hook result
+ */
+
+ function onUserRightsCheck($user, $right, &$result)
+ {
+ switch ($right) {
+ case self::REVIEWFLAGS:
+ case self::CLEARFLAGS:
+ $result = $user->hasRole('moderator');
+ return false; // done processing!
+ }
+
+ return true; // unchanged!
+ }
+
+ /**
+ * Optionally flag profile when a block happens
+ *
+ * We optionally add a flag when a profile has been blocked
+ *
+ * @param User $user User doing the block
+ * @param Profile $profile Profile being blocked
+ *
+ * @return boolean hook result
+ */
+
+ function onEndBlockProfile($user, $profile)