How do I limit the number of nodes posted by a user to an entity referenced node? I have created a content type (Reviews). I am referencing another content type (Books) using the Entity Reference module. How do I limit the number of reviews posted per book to 1 per user? Is there a module for this?

I have already experimented with the node_limit module but that doesn't work in this particular context. It restricts the user from posting content per content-type but not per node.
I don't think there is a module for that ("yet", may be). However, this can be done easily with a form alter hook and validation. 

&lt;?php 
function MYMODULE_form_node_form_alter(&amp;$form, &amp;$form_state) {
  if ($form['#node']-&gt;type == 'article') {
    $validate = TRUE;
  }
  // You can also use field existence like following:
  if (isset($form['field_name_that_you_want_to_validate'])) {
    $validate = TRUE;
  }

  if (!empty($validate = TRUE;)) {
    $form['#validate'][] = 'MYMODULE_node_validate_only_one_review';
    form_load_include($form_state, 'inc', 'MYMODULE', 'FILE_THAT_CONTAINS_THE_VALIDATE_FUNCTION');
  }
}
?&gt;


Then, define the validate function:

&lt;?php 
function MYMODULE_node_validate_only_one_review($form, &amp;$form_state) {
  if (!empty($form_state['field_name_that_you_want_to_validate'])) {
    $nids = array();
    foreach ($form_state['field_name_that_you_want_to_validate'] as $language =&gt; $items) {
      foreach ($items as $delta =&gt; $item) {
        if (!empty($item['target_id'])) {
          $nids[$item['target_id']] = array($language, $delta);
        }
      }
    }
    if (!empty($nids)) {
      $query = new EntityFieldQuery();
      $query-&gt;entityCondition('entity_type', 'node')
        -&gt;entityCondition('bundle', 'article')
        -&gt;propertyCondition('uid', $GLOBALS['user']-&gt;uid)
        -&gt;fieldCondition('field_name_that_you_want_to_validate', 'target_id', $nids);

      $matches = $query-&gt;execute();
      if (isset($matches['node'])) {
        foreach ($nids as $nid =&gt; $pack) {
          if (isset($matches['node'][$nid])) {
            list($language, $delta) = $pack;
            form_set_error('field_name_that_you_want_to_validate][' . $language . '][' . $delta, 
              t('You have already submitted a review for this content.');
            );
          }
        }
      }
    }
  }
}
?&gt;


There are 4 assumptions:


Node type is article. Change all instances of article with the correct node type machine name. 
Your field name is field_name_that_you_want_to_validate. Change it accordingly. 
You are using Entity Reference module for node reference (hence, the target_id key. It would be nid if you use References module)
This bounty gave you the hat ;)


There is 1 fact:


I submitted this answer for the hat. 


There is 1 hope:


I will get that hat.