Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/drupal/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Drupal 8上注册后如何重定向用户?_Drupal_Drupal 8_User Registration - Fatal编程技术网

在Drupal 8上注册后如何重定向用户?

在Drupal 8上注册后如何重定向用户?,drupal,drupal-8,user-registration,Drupal,Drupal 8,User Registration,在用户成功注册到站点后,如何将用户重定向到特定页面 这里的drupal\u goto()不起作用。我们需要使用表单重定向。如何实现这一点?可能有点重,但您也可以使用规则模块 // include the Url namespace in your custom module use Drupal\Core\Url; // Add CUSTOM SUBMIT HANDLER FOR REGISTRATION $form['actions']['submit']['#submit'][] = '_

在用户成功注册到站点后,如何将用户重定向到特定页面


这里的
drupal\u goto()
不起作用。我们需要使用表单重定向。如何实现这一点?

可能有点重,但您也可以使用规则模块

// include the Url namespace in your custom module
use Drupal\Core\Url;

// Add CUSTOM SUBMIT HANDLER FOR REGISTRATION
$form['actions']['submit']['#submit'][] = '__tmp_registration_submit';

function __tmp_registration_submit(&$form, FormStateInterface $form_state) {
  // set relative internal path
  $redirect_path = "\user\uid\payment-history";
  $url = url::fromUserInput($redirect_path);
  // set redirect
  $form_state->setRedirectUrl($url);
}