所以基本上这是我在这个问题上的第二天。
我有我的模块send_xml.module
function send_xml_form_user_register_form_alter(&$form, &$form_state) {
$form['#submit'][] = 'send_xml_submit_function';
}
function send_xml_submit_function($form, &$form_state){
$email = $form_state['values']['mail'];
$password = $form_state['values']['pass'];
$form_state['redirect'] = array(
'mylink', array(
'query' => array(
'email' => $email,
'password' => $password,
),
),
);
但它在mylink
中的流程后没有重定向,只是刷新页面。
答案 0 :(得分:0)
像这样使用hook_form_alter
:
function send_xml_form_alter(&$form, &$form_state, $form_id) {
switch ($form_id) {
case 'user_register_form':
$form['#submit'] = array('send_xml_submit_function');
break;
default:
# code...
break;
}
}
function send_xml_submit_function($form, &$form_state){
// call default submit -- this is default submit action for register form
user_register_submit($form, $form_state);
// if you use profile2 to create fields in register form then call this function too
profile2_form_submit_handler($form, $form_state);
$email = $form_state['values']['mail'];
$password = $form_state['values']['pass'];
$form_state['redirect'] = array(
'mylink', array(
'query' => array(
'email' => $email,
'password' => $password,
),
),
);
}
几个星期前我遇到了同样的问题,这是我解决的问题,实际上我并不清楚为什么这项工作以及为什么追加#submit
不起作用。
我检查了drupal user_register_submit
代码,看起来很清楚$form_state['redirect']
将用户重定向到<front>
。
答案 1 :(得分:0)
您还可以使用drupal_goto功能:
function send_xml_submit_function($form, &$form_state){
$email = $form_state['values']['mail'];
$password = $form_state['values']['pass'];
drupal_goto('REDIRECT_pATH', array('query' => array('email' => $email, 'password' => $password)));
}