Posted by mrfelton on April 21, 2009 at 12:12pm
| Project: | Masquerade |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
I can't get more than about 6 users in my quick switch block as there is a limit of 128 characters on the Block Quick Switch users textfield.
Comments
#1
Quick switch settings are stored in the variables table, which has the structure of this:
CREATE TABLE IF NOT EXISTS `variable` (`name` varchar(128) NOT NULL default '',
`value` longtext NOT NULL,
PRIMARY KEY (`name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
The list of quick switch users is stored as a serialized array in the value field, which makes essentially no limit. Then the configuration for setting the form textfield is set as
$form['masquerade_quick_switches'] = array('#type' => 'textfield',
'#title' => t('Block <em>Quick Switch</em> users'),
'#autocomplete_path' => 'masquerade/autocomplete/multiple',
'#default_value' => variable_get('masquerade_quick_switches', ''),
'#description' => t('Enter the usernames, separated by commas, of accounts to show as quick switch links in the Masquerade block.')
);
and there is no #maxlength => 128 there, or 128 anywhere else in the file. You're going to have to clarify how where this 128 limit is.
#2
well, that was the error I got when I tried to submit the form after listing about 10 users that I wanted to include in the quick switch block. I also can't see where the limit is coming from though!
#3
Try again and paste the error text?
#4
I'm still getting this error:
"Block Quick Switch users cannot be longer than 128 characters but is currently 135 characters long."
Perhaps there is a limit on the length of textfields imposed by Core?
#5
I believe this is due to http://drupal.org/node/114774#variable-name-size
#6
re #5: masquerade_quick_switches isn't 128 chars long, which would be the variable's name. That's not 128 chars. I think this related to #508280: OPML remote location should accept longer URLs, where apparently FAPI defaults to 128 char limit on text fields if a maxlength isn't defined. See line ~172 of system.module.
$type['textfield'] = array('#input' => TRUE, '#size' => 60, '#maxlength' => 128, '#autocomplete_path' => FALSE, '#process' => array('form_expand_ahah'));Anyway, just set a #maxlength on the fapi element and see what happens.
#7
Here is a patch which sets #maxlength to NULL, removing the FAPI limit for both the "menu" and "block quick switch textfields. As is, they are both limited to 128 characters as mentioned in #6.
#8
Here is a rerolled patch which I will be committing in a moment.
#9
Automatically closed -- issue fixed for 2 weeks with no activity.