Count total number votes a user has gained I am using rate module where users can plus or minus the articles created by an author. Now, in the profile page of the author, I want to display the total number of votes he/she has got from all his articles. Is there any way to do this without using db_query ?
Thank you.
I think it would be pretty expensive to do this without writing your own query, but here is one way you could do it:

Use EntityFieldQuery to build a list of nids created by the current author. Something like this:

$query = new EntityFieldQuery();
$query-&gt;entityCondition('entity_type', 'node')
  -&gt;entityCondition('bundle', 'article');
  -&gt;propertyCondition('uid', '1')
$nodes = $query-&gt;execute();


Then parse the nids returned into a seperate array and use that array as a criteria parameter in votingapi_select_votes(). Something like:

$votes = votingapi_select_votes('entity_id' =&gt; $nid_array);


I'm not 100% sure that votingapi_select_votes() accepts an array for the $criteria['entity_id'] param. You might need to loop through each nid if it doesn't.