From c6328111a3127706ba514059eb76fa249e660f21 Mon Sep 17 00:00:00 2001 From: Dries Buytaert <dries@buytaert.net> Date: Thu, 9 Feb 2006 08:20:49 +0000 Subject: [PATCH] - Patch #48242 by markus: add/edit form in user access rules is broken. --- modules/user.module | 6 ++++-- modules/user/user.module | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/modules/user.module b/modules/user.module index db35fd027bf8..86e63e43e478 100644 --- a/modules/user.module +++ b/modules/user.module @@ -1530,17 +1530,19 @@ function _user_admin_access_form($edit) { '#default_value' => 0, '#options' => array('1' => t('Allow'), '0' => t('Deny')), ); + $type_options = array('user' => t('Username'), 'mail' => t('E-mail'), 'host' => t('Host')); $form['type'] = array( '#type' => 'radios', '#title' => t('Rule type'), - '#default_value' => 'user', - '#options' => array('user' => t('Username'), 'mail' => t('E-mail'), 'host' => t('Host')), + '#default_value' => (isset($type_options[$edit['type']]) ? $edit['type'] : 'user'), + '#options' => $type_options, ); $form['mask'] = array( '#type' => 'textfield', '#title' => t('Mask'), '#size' => 30, '#maxlength' => 64, + '#default_value' => $edit['mask'], '#description' => '%: '. t('Matches any number of characters, even zero characters') .'.<br />_: '. t('Matches exactly one character.'), '#required' => TRUE, ); diff --git a/modules/user/user.module b/modules/user/user.module index db35fd027bf8..86e63e43e478 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -1530,17 +1530,19 @@ function _user_admin_access_form($edit) { '#default_value' => 0, '#options' => array('1' => t('Allow'), '0' => t('Deny')), ); + $type_options = array('user' => t('Username'), 'mail' => t('E-mail'), 'host' => t('Host')); $form['type'] = array( '#type' => 'radios', '#title' => t('Rule type'), - '#default_value' => 'user', - '#options' => array('user' => t('Username'), 'mail' => t('E-mail'), 'host' => t('Host')), + '#default_value' => (isset($type_options[$edit['type']]) ? $edit['type'] : 'user'), + '#options' => $type_options, ); $form['mask'] = array( '#type' => 'textfield', '#title' => t('Mask'), '#size' => 30, '#maxlength' => 64, + '#default_value' => $edit['mask'], '#description' => '%: '. t('Matches any number of characters, even zero characters') .'.<br />_: '. t('Matches exactly one character.'), '#required' => TRUE, ); -- GitLab