content type procon_is_enabled default not retrieved in case of submit by non admin
| Project: | Pro and Con arguments |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
When a user with no "administer comments" permissions adds a node of a certain type, the procon_is_enabled default of the underlying node type is not retrieved.
Indeed, the comment/procon node edit/add form fields should not apear for such a user but the defualt procon_is_enabled value should be inherited by the newly added node (as it inherits, for example, the default comment settings of the content type).
It seems that the above behavior is due to the fact that in procon_form_alter, this default value (variable_get('procon_enabled_'. $type, 0)) is retrieved only if (user_access('administer comments')) while otherwise no retrieval is done there or elsewhere in the module.
I looked at comment.module to see how it is implemented there and I saw that the value is retrieved there in comment_nodeapi() in case of 'prepare'.
I tried to implement it in our case in the following manner in procon_nodeapi():
case 'prepare':
if (!isset($node->procon_is_enabled)) {
$node->procon_is_enabled = variable_get("procon_enabled_". $node->type, 0);
}
break;But it doesn't work for some reason.
I will appreciate a lot your kind help!

#1
Good catch, thanks for the report!
Fixed: http://drupal.org/cvs?commit=84363
#2