Jump to the post that solved this thread.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Not Solved Custom Profile Field stopping user registration / not showing on registration
#1
Not Solved
Hey everyone

I have been having this frustrating problem that has been causing my new forum to stop users to register a new account because of the following: 

On my forum I did add a custom profile field to add an image to their profile to use as a header (like on facebook or twitter). I set the custom profile field up the following:
[Image: 278c304cbc1543178cafe2047c0d7729.png]
Also I have set the regular expression to: '|^https?://[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i'
so that only a url can be entered

But now my problem is when someone tries to register a new account the following happens:
> You can not see the profile field
> Error happens: field not entered correctly

Here is a screenshot: http://prntscr.com/bduuv4

I hope you can help me with this! Thanks! Smile

Edit: I forgot to mention that I also do not want the header image field on the registration page. That's why I am completely confused because I have also set it to not show on registration but it's still giving me the error and stopping new members from registering
Reply
#2
Not Solved
Try:
^$|^(https?://[a-z0-9-]+(\.[a-z0-9-]+)*(:[0-9]+)?(/[^<>'"]*)?)$
  • removed pattern delimiters (MyBB concatenates the regex with its own - see https://github.com/mybb/mybb/blob/mybb_1...r.php#L588)
  • removed i flag (assuming that was the intent - placed incorrectly), which MyBB supplies
  • introduced a ^$|^...$ scheme to match empty values (they're always checked on registration page)
  • escaped the dot character: \.
  • added constraint for characters after the slash not co contain <>'" (*)

Things to consider:
  • * You should neutralize the value when outputting it nonetheless, if possible (e.g. if you are using a plugin you can use MyBB's internal function htmlspecialchars_uni())
  • the regex is relatively simple, thus it doesn't take into account e.g. internationalized domain names (using non-Latin characters), and still might allow weird characters at the end. For comparison, you can look at battle-hardened @diegoperini's example at https://mathiasbynens.be/demo/url-regex
devilshakerz.com/pgp (DF3A 34D9 A627 42E5 BC6A 6750 1F2F B8AA 28FF E1BC) ▪ keybase.io/devilshakerz
Reply
Jump to the post that solved this thread.


Forum Jump:


Users browsing this thread: 1 Guest(s)