Hello,

Not sure what the procedure for these things are, so please excuse me if I've created this issue inappropriately.

I've been working on a website which required highly voted comments to become highlighted. I thought my modifications would be useful to someone else here.

Below is my added code to vud_comment.module:

To be added under "Menu callback for administration settings"

  ctools_include('dependent');
  $form['vud_comment_high_active'] = array(
    '#type'          => 'radios',
    '#title'       => t('Highlight comments'),
    '#description' => t('Choose if comments should be highlighted.'),
    '#default_value' => variable_get('vud_comment_high_active', 0),
    '#options'       => array(0 => 'No', 1 => 'Yes'),
  );
  $form['vud_comment_high_threshold'] = array(
    '#type'          => 'textfield',
    '#title'         => t('Highlight threshold'),
    '#default_value' => variable_get('vud_comment_high_threshold', 0),
    '#description'   => t('Comments with total votes more than or equal to this values will be highlighted.'),
    '#process' => array('ctools_dependent_process'),
    '#dependency' => array('radio:vud_comment_high_active' => array(1)),
  );

To be added in "function vud_comment_preprocess_comment(&$variables)"

  /*IF HIGHLIGHTING IS ACTIVATED*/
  if (variable_get('vud_comment_high_active', 0) == '1') {
	    // Get total votes for this comment.
  	$content_id = $variables['comment']->cid;
  	$tag = variable_get('vud_tag', 'vote');
  	$criteria = array(
    	'content_type' => 'comment',
    	'content_id' => $content_id,
    	'value_type' => 'points',
    	'tag' => $tag,
    	'function' => 'sum'
  	);
  	
  	$vud_sum = (int) votingapi_select_single_result_value($criteria);
 	$vud_high_threshold = (int)variable_get('vud_comment_high_threshold', 0);
  	if ($vud_sum >= $vud_high_threshold) {
    	$variables['status'] .= ' vud-comment-high';
  	}
  }

To be added to vud_comment.css:

div.vud-comment-high {
	background-color: #555555; /*Change to match your colour scheme*/
	font-weight: bold;
}

div.vud-comment-high:hover {
background-color:#323232; /*Change to match your colour scheme, or comment out to disable*/
}

Hope this helps someone, and/or adds to this module.

Comments

marvil07’s picture

Version: 6.x-2.3 » 6.x-3.x-dev
Status: Needs review » Active

Sounds fine, but definitely not for 6.x-2.x, please provide a patch, changing status and version.

doublejosh’s picture

marvil07’s picture

Version: 6.x-3.x-dev » 7.x-1.x-dev
Status: Active » Postponed

No more feature requests for 6.x-3.x now that it is the stable branch, moving to 7.x-1.x as postponed until basic port is ready.

marvil07’s picture

Status: Postponed » Active