You are here

class og_views_handler_field_og_member_count in Organic groups 6.2

Same name and namespace in other branches
  1. 6 modules/og_views/includes/og_views_handler_field_og_member_count.inc \og_views_handler_field_og_member_count

Hierarchy

Expanded class hierarchy of og_views_handler_field_og_member_count

1 string reference to 'og_views_handler_field_og_member_count'
og_views_data_og in modules/og_views/og_views.views.inc

File

modules/og_views/includes/og_views_handler_field_og_member_count.inc, line 2

View source
class og_views_handler_field_og_member_count extends views_handler_field_numeric {
  function init(&$view, $options) {
    parent::init($view, $options);
    $this->additional_fields['nid'] = array(
      'table' => 'og',
      'field' => 'nid',
    );
  }
  function query() {
    $table = $this->query
      ->ensure_table('og');
    $this
      ->add_additional_fields();
    $sql = og_list_users_sql(1, 0, NULL, TRUE);
    $sql = str_replace('%d', $this->aliases['nid'], $sql);
    $this->query
      ->add_field('', "({$sql})", 'member_count');
    $this->field_alias = 'member_count';
  }
  function render($values) {
    $nid = $values->{$this->aliases['nid']};
    $txt = $values->member_count;
    if (og_is_group_member($nid)) {
      $value = og_is_picture() ? l($txt, "og/users/{$nid}/faces") : l($txt, "og/users/{$nid}");
      return check_plain($this->options['prefix']) . $value . check_plain($this->options['suffix']);
    }
    else {
      return parent::render($values);
    }
  }

}

Members