2

I'm trying to a grab a value of a fivestar field within rules and having no luck.

Basically I'm getting users to fill a feedback form and if the fivestar field value is less than 3 Stars then I want the rule to fire but no luck.

Can someone help me figure out to what's going wrong.

Thanks

2

I'm not sure about forms, since you didn't mention how you set those up on your website, but I can help you with the case where the Rule is called after saving a new comment with a Fivestar field, say it's called Stars. Follow the guidelines underneath for your Rule:

Events: After saving a new comment.

Conditions:

  • Check whether the comment has a field Stars with Entity has field.
  • Check whether the field Stars is not empty with NOT Data value is empty.
  • Run this custom code: return $comment->field_stars['und'][0]['rating']<=60;.

Adapt these steps to your needs. Be sure to compare the rating with a score out of 100, since Fivestar works internally with percentages.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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