You are here

function forward_query_stats_alltime_alter in Forward 7.3

Implements hook_query_TAG_alter().

Alter the EntityFieldQuery

File

./forward.module, line 1353
Allows forwarding of entities by email, and provides a record of how often each has been forwarded.

Code

function forward_query_stats_alltime_alter(QueryAlterableInterface $query) {

  // Entities forwarded the most of all time
  $info = entity_get_info(variable_get('forward_block_entity_type', 'node'));
  $join_clause = $info['base table'] . '.' . $info['entity keys']['id'] . ' = f.id';
  $query
    ->join('forward_statistics', 'f', $join_clause);
  $query
    ->condition('f.forward_count', 0, '>');
  $query
    ->orderBy('f.forward_count', 'DESC');
}