How to limit users to posting 1 node per a day? I am making a diary website, where users can make a daily diary entry. A node acts as a diary page, so naturally I need to limit the user to make 1 node per a day. How can I do this?



Steps I have tried

Using Node Limit

This contains an option for 1 node per a day. But in fact, it is 1 node per 24 hours. So if my user makes a diary entry at 3:00pm, they have to wait until 3:00pm the next day until making the next one. Because it is diary, it would be better if the limit reset at Midnight every day, but there doesn't seem to be a way of doing this. 

Using Rules

The problem with Rules is that you have to fire off the rule on Node Creation. This creates a usability issue, as my user will finish their (unallowed second) diary entry before being told that it is not allowed.
Check the answer here:
Denying access to node form edit.
Deny access to user by checking whether he has created a node the specific day.

function MYMODULE_node_access($node, $op, $account) {
  $type = is_string($node) ? $node : $node-&gt;type;

  if ($type == 'my_type' &amp;&amp; ($op == 'create' || $op == 'update')) {
    my_module_check_if_user_has_published_content_today($account);
    if ($account-&gt;something == 'something') { // allow access
      return NODE_ACCESS_ALLOW;
    }
    else {
      return NODE_ACCESS_DENY;
    }
  }
// Return the default ignore value if your module doesn't need to get involved in this decision
  return NODE_ACCESS_IGNORE;
}


You should implement the select query that loads all nodes for the specific user on the specific day. You need to join node and user tables. Every node has a UTC value of the creation date. You can check if there is a node that was created after 00:00:01 and 23:59:59 in the specific day.