Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: Mirthis/Slashcomments
base: e2caf7e77f
...
head fork: Mirthis/Slashcomments
compare: ce1b5d274b
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Showing with 65 additions and 22 deletions.
  1. +7 −5 includes/slashcomments.admin.inc
  2. +58 −17 slashcomments.module
View
12 includes/slashcomments.admin.inc
@@ -304,8 +304,11 @@ function slashcomments_admin_general_form_validate($form, &$form_state) {
if (!_slashcomments_is_non_negative_integet($form_state['values']['slashcomments_limit_newbie'])) {
form_set_error('slashcomments_limit_newbie', t('Numbers of days before a new user can moderate must be a non-negative number'));
}
- if (!_slashcomments_is_non_negative_integet($form_state['values']['slashcomments_mod_per_day'])) {
- form_set_error('slashcomments_mod_per_day', t('Daily moderation per user must be greater or equal to 0'));
+ if (!_slashcomments_is_integet($form_state['values']['slashcomments_mod_per_day'])) {
+ form_set_error('slashcomments_mod_per_day', t('Daily moderation per user must be an integer'));
+ }
+ else if($form_state['values']['slashcomments_mod_per_day'] <= SLASHCOMMENTS_INFINITE_MOD_POINTS) {
+ $form_state['values']['slashcomments_mod_per_day'] = SLASHCOMMENTS_INFINITE_MOD_POINTS;
}
}
@@ -313,8 +316,7 @@ function slashcomments_admin_karma_form_validate($form, &$form_state) {
if (!$form_state['values']['slashcomments_enable_karma']) {
return;
}
- if (!_slashcomments_is_integet($form_state['values']['slashcomments_default_karma'])) {
- form_set_error('slashcomments_default_karma', t('Default karma value must be an integer'));
+ if (!_slashcomments_is_integet($form_state['values']['slashcomments_default_karma'])) { form_set_error('slashcomments_default_karma', t('Default karma value must be an integer'));
}
if (!_slashcomments_is_non_negative_integet($form_state['values']['slashcomments_ratings_for_karma'])) {
form_set_error('slashcomments_ratings_for_karma', t('Moderated comments before karma is calculated must be greater or equal to 0'));
@@ -400,7 +402,7 @@ function theme_slashcomments_admin_ratings_form($form) {
function slashcomments_update_all_karma() {
$batch = array(
'operations' => array(array('slashcomments_batch_update_karma', array()),
- array('slashcomments_batch_update_content_karma',array())),
+ array('slashcomments_batch_update_content_karma',array())),
'finished' => 'slashcomments_batch_update_karma_finished',
'title' => t('Updating users karma'),
'init_message' => t('Karma update is starting.'),
View
75 slashcomments.module
@@ -256,7 +256,7 @@ function slashcomments_user_can_moderate($uid) {
/* skip controls for the super user or user with specific permissions*/
$bypass = user_access('bypass moderation restriction');
- if (user_access('administer slashcomments') && $uid == 1 && $bypass) {
+ if (user_access('administer slashcomments') || $uid == 1 || $bypass) {
$result |= USER_CAN_MODERATE;
return $result;
}
@@ -1125,25 +1125,66 @@ function slashcomments_moderation_form($form_state, $cid, $uid) {
* Implementation of hook_user().
*/
function slashcomments_user($op, &$edit, &$account, $category = 'account') {
+ global $user;
+
switch ($op) {
case 'view':
- if (!_slashcomments_karma_enabled()) {
- break;
+ if (_slashcomments_karma_enabled()) {
+ $user_karma = slashcomments_get_user_display_karma($account->uid);
+
}
+ if($user->uid == $account->uid || $user->uid == 1 || user_access('administer slashcomments')) {
+ if(_slashcomments_get_mod_per_day() != SLASHCOMMENTS_INFINITE_MOD_POINTS) {
+ $mod_points = slashcomments_get_user_mod_points($account->uid);
- $user_karma = slashcomments_get_user_display_karma($account->uid);
+ if($mod_pints == SLASHCOMMENTS_INFINITE_MOD_POINTS) {
+ $mod_points = t('Infinite');
+ }
+ }
+
+ $can_vote = slashcomments_user_can_moderate($user->uid);
+
+ $msg_attrib = array('uid' => $user->uid);
+ $msg_filter = array(IS_NEWBIE, LOW_KARMA);
+
+ $messages = _slashcomments_can_moderate_msg($can_vote, $msg_attrib, $msg_filter);
+ }
+
+ if(isset($user_karma) || isset($mod_points) || count($messages)) {
+ $account->content['slashcomments'] = array(
+ '#type' => 'user_profile_category',
+ '#title' => t('Comment Moderations'),
+ '#weight' => 10,
+ );
+ }
+
+ if(isset($user_karma)) {
+ $account->content['slashcomments']['karma'] = array(
+ '#title' => t('Karma value'),
+ '#type' => 'user_profile_item',
+ '#value' => $user_karma,
+ '#weight' => 1,
+ );
+ }
+
+ if(isset($mod_points)) {
+ $account->content['slashcomments']['mod_points'] = array(
+ '#title' => t('Moderation points'),
+ '#type' => 'user_profile_item',
+ '#value' => $mod_points,
+ '#weight' => 2,
+ );
+ }
+
+ if(count($messages)) {
+ $account->content['slashcomments']['mod_points'] = array(
+ '#title' => t('Moderation status'),
+ '#type' => 'user_profile_item',
+ '#value' => theme('slashcomments_comment_moderation_status', $messages),
+ '#weight' => 2,
+ );
+ }
- $account->content['slashcomments_karma'] = array(
- '#type' => 'user_profile_category',
- '#title' => t('Karma'),
- '#weight' => 10,
- );
- $account->content['slashcomments_karma']['karma'] = array(
- '#title' => t('Current value'),
- '#type' => 'user_profile_item',
- '#value' => $user_karma,
- '#weight' => 1,
- );
break;
case 'delete':
delete_slashcomments_user_data($account->uid);
@@ -1401,7 +1442,7 @@ function theme_slashcomments_post_moderation_status($result) {
*/
function theme_slashcomments_comment_moderation_status($messages) {
//$output = '<div class="slashcomments-comment-moderation-status">';
- $output .= implode("\n", $messages);
+ $output .= implode("<br/>", $messages);
//$output .= '</div>';
return $output;
@@ -2023,7 +2064,7 @@ function _slashcomments_can_moderate_msg($status, $attrib = array(), $filter = a
if ($mod_points) {
if ($mod_points == SLASHCOMMENTS_INFINITE_MOD_POINTS) {
//$mod_points = t('unlimited');
- $message = '';
+ //$message = '';
}
else {
$messages[USER_CAN_MODERATE] = t("You have !modpoints moderation points left.",

No commit comments for this range

Something went wrong with that request. Please try again.