How this can be achieved largely depends on how NODE_TYPE
is created.
Assuming you have a NODE_TYPE
module you could implement hook_validate by doing something like this:
function NODE_TYPE_validate($node, &$form) {
if (NODE_TYPE_reached_post_limit()) {
form_set_error('form_name', t('You have reached your post limit'));
}
}
function NODE_TYPE_reached_post_limit() {
global $user;
//Write code to do the following:
//-> Check which group $user belongs to
//-> Create query to see how many posts $user has made
//-> Return true if $user has reached the limit
}
If you do not have access to the module that creates the NODE_TYPE
you could create a new module and implement hook_nodeapi:
function yournewmodule_nodeapi(&$node, $op) {
switch ($op) {
case 'validate':
if ($node->type == "NODE_TYPE" && yournewmodule_reached_post_limit()) {
form_set_error('form_name', t('You have reached your post limit'));
}
break;
}
}
function yournewmodule_reached_post_limit() {
global $user;
//Write code to do the following:
//-> Check which group $user belongs to
//-> Create query to see how many posts $user has made
//-> Return true if $user has reached the limit
}
I'm not 100% sure whether validate
is the best hook to implement but it certainly is an option.