doufei4923 2010-06-11 02:45
浏览 46

使用不同模板在Drupal中拥有2个单独的用户注册表单的诀窍是什么?

I have a default user registration form that cannot change. However my boss wants a second registration form that is laid out differently than the first. I am new to Drupal so some explanation would be great.

Thank you in advance

  • 写回答

2条回答 默认 最新

  • duanmeng2842 2010-06-11 13:03
    关注

    If you create a custom module you can define a path for the second menu item using hook_menu().

    function user_menu() {
      $items['user/custom_register'] = array(
       'title' => 'Create new account',
       'page callback' => 'drupal_get_form',
       'page arguments' => array('user_register'),
       'access callback' => 'user_register_access',
       'type' => MENU_LOCAL_TASK,
       'file' => 'user.pages.inc',
       );
       return $items;
     }
    

    Of course this will not look any different to your exsisting form, it will just be a different path.

    To customize the form you have a coulpe of options, you could use hook_form_alter() and check the path. Or you could change the page arguments argument above to something which called user_register and customizes the output.

    评论

报告相同问题?