Node limit - based on cck field of referenced content type I have 2 content types:


Organisation (Name, address, tel, places)
Internship (Reference to Organisation , Student, Mentor, ...)


Now for example I have an organisation with 2 places for students. So when this organisation is selected as a refernce in Internship node creation, it must check for the available places. If the pace is available then it needs to save the node else it should give an error message.

I have tried node limit module but it is not a solution.

Thanks.
My point of view this can be done at node submission time

Alter the access callback for the menu callback:

function custom_module_menu_alter(&amp;$items){
    $items['node/add/internship']['access callback'] = 'my_custom_access_callback'
    // Next line needed for Drupal 7
    unset($items['node/add/review-sites']['access arguments']);
}


Add a function as your custom access callback:

function my_custom_access_callback() {
   global $user;

   /*Now check the selected organization which you are selecting from dropdown of entity reference and call it as $no_of_places. Also check the existing internship with same referenced organization and call it as $occupied_seats*/

   if ($no_of_places &gt; $occupied_seats &amp;&amp; user_access("create internship")) {
     return TRUE;
   }
   else{
     drupal_set_message('Print message about exceeded limit and/or user permissions.');
     return FALSE;
   }
}