function facebook_comments_admin_applyall in Facebook Comments Social Plugin 7
Form submission handler for facebook_comments_admin().
See also
1 string reference to 'facebook_comments_admin_applyall'
- facebook_comments_admin in ./
facebook_comments.module - Configure Facebook comments settings like the Facebook App ID.
File
- ./
facebook_comments.module, line 216 - Facebook Comments Social Plugin module file.
Code
function facebook_comments_admin_applyall(&$form, $form_state) {
if ($form_state['values']['facebook_comments_applyall']) {
$types = array();
foreach ($form_state['values']['facebook_comments_types'] as $key => $value) {
if (!empty($value)) {
$types[] = $key;
}
}
$results = db_select('node', 'n')
->fields('n', array(
'nid',
))
->condition('type', $types, 'IN')
->execute();
while ($result = $results
->fetchAssoc()) {
db_merge('facebook_comments')
->key(array(
'nid' => $result['nid'],
))
->fields(array(
'enabled' => 1,
))
->execute();
}
drupal_set_message(t('Facebook comments have been enabled on existing content for the selected content types.'));
}
}