You are here

function og_handler_post_count_new in Organic groups 5.7

Same name and namespace in other branches
  1. 5.8 og_views.inc \og_handler_post_count_new()
  2. 5 og_views.inc \og_handler_post_count_new()
  3. 5.3 og_views.inc \og_handler_post_count_new()

Views handler to display the number of *new* posts in the group

1 string reference to 'og_handler_post_count_new'
og_views_tables in ./og_views.inc
Implementation of the hook_views_tables()

File

./og_views.inc, line 1290

Code

function og_handler_post_count_new($fieldinfo, $fielddata, $value, $data) {
  global $user;
  $cnt = db_result(db_query(db_rewrite_sql('SELECT COUNT(*) FROM {node} n INNER JOIN {og_ancestry} oga ON n.nid = oga.nid LEFT JOIN {history} h ON n.nid=h.nid AND h.uid = %d WHERE n.status = 1 AND oga.group_nid = %d AND h.timestamp IS NULL AND n.created > %d'), $user->uid, $data->nid, NODE_NEW_LIMIT));
  if ($cnt) {
    if ($fielddata['options'] == 'normal') {
      return $cnt;
    }
    else {
      return $cnt . theme('mark', MARK_NEW);
    }
  }
}