I have the joy of having two content types that are voting upon comments and one that votes on nodes. My whole hook_votingapi_relationships() is below. The problem is that this hook assumes that there can be only one relationship for each base table. Look at the key of each item in the $views_data array - the only variable is the $data['base_table']. I think $content_type should be in there too. So the problematic line is $views_data[$data['base_table']]['votingapi_cache']['relationship'].


// An implementation of hook_votingapi_relationships()
function ec_vote_votingapi_relationships() {
  $relationships[] = array(
    'description'=>'EC Abuse', 
    'content_type' => 'abuse', 
    'base_table' => 'comments', 
    'content_id_column' => 'cid',
  );
  $relationships[] = array(
    'description'=>'EC Recommend Comment', 
    'content_type' => 'recommend-comment', 
    'base_table' => 'comments', 
    'content_id_column' => 'cid',
    );
  $relationships[] = array(
    'description'=>'EC Recommend Node', 
    'content_type' => 'recommend-node', 
    'base_table' => 'node', 
    'content_id_column' => 'nid',
  );
  return $relationships;
}

Comments

eaton’s picture

A fix has been checked in -- unfortunately, existing relationships in votingapi based views will need to be re-added to the views they're defined on. I'm working on an upgrade path but the code you have above should work now.

eaton’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.