You could implement this using the Rules module, together with the Flag module, as further detailed below ...
Step 1 - Content type
Create a dedicated content type to be used for these diary entries (nodes), let's call this type Diary (with machine name
diary). So to add a diary entry, one will use a path like
Step 2 - Flag
Create a flag, using the Flag module. Let's call (label) it DailyDiaryCompleted.
Step 3 - Rule to disallow multiple nodes on the same day
Create a rule, which is triggered when a user wants to start adding a new diary entry, so using a
node/add/diary path. Refer to my answer to "How to limit adding content of a specific content type to paid memberships only?" for a rule that you could use as an example. Read on for more details about this rule.
Use Rules Event "Drupal is initializing".
a condition related to "
site:current-page:url", to check if it matches
a condition to check if "this user" has already been flagged yet with the DailyDiaryCompleted flag
Set a drupal error message, to indicate they already create such diary node "today" (to stop them from starting the creation of such new node).
Step 4 - Rule to mark daily diary completed
Create a rule, which is triggered after saving a new node of type Diary. The Rules Action is to flag this user with the DailyDiaryCompleted flag.
Step 5 - Rule for daily housekeeping
Create a rule, to list all users that have been flagged with the DailyDiaryCompleted, and for each of them, perform an unflag of that flag.
Step 6 - Daily housekeeping
Use the "Rules Once per Day" module. Here is how it works (as per the comment in issue 2495775, from the module owner):
- You specify a trigger hour on the administration settings page for this module.
- The Rule trigger will then run when cron tasks are first run after the start of that hour. The actual run time will depend on your cron task timings.
The way I understand/Read this (haven't experimented with it yet though) is like so:
- The "Event" will only be triggered when a cron job is run.
- And that event will only be triggered 1 time / day, i.e. "next time cron runs after the trigger hour has passed".
So by scheduling the rule (from the previous step, i.e. "Rule for daily housekeeping") shortly after your midnight, all the flagged users from the previous day will be able to create a new diary node again "the next day".