在用户/注册页面drupal 7中需要密码和确认密码字段

时间:2013-11-18 07:07:00

标签: drupal-7

我是drupal的新手。我想要从admin / people / create到用户/注册页面的字段(密码,确认密码,角色)。

用户可以创建具有特定角色的帐户。当用户注册他们的帐户时,我怎样才能实现这一点。

3 个答案:

答案 0 :(得分:1)

借助此代码片段_form();

Drupal Form API password_confirm元素

$form['pass_fields'] = array(

  '#type' => 'password_confirm' ,

  '#description' => t('Enter the same password in both fields'),

  '#size' => 32,

  '#required' => TRUE,
);

在_form();中检查或自动保存用户角色:

$role = 'user-role';

array( 'roles' => $roles );

答案 1 :(得分:0)

您可以使用此模块https://drupal.org/project/autoassignrole

此外,如果取消选中选项,则在访问者创建帐户时需要电子邮件验证。主页»管理»配置»人员

然后您将获得密码并在用户注册表中确认密码字段。

答案 2 :(得分:0)

我使用以下代码创建了user-register-form.tpl.php。

<?php print render($form['account']); ?>
<?php print render($form['form_build_id']); ?>
<?php print render($form['form_id']); ?>
<?php print drupal_render($form['actions']); ?>

我取消选中需要电子邮件验证链接。使用profile2_regpath模块我检查了角色。这是为了在用户创建帐户时,角色将自动分配给用户。