function activity_comments_form_submit in Activity 6.2
Same name and namespace in other branches
- 7 activity_comments/activity_comments.module \activity_comments_form_submit()
Implementation of hook_submit() for activity_comments_form.
File
- activity_comments/
activity_comments.module, line 196 - Provides comment handling for activity messages
Code
function activity_comments_form_submit($form, &$form_state) {
global $user;
//store the activity comment
$record = new stdClass();
$record->comment = $form_state['values']['activity_comment'];
$record->uid = $user->uid;
$record->aid = $form_state['values']['aid'];
$record->timestamp = time();
drupal_write_record('activity_comments', $record);
drupal_alter('activity_comment', $record);
db_query("UPDATE {activity_comments_stats} SET comment_count = comment_count + 1, changed = %d WHERE aid = %d", time(), $form['aid']['#value']);
if (!db_affected_rows()) {
db_query("INSERT INTO {activity_comments_stats} (aid, changed, comment_count) VALUES (%d, %d, 1)", $form['aid']['#value'], time());
}
}