Drupal Answers is a question and answer site for Drupal developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to create a Fivestar-Field which shows the average of 3 other ones.

Something like:

(Field A + Field B + Field C):3 = Field D

A,B and C are Fivestar-Fields which rate something and Field D is the average value out of the three.

I want the average to be showed via the star-widget of fivestar.

Is there a way to do that?

(I use Drupal 7)

share|improve this question
So fields A, B, and C are voting fields (from the Fivestar module) on separate content types? – Boriana Feb 20 '13 at 22:08
They are voting fields – Alex Feb 20 '13 at 22:36

Yes, You can able to do that using hook_node_presave

You can read three field values rating using $node and set using below command

$node->field_name_of_your_fourth_field[$node->language][0]['rating'] = $average_value;
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.