How do I fetch a vote given on a node and programmatically apply this vote to the author of the node? I am using the voting api, fivestar and rules modules to try to fetch the vote a user gave to a node (article) and apply that same vote/value to a fivestar field of the author of that node. How can I accomplish this?

{ "rules_cast_a_vote_when_the_author_casts_a_vote_on_their_article" : {
"LABEL" : "Cast a vote when the author casts a vote on their article",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"TAGS" : [ "cast", "fivestar", "vote" ],
"REQUIRES" : [ "rules", "rules_conditional", "voting_rules" ],
"ON" : { "voting_rules_insert_node" : [] },
"IF" : [
  { "entity_is_of_bundle" : {
      "entity" : [ "node" ],
      "type" : "node",
      "bundle" : { "value" : { "article" : "article" } }
    }
  },
  { "entity_has_field" : { "entity" : [ "node" ], "field" : "field_my_fivestar_rating" } },
  { "entity_has_field" : { "entity" : [ "node" ], "field" : "field_the_editor" } }
],
"DO" : [
  { "entity_fetch" : {
      "USING" : { "type" : "user", "id" : [ "node:field-the-editor:uid" ] },
      "PROVIDE" : { "entity_fetched" : { "editor_uid_fetched" : "Fetched editor uid" } }
    }
  },
  { "CONDITIONAL" : [
      {
        "IF" : { "entity_has_field" : {
            "entity" : [ "editor-uid-fetched" ],
            "field" : "field_my_fivestar_rating"
          }
        },
        "DO" : [
          { "drupal_message" : { "message" : "When conditional is TRUE: [editor-uid-fetched:name]\u0027s ID has been fetched and is: [editor-uid-fetched:uid]" } },
          { "data_set" : {
              "data" : [ "editor-uid-fetched:field-my-fivestar-rating" ],
              "value" : [ "node:field-my-fivestar-rating" ]
            }
          }
        ]
      }
    ]
  },
  { "drupal_message" : { "message" : "vote:value [vote:value]\u003Cbr\u003E\r\nnode author fetched ID: [node-author-fetched:uid]\u003Cbr\u003E\r\nnode author fetched name: [node-author-fetched:name]\u003Cbr\u003E\r\neditor rating now: [editor-uid-fetched:field_cr_rating]\u003Cbr\u003E\r\neditor rating value now: [editor-uid-fetched:field_cr_rating:value]\u003Cbr\u003E\r\neditor rating now (hyphens): [editor-uid-fetched:field-cr-rating]\u003Cbr\u003E\r\neditor rating value now (hyphens): [editor-uid-fetched:field-cr-rating:value]\u003Cbr\u003E\r\n\r\n" } }
]


}
}
I undesrtand that your question is about a 'code' solution, this one is not but it works, you'll need rules conditional module, and voting rules module , it adds an action: 'a node has been rated', then fecth node-author-by-id, make shure both have the same field (user-bundle and contentype), set user-author-rating-field-value with your node-rating-field-value, or import rule, please edit your field-rating machine name and dependencies as needed. i hope it helps.

    { "rules_set_node_five_star_rate_to_node_author" : {
    "LABEL" : "set node five-star rate to node author",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules", "rules_conditional", "RATING_MODULE_MACHINE_NAME" ],
    "ON" : { "voting_rules_insert_node" : [] },
    "IF" : [
      { "entity_has_field" : { "entity" : [ "node" ], "field" : "field_YOUR_FIVE_STAR_FIELD" } }
    ],
    "DO" : [
      { "entity_fetch" : {
          "USING" : { "type" : "user", "id" : [ "node:author:uid" ] },
          "PROVIDE" : { "entity_fetched" : { "entity_fetched_author_by_id" : "author_by_id" } }
        }
      },
      { "CONDITIONAL" : [
          {
            "IF" : { "entity_has_field" : {
                "entity" : [ "entity-fetched-author-by-id" ],
                "field" : "field_YOUR_FIVE_STAR_FIELD"
              }
            },
            "DO" : [
              { "data_set" : {
                  "data" : [ "entity-fetched-author-by-id:field_YOUR_FIVE_STAR_FIELD" ],
                  "value" : [ "node:field_YOUR_FIVE_STAR_FIELD" ]
                }
              }
            ]
          }
        ]
      }
    ]
  }
}