function _commentaccess_get_account_settings in Comment Access 7
Returns the current commentaccess settings for the specified account.
Parameters
stdClass $account: The account to return the commentaccess settings for.
Return value
array The settings in an array with the following structure:
- commentaccess_email
- commentaccess_skip_{NODE_TYPE}
3 calls to _commentaccess_get_account_settings()
- commentaccess_comment_presave in ./
commentaccess.module - Implementation of hook_comment_presave()
- commentaccess_form_user_profile_form_alter in ./
commentaccess.module - commentaccess_requires_approval in ./
commentaccess.module - Returns TRUE if the specified comment requires approval by the comment's node's owner.
File
- ./
commentaccess.module, line 336 - Provides users with permissions for comments on nodes they own.
Code
function _commentaccess_get_account_settings($account) {
$settings = array();
if (isset($account->data['commentaccess_email'])) {
$settings['commentaccess_email'] = $account->data['commentaccess_email'];
}
else {
$settings['commentaccess_email'] = variable_get('commentaccess_mail_default', 0);
}
foreach (node_type_get_types() as $node) {
$type = $node->type;
$skip_approval_field = "commentaccess_skip_{$type}";
if (isset($account->data[$skip_approval_field])) {
$settings[$skip_approval_field] = $account->data[$skip_approval_field];
}
else {
$settings[$skip_approval_field] = variable_get('commentaccess_approval_default', 1);
}
}
return $settings;
}