Download & Extend

hook_votingapi_relationships() is limiting

Project:Voting API
Version:6.x-2.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:moshe weitzman
Status:closed (fixed)

Issue Summary

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'].

<?php
// 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

#1

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.

#2

Status:active» fixed

#3

Status:fixed» closed (fixed)

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

nobody click here