Fix for radioactivity flags

  1. function radioactivity_flags_info() {
  2.   $node_titles = $comment_titles = array();
  3.   foreach (flag_get_flags('node') as $node_flag) {
  4.     $node_flag = strtolower($node_flag->name);
  5.     $str = str_replace(' ', '_', $node_flag);
  6.     $node_titles[$str . '_flag'] = array('title_placeholder' => $node_flag . ' flag');
  7.         $node_titles[$str . '_unflag'] = array('title_placeholder' => $node_flag . ' unflag');
  8.   }
  9.   foreach (flag_get_flags('comment') as $comment_flag) {
  10.     $comment_flag = strtolower($comment_flag->name);
  11.     $str = str_replace(' ', '_', $comment_flag);
  12.     $comment_titles[$str . '_flag'] = array('title_placeholder' => $comment_flag . ' flag');
  13.     $comment_titles[$str . '_unflag'] = array('title_placeholder' => $comment_flag . ' unflag');
  14.   }
  15.   return array ('sources' => array('node' => $node_titles, 'comment' => $comment_titles));
  16. }
  17.  
  18. function radioactivity_flags_flag ($action, $flag, $content_id, $account) {
  19.   $current_flag = $flag->name . '_' . $action;
  20.   if (flag_content_enabled($flag, 'node')) {
  21.     radioactivity_add_energy($content_id, 'node', $current_flag);
  22.   }
  23.   elseif (flag_content_enabled($flag, 'comment')) {
  24.     radioactivity_add_energy($content_id, 'comment', $current_flag);
  25.   }
  26. }

Submit Fix

Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Select the syntax highlighting mode to use.