| 07 January 2010
On a recent upgrade of Virtuemart, anyone who tried to register with the website who had a hyphen in their email address could not register with the site. On searching, I found the following solution.
Joomla Changes:
File: includes/joomla.php
From: Code: if (eregi( "[<|>|"|'|%|;|(|)|&|+|-]", $this->username) || strlen( $this->username ) < 3) { $this->_error = sprintf( addslashes( _VALID_AZ09 ), addslashes( _PROMPT_UNAME ), 2 ); return false; }
To: Code: if (eregi( "[<|>|"|'|%|;|(|)|&|+]", $this->username) || strlen( $this->username ) < 3) { $this->_error = sprintf( addslashes( _VALID_AZ09 ), addslashes( _PROMPT_UNAME ), 2 ); return false; }
File: components/com_user/user.html.php
From: Code: var r = new RegExp("[<|>|"|'|%|;|(|)|&|+|-]", "i");
To var r = new RegExp("[<|>|"|'|%|;|(|)|&|+]", "i");
File: administrator/components/com_user/admin.users.html.php
From: Code: var r = new RegExp("[<|>|"|'|%|;|(|)|&|+|-]", "i");
To: var r = new RegExp("[<|>|"|'|%|;|(|)|&|+]", "i");
That's it for Joomla. You should now be able to register a new user without a hyphen.
Virtuemart Changes:
In in /administrator/components/com_virtuemart/classes/ps_shopper.php
Code: silent_username = substr( str_replace( '-', '_', $d['email'] ), 0, 25 );
change to
Code: change to silent_username = substr( str_replace( '-', '-', $d['email'] ), 0, 25 );


