Author Topic: Dash in username  (Read 1320 times)

happy

  • Prime Member
  • ****
  • Posts: 148
  • Karma: +0/-1
Dash in username
« on: February 02, 2018, 02:02:56 AM »
Hi

I would like to allow dash (-) in username along with alphanumeric value.

like abcde-uvxyz as username

Please guide.

Thank you.

maverick

  • Administrator
  • Veteran Member
  • *****
  • Posts: 3119
  • Karma: +210/-7
    • Maverick Webworks
Re: Dash in username
« Reply #1 on: February 02, 2018, 09:42:36 AM »
In the processors/join.php file look for the following on about line #39

Code: [Select]
if (!preg_match('/^[a-z0-9_]+$/',$input['user']) || strlen($input['user'])<4 || strlen($input['user'])>20) {
and simply replace this part [a-z0-9_]

with this [a-z0-9_-]

Fusion Responsive Template & Free Mods
http://www.maverickwebworks.com
DO NOT PM me asking for personal help. Post your problem or request in the forums so the entire community can contribute and benefit.

happy

  • Prime Member
  • ****
  • Posts: 148
  • Karma: +0/-1
Re: Dash in username
« Reply #2 on: February 03, 2018, 05:35:06 AM »
I followed your instruction but form is not submitting and got this message

'Please use only letters and digits for your username. 4-20 chars.'

Please guide

Thank you

maverick

  • Administrator
  • Veteran Member
  • *****
  • Posts: 3119
  • Karma: +210/-7
    • Maverick Webworks
Re: Dash in username
« Reply #3 on: February 03, 2018, 06:57:27 AM »
I just assumed that it would work, but looking into it further it appears that dashes are treated as special characters and are not acceptable in usernames. The programming standards only allows usernames that contain letters, numbers and underscores.

Using dashes in usernames supposedly can potentially cause conflicts and issues. Even though you may come across a few sites on web that do allow dashes, it's really not recommended.

This is probably why the original developer created it without including dashes as it wasn't considered an acceptable standard.

Since I'm not exactly sure what needs to done to accomplish allowing dashes, and because of the potential issues, it's not something I care to purse, therefore unfortunately it appears that you're stuck just using underscores.

Fusion Responsive Template & Free Mods
http://www.maverickwebworks.com
DO NOT PM me asking for personal help. Post your problem or request in the forums so the entire community can contribute and benefit.

maverick

  • Administrator
  • Veteran Member
  • *****
  • Posts: 3119
  • Karma: +210/-7
    • Maverick Webworks
Re: Dash in username
« Reply #4 on: February 05, 2018, 03:16:03 AM »
I think I've come up with a possible solution.

In the processors/join.php file look for the following on about line #39:
Code: [Select]
if (!preg_match('/^[a-z0-9_]+$/',$input['user']) || strlen($input['user'])<4 || strlen($input['user'])>20) {and replace it with this:
Code: [Select]
if (!preg_match('/^[a-z0-9]+(?:[\w\-]*[a-z0-9]+)*$/',$input['user']) || strlen($input['user'])<4 || strlen($input['user'])>20) {
Then in the js/general.js file look for the following on about line #161:
Code: [Select]
patn=/^[a-zA-Z0-9_]+$/;and replace it with this:
Code: [Select]
patn=/^[a-z0-9]+(?:[\w\-]*[a-z0-9]+)*$/;
This solution also doesn't allow dashes and underscores to be included at the start or end of a username, not only is it messy if they do it but it can cause possible issues especially if dashes are used.


You might also want to consider changing the error message so that users know everything that isn't allowed and what to check for.

In the admin go to 'Skin Settings', then click 'Translate', then scroll down to Key #63 and replace the existing error message with something like this:

Quote
Please use only letters, numerals, dashes and underscores for your username. Dashes and underscores can not be included at the start or end of your username. Must be 4-20 characters.

Fusion Responsive Template & Free Mods
http://www.maverickwebworks.com
DO NOT PM me asking for personal help. Post your problem or request in the forums so the entire community can contribute and benefit.

happy

  • Prime Member
  • ****
  • Posts: 148
  • Karma: +0/-1
Re: Dash in username
« Reply #5 on: February 06, 2018, 12:06:18 AM »
Hi maverick

I followed your instructions exactly and regenerated the skin but form is not submitting and shows same message 'Please use only letters and digits for your username. 4-20 chars'

you know if it works this will be a good feature.

Please guide

Thank you

maverick

  • Administrator
  • Veteran Member
  • *****
  • Posts: 3119
  • Karma: +210/-7
    • Maverick Webworks
Re: Dash in username
« Reply #6 on: February 06, 2018, 12:47:51 AM »
It does work, I've tested it and it's working just fine for me. I even created a new test member using a dash (test-member).

The steps that I provided only requires changing 1 line of code to 2 files and changing the message in the admin, which is a pretty simple and straight forward modification, so I'm not sure how or where you went wrong,

Make sure you've made the changes to the js/general.js file, this is important or it won't function properly.

If the message isn't changing then you're not doing something right in the admin.
When you make the changes for the new message in the admin 'Skin Settings' >> 'Translate' section, after you change the message in the #63 field make sure you click the save button at the bottom of the page. Then Regenerate your skin.

If you still don't see any change try clearing your browser cache.

I don't know what method you're using to edit the processors/join.php and js/general.js files. The ideal and proper method would be to edit them on your PC from a back up of all your files and then upload (FTP) them to your server. Try checking these 2 files on your server to make sure they contain the changes.

Fusion Responsive Template & Free Mods
http://www.maverickwebworks.com
DO NOT PM me asking for personal help. Post your problem or request in the forums so the entire community can contribute and benefit.

happy

  • Prime Member
  • ****
  • Posts: 148
  • Karma: +0/-1
Re: Dash in username
« Reply #7 on: February 07, 2018, 01:11:25 AM »
Hi Maverick

I am sorry its not working on my PC, I have Windows 7 Ultimate SP1 32-bit, XAMPP Version: 5.6.31 with PHP 5.6

I checked it several times removed cache, regenerated skin, checked both processors/join.php and js/general.js  files carefully, but same error message.

I am not able to understand whats mistake i am making.

Please guide

Thank you

maverick

  • Administrator
  • Veteran Member
  • *****
  • Posts: 3119
  • Karma: +210/-7
    • Maverick Webworks
Re: Dash in username
« Reply #8 on: February 07, 2018, 09:00:14 AM »
The change to the actual error message is done in the admin Skin Settings.

As far as it not functioning by allowing a dash in the username, that is totally reliant on the processors/join.php and js/general.js  files.

I've tested it on my local WAMP server running PHP 5.4, the PC and windows version your testing with should have nothing to do with it.

However, I'm not sure if this has anything to do with it but your PHP version is too high. Etano will not function properly using PHP 5.6 and up. If your running PHP 5.6 I'm surprised you're not having more issues with the script.

http://www.datemill.com/etano/wiki/doku.php?id=requirements


Fusion Responsive Template & Free Mods
http://www.maverickwebworks.com
DO NOT PM me asking for personal help. Post your problem or request in the forums so the entire community can contribute and benefit.

happy

  • Prime Member
  • ****
  • Posts: 148
  • Karma: +0/-1
Re: Dash in username
« Reply #9 on: February 07, 2018, 11:10:26 PM »
Hi Maverick

There is no issues running etano on PHP 5.6 except may be this dash issue.

Any way thanks for your support.

happy

  • Prime Member
  • ****
  • Posts: 148
  • Karma: +0/-1
Re: Dash in username
« Reply #10 on: March 04, 2018, 04:35:14 AM »
Hi Maverick

You provided solution for using dash in username and it worked on your end but after following your instructions its not working on my end.

Do you think just because i am using PHP 5.6 (XAMPP, windows 7) its not working for me because otherwise i am not having any other issue due to PHP 5.6, there could be some other reason. You know dash in username is very useful.

What do think

Thanks


maverick

  • Administrator
  • Veteran Member
  • *****
  • Posts: 3119
  • Karma: +210/-7
    • Maverick Webworks
Re: Dash in username
« Reply #11 on: March 04, 2018, 11:19:15 AM »
Well I can't say for sure if the issue is because you're running 5,6, but I don't know what else it could be. all I know is that php 5.6 isn't recommended for Etano, but you continue to insist that it runs Etano without issues (other than maybe the dash issue). Yet you recently posted that you also had issues with the script converting &amp; to &, which I also stated could be due to running php 5.6

Others have had various issues when running 5.6, including cron jobs working sporadically, when they changed the php version to something lower such as 5.3 or 5.4 things started functioning properly.

If you insist on using php 5.6 then I can't offer much help when you run into issues. Whenever someone says they are having an issue and are running 5.6, my support response is always to use a lower version, which the vast majority of the time fixes their issue. So my recommendation to you is to install a version of xampp with a lower version php, such as xampp version 1.8.0 or 1.8.1 or 1.8.2, older versions of xampp are available on source forge https://sourceforge.net/projects/xampp/files/XAMPP%20Windows/

Be sure to backup your Etano folder in your existing wampp installation so you can put it in your new wampp installation, that way you won't lose any of your work or changes, also back up your database as well.


Fusion Responsive Template & Free Mods
http://www.maverickwebworks.com
DO NOT PM me asking for personal help. Post your problem or request in the forums so the entire community can contribute and benefit.

maverick

  • Administrator
  • Veteran Member
  • *****
  • Posts: 3119
  • Karma: +210/-7
    • Maverick Webworks
Re: Dash in username
« Reply #12 on: March 11, 2018, 06:21:08 PM »
The BBcode upgrade is done. It is part of the new release of Etano version 2.60

To install manually download the "version2.6_upgrade_instructions.zip" file from the Etano Project Repository at Google Drive:
https://drive.google.com/folderview?id=0B5GPLc5dytbhUHltaG12cHEzMDA&usp=sharing#list

Fusion Responsive Template & Free Mods
http://www.maverickwebworks.com
DO NOT PM me asking for personal help. Post your problem or request in the forums so the entire community can contribute and benefit.

happy

  • Prime Member
  • ****
  • Posts: 148
  • Karma: +0/-1
Re: Dash in username
« Reply #13 on: March 12, 2018, 11:58:08 PM »
Thanks Maverick for new version of ETANO specially adding two new features Dash in username and more Formatting in BBCODE.

As i was expecting Dash in username is working fine in PHP 5.6 when i installed new copy of Etano. Now I have to find out why dash is not working in Etano 2.50

When i use default skin dash in username works fine but when i change skin (Vibex) then dash in username is not accepted. I think the problem is in the skin.

Please tell me how can i control font size and font color in BBCODE.

Thanks once again

maverick

  • Administrator
  • Veteran Member
  • *****
  • Posts: 3119
  • Karma: +210/-7
    • Maverick Webworks
Re: Dash in username
« Reply #14 on: March 13, 2018, 02:05:26 AM »
How to change the larger text size and option for text color was provided in the upgrade instructions.

I also added the instructions to the announcement for the release of version 2.60

http://forum.datemill.com/index.php?topic=4984.0


Fusion Responsive Template & Free Mods
http://www.maverickwebworks.com
DO NOT PM me asking for personal help. Post your problem or request in the forums so the entire community can contribute and benefit.