This module idea is a rewrite of another module idea I had and posted at http://drupal.org/node/52582
It also came to light that there are several modules in some state or another that implement a similar concept. Here is a review
So now I offer this module called nodelimit which I think (I hope) incorporates most of the ideas of all of them into one.
The code was also written with an eye towards further enhancement. There is a 'mode' value (the current modes are 'No limits', 'One limit applied to all users' and 'Multiple limits applied by permissions'). The code performs a switch statement on the 'mode', so if someone had other idea for another 'mode', the idea could be incorporated easily by adding new case statements in each of the modules functions to handle the 'mode' specific logic. Along with the 'mode' value is the 'quantity' value that could be anything needed to support the new 'mode' (with the current modes as examples: 'One limit applied to all users' accepts only a single number and 'Multiple limits applied by permissions' accepts a comma separated list of numbers). And lastly there is the anonymous user exception value (true or false) which allows anonymous user override of a limit.
So if someone wanted to incorporate this with user points or e-commerce, this module shouldn't be too difficult for a coder to build on. I had commented earlier, that I think some sort of infrastructure that limits node creation at the individual user level would require fairly different logic than these (bioesque, noderestrict, usernodes and bio) modules provide. I had that thought in the bakc of my head as I was writing this code, so I think (or I hope) the logic needed for a new 'mode' idea could easily be incorporated into this module.
To install - copy the code to your text editor, save as nodelimit.module. Create a nodelimit directory in your modules directory and upload file to the new directory. Note when copying, remember to remove any whitespace after the closing ?> php tag at the end of the file.
Would certainly appreciate any thoughts, comments and suggestions.
<?php
/**
* Global values to define node limit mode
*/
define('NODELIMIT_NONE', 0);
define('NODELIMIT_SIMPLE', 1);
define('NODELIMIT_PERM', 2);
/* Implementation of hook_help...
*/
function nodelimit_help($section) {
switch ($section) {
case 'admin/modules#description':
// admin/modules description
$out = 'Provides the ability to limit node creation (authoring). The settings are configurable for each node type.';
return t($out);
case 'admin/help#nodelimit':
// admin/help - overall
// basic description of module and link to help text
$out = '
This module provides the ability to limit the number of nodes your users may create (or author). ';
$out .= 'The necessary settings are configurable for each node type.