function comment_og_form in Comment OG 6
Modified version of comment_form() used for editing by group administrators
1 string reference to 'comment_og_form'
- comment_og_form_box in ./
comment_og.module - Modified version of comment_form_box() used for editing by group administrators
File
- ./
comment_og.module, line 285
Code
function comment_og_form(&$form_state, $edit, $group) {
global $user;
$op = isset($_POST['op']) ? $_POST['op'] : '';
$node = node_load($edit['nid']);
$edit += array(
'name' => '',
'mail' => '',
'homepage' => '',
);
if ($user->uid && og_is_group_admin($group)) {
if (!empty($edit['author'])) {
$author = $edit['author'];
}
elseif (!empty($edit['name'])) {
$author = $edit['name'];
}
else {
$author = $edit['registered_name'];
}
$form['_author'] = array(
'#type' => 'item',
'#title' => t('Authored by'),
'#value' => $author,
);
$form['author'] = array(
'#type' => 'value',
'#value' => $author,
);
}
if (variable_get('comment_subject_field_' . $node->type, 1) == 1) {
$form['subject'] = array(
'#type' => 'textfield',
'#title' => t('Subject'),
'#maxlength' => 64,
'#default_value' => !empty($edit['subject']) ? $edit['subject'] : '',
);
}
if (!empty($edit['comment'])) {
$default = $edit['comment'];
}
else {
$default = NULL;
}
$form['comment_filter']['comment'] = array(
'#type' => 'textarea',
'#title' => t('Comment'),
'#rows' => 15,
'#default_value' => $default,
'#required' => TRUE,
);
if (!isset($edit['format'])) {
$edit['format'] = FILTER_FORMAT_DEFAULT;
}
$form['comment_filter']['format'] = filter_form($edit['format']);
$form['cid'] = array(
'#type' => 'value',
'#value' => !empty($edit['cid']) ? $edit['cid'] : NULL,
);
$form['pid'] = array(
'#type' => 'value',
'#value' => !empty($edit['pid']) ? $edit['pid'] : NULL,
);
$form['nid'] = array(
'#type' => 'value',
'#value' => $edit['nid'],
);
$form['uid'] = array(
'#type' => 'value',
'#value' => !empty($edit['uid']) ? $edit['uid'] : 0,
);
// Only show save button if preview is optional or if we are in preview mode.
// We show the save button in preview mode even if there are form errors so that
// optional form elements (e.g., captcha) can be updated in preview mode.
if (!form_get_errors() && (variable_get('comment_preview_' . $node->type, COMMENT_PREVIEW_REQUIRED) == COMMENT_PREVIEW_OPTIONAL || $op == t('Preview') || $op == t('Save'))) {
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save'),
'#weight' => 19,
);
}
$form['preview'] = array(
'#type' => 'button',
'#value' => t('Preview'),
'#weight' => 20,
);
$form['#token'] = 'comment' . $edit['nid'] . (isset($edit['pid']) ? $edit['pid'] : '');
if ($op == t('Preview')) {
$form['#after_build'] = array(
'comment_og_form_add_preview',
);
}
if (empty($edit['cid']) && empty($edit['pid'])) {
$form['#action'] = url('comment/reply/' . $edit['nid']);
}
return $form;
}