简体   繁体   English

如何更改Drupal6评论表单的重定向路径

[英]How to change redirect path for drupal6 comment form

I have tried to change the comment form redirect path with the following code. 我尝试使用以下代码更改评论表单重定向路径。

function Mymodule_form_alter(&$form, &$form_state, $form_id){
 if($form_id=='comment_form' && arg(0)=='writing'){
   $form['#redirect'] = 'writing/'.arg(1); 
 }
}

But it does not works.Anyone can help me? 但这是行不通的,有人可以帮助我吗?

Please check the arg(0) is 'writing'...? 请检查arg(0)是否为'write'...? Make sure if condition is true. 确保if condition为真。 I have tried below code and working fine. 我已经尝试下面的代码,并且工作正常。

function mymod_form_alter(&$form, &$form_state, $form_id){
  if($form_id=='comment_form' ){
    $form['#redirect'] = 'node'; 
  }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM