I'm using answers module to building a questions/answers website. now I want to know how to submit a question immediately without going to the question editing form. now when I'm in "Search & Add Page" click on "Continue With Your Question" button, it goes to the question form. how to modify the answers code to make keywords immediately submitted as a question.

Comments

anshul.udapure’s picture

Hi use custom module,in that module you can use hook_form_submit handler to save informations directly the way you want with

function MY_MODULE_NAME_form_submit($form, &$form_state) {
  variable_set('MY_MODULE_NAME_setting1', $form_state['values']['MY_MODULE_NAME_setting1']);
  
  drupal_set_message('The MY_MODULE_NAME settings have been saved at '.date("d/m/Y H:i:s"));
}

node_save or other PDO functions available. with something similar

$node->nid = intval($insert['id']);
$node->vid = intval($insert['id']);
$node->uid = 1;
$node->type = 'nodetype';

$node->title = $insert['name'];
$node->created = time();
$node->changed = $node->created;
$node->promote = 0;
$node->sticky = 0;
$node->format = 2;
$node->status = 1;
$node->language = 'en';

$node->field_custom_1 = array('und' => array(array( 'value' => $insert['foo'] )));
$node->field_custom_2 = array('und' => array(array('value' => $insert['hello'])));
$node->field_custom_3 = array('und' => array(array('value' => $insert['world']))); 

if ($node = node_submit($node)) {
    node_save($node);       
    drupal_set_message(t("Node ".$node->title." : ".$node->nid." added correctly"));
}
else { 
    drupal_set_message(t("Node ".$node->title." added incorrectly"), "error");
}