You can make this work by using Rules in combination with the Views Bulk Operations module, as further detailed in the "blueprint" below.
Use the Views and Views Bulk Operations module to create a view of all nodes that have a specific taxonomy term, in which you add a VBO field to it. Simply include a field like
nid for each node (no need for any other fields). Just make sure you get exactly 1 row for each node you want to take into consideration.
Create a Rules Component like so:
Using these Rules Component parameters:
- a parameter of data type that matches with the data type of your 'Taxonomy with "limit" field' (probably "integer"), let's assume the parameter has machine name
- a parameter that matches with the term reference field as defined in your node's content type, let's assume the parameter has machine name
node_termreference (which can be either a single value, or it can have multiple values, depending on how you defined it in your content type).
With a Rules Condition "Check number of results returned by a VBO view", whereas:
- you select the VBO view created in Step 1.
- you want to check if that number of results is greater or equal to
node_limit (which is the 1st parameter used by this Rules Component).
- Set an appropriate Drupal message (that the node limit for that term has been reached already).
- Remove the term that was entered from the
node_termreference field (which is the 2nd parameter used by this Rules Component); Which Rules Action to use for doing so depends on how that field is defined, e.g if it is a multi value field, then you should use "remove from list".
Create a custom Rule like so:
- Rules Events:
- Before saving a new node (optionally limited to relevant content types).
- Before updating an existing node (optionally limited to relevant content types).
- Rules Conditions:
- Entity has field, for the field that refers to your taxonomy term (to make this field available for further processing in your subsequent Rules conditions/actions). More specifically we'll need it (as a token) to specify a value for the
node_termreference parameter to execute the Rules Component from Step 2 later on.
- Rules Actions:
- Fetch entity by ID, whereas you fetch the taxonomy term entered in the node being created or updated. By doing so, your 'Taxonomy with "limit" field' will become available as a token in subsequent Rules Actions. More specifically we'll need it (as a token) to specify a value for the
node_limit parameter to execute the Rules Component from Step 2 later on.
- Execute the Rules Component from Step 2, by passing that Rules Component the appropriate values for
node_termreference to actually perform its logic.
only using (popular) contributed modules, with no custom code involved .... All you need is Rules, Views and Views Bulk Operations.
PS: the above is only a blueprint ... Mostly because your question has not sufficient details. E.g you didn't explain how those terms are defined in your content type).