function nfsmigrate_migrate_commentformsettings in Node and Comments Form Settings 6.3
Same name and namespace in other branches
- 6.2 nfsmigrate/nfsmigrate.module \nfsmigrate_migrate_commentformsettings()
1 string reference to 'nfsmigrate_migrate_commentformsettings'
- nfsmigrate_settings in nfsmigrate/
nfsmigrate.module
File
- nfsmigrate/
nfsmigrate.module, line 107
Code
function nfsmigrate_migrate_commentformsettings($form, &$form_state) {
foreach (node_get_types('names') as $type => $type_name) {
// Build the import array filled with old values
$old_anonymousname = variable_get('commentformsettings_anonymousname_' . $type, '');
$old_anonymousmail = variable_get('commentformsettings_anonymousmail_' . $type, '');
$old_anonymoushomepage = variable_get("commentformsettings_anonymoushomepage_" . $type, '');
$old_author = variable_get("commentformsettings_author_" . $type, '');
$old_preview = variable_get("commentformsettings_preview_" . $type, '');
$old_title = variable_get("commentformsettings_title_" . $type, '');
$old_inputformat = variable_get("commentformsettings_inputformat_" . $type, '');
$old_size = variable_get("commentformsettings_size_" . $type, '');
$old_submit = variable_get("commentformsettings_submit_" . $type, '');
$import = array(
'cfs_anonymousname' => isset($old_anonymousname) ? $old_anonymousname : 0,
'cfs_anonymousmail' => isset($old_anonymousmail) ? $old_anonymousmail : 0,
'cfs_anonymoushomepage' => isset($old_anonymoushomepage) ? $old_anonymoushomepage : 0,
'cfs_author' => isset($old_author) ? $old_author : 0,
'cfs_inputformat' => isset($old_inputformat) ? $old_inputformat : 0,
'cfs_pnc' => array(
'cfs_post_new_comment' => 0,
'cfs_post_new_comment_value' => '',
),
'cfs_preview' => isset($old_preview) ? $old_preview : 0,
'cfs_size' => isset($old_size) ? $old_size : 10,
'cfs_submit' => isset($old_submit) ? $old_submit : t("Submit"),
'cfs_title' => isset($old_title) ? $old_title : 0,
);
// Set the new variable
variable_set('commentformsettings_' . $type, $import);
// Delete all old variables
variable_del('commentformsettings_anonymousname_' . $type);
variable_del('commentformsettings_anonymousmail_' . $type);
variable_del("commentformsettings_anonymoushomepage_" . $type);
variable_del("commentformsettings_author_" . $type);
variable_del("commentformsettings_preview_" . $type);
variable_del("commentformsettings_title_" . $type);
variable_del("commentformsettings_inputformat_" . $type);
variable_del("commentformsettings_size_" . $type);
variable_del("commentformsettings_submit_" . $type);
}
$out .= "<p>This is the new result of the conversion process. Please review the array values and fix if necessary</p><p></p>";
drupal_set_message($out);
foreach (node_get_types('names') as $type => $type_name) {
// Return the final result
$val[$type] = variable_get('commentformsettings_' . $type, '');
}
drupal_set_message('<pre>' . htmlentities(print_r($val, 1)) . '</pre>');
}