aboutsummaryrefslogtreecommitdiffstats
path: root/include/functions_user.inc.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/functions_user.inc.php')
-rw-r--r--include/functions_user.inc.php15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/functions_user.inc.php b/include/functions_user.inc.php
index d7ef88992..d7aa81f24 100644
--- a/include/functions_user.inc.php
+++ b/include/functions_user.inc.php
@@ -1198,6 +1198,21 @@ function is_adviser()
}
/*
+ * Return if current user can edit/delete a comment
+ * @param action edit/delete
+ * @return bool
+ */
+function can_manage_comment($action, $comment_author)
+{
+ if (!in_array($action, array('delete','edit'))) {
+ return false;
+ }
+ return (is_admin() ||
+ (($GLOBALS['user']['username'] == $comment_author)
+ && $GLOBALS['conf'][sprintf('user_can_%s_comment', $action)]));
+}
+
+/*
* Return mail address as display text
* @return string
*/