Setting the maximum length of usernames above 25 will have no effect, since this length is enforced in the XoopsUser class.
Not even in 3rd party modules such as SmartProfile is it possible to overcome this (without some rather nasty code involving $user->vars['uname']['maxlength'] = xx;)
The attached patch is rather simple, as it merely removes the fourth parameter to $this->initVar('uname', [...]); in the XoopsUser constructor.
Patch file and class file
Logged In: YES
user_id=1095348
Originator: NO
Jan, I get errors when trying to unpack the zip archive. Could you perhaps re-package and re-upload, or package in a different format maybe?
Rowd
Logged In: YES
user_id=841117
Originator: YES
Annoying. I seem to get that a bit from 7-zip.
I'll just attach the patch file.
File Added: user_maxlength_patch.patch
Patch file only
Logged In: YES
user_id=1095348
Originator: NO
Thanks Jan, I can download the patch file now.
The maximum length though is actually 'enforced' by the length of the database table field. One of the reasons for initialising the 'uname' field to 25 in user.php is to prevent uname characters (if length > 25) from being silently discarded when the user database record is updated.
What exactly are you trying to do in your module?
Logged In: YES
user_id=841117
Originator: YES
Oh bugger - forgot about the database length.
Well. That should be enlarged quite a bit, too. Perhaps to the 255 char limit. Then the enforcement of username lengths will rely solely on the length set in the preferences.
However, the maxlength is hard-coded in such places as the registration and edit processes and login form templates. This could of course be remedied in the core, but not even in custom modules can this be overcome due to the XoopsObject and database restriction, so removing that would be a small change that would allow for other modules to remedy the template and registration/edit process - unless you want to change that in the core together with the XoopsObject/Database changes.
The idea was for a small change that would open up possibilities for module developers while remaining a very small task for the core devs.
Logged In: YES
user_id=1095348
Originator: NO
What I don't understand is why you find it necessary to have a login name greater than 25 characters in length?
I have never (to my knowledge) used a system with a user login name field that long, and find it pretty cumbersome to a) think of a name longer than 25 characters ;-) and b) fill it out everytime I log in.
I'm not seeing a reason to make this change...
Logged In: YES
user_id=441189
Originator: NO
IF you'd want to use e-mail addresses as login names, you'll get closer to the 25 characters easily:
herko.coomans[ at]advies.overheid.nl = 32 characters. Having the option to have long login names will makes this possible at least.
Herko
Logged In: YES
user_id=841117
Originator: YES
Well, it is one of those situations, where users might want something different from what we can imagine being useful.
I think that this restriction should be in the hands of the webmasters (through the preference of max. username length) rather than in the database/XoopsObject.