MyBB Community Forums

Full Version: Custom Profile Field Stops users from being edited/created in ACP
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Howdy,

I'm having an issue with MyBB 1.8.0.7 I created a Custom Profile field that isn't required, shows up on the Registration Page, user profile and Postbit. I used the Regular statement ^[0-9] so that the field only allows numbers.

The only problem is when I attempt to create a new user, or edit an existing user in the AdminCP I get this error. 

You did not enter a valid value for the "Online ID" field. Please enter a valid value before continuing

The field isn't required to be filled out, the way its set makes it so It's completely optional. So why is my ACP blocking me from completing these actions?

My forum URL is http://pokemonuranium.co

Below is an image of the settings
[Image: da164f4b34b1a230fc3e6d78aa66bf6c.png]

If it helps, the only Mod I have installed is Last post Avatar by DarkNeo

Thanks!
~C
It looks like this is a custom profile field, Online ID isn't standard I don't think. Is this something you've added?
(09-16-2016, 08:03 AM)Matt Wrote: [ -> ]It looks like this is a custom profile field, Online ID isn't standard I don't think. Is this something you've added?

Hey Matt! Thanks for getting back to me so quickly!

Yes, as I mentioned earlier, as well as in the thread title itself, this is a Custom Profile Field. Smile
Ah, sorry my bad, was replying quickly Big Grin

On looking at the code though, this looks like a bug to me. I'll try and verify later this evening and file a report for you if that's the case.

As a temporary fix, in ./inc/datahandelrs/user.php, line 588:

if(!empty($profilefield['regex']) && !preg_match("#".$profilefield['regex']."#i", $profile_fields[$field]))

Change this to:

if(strlen($profile_fields[$field]) > 0 && !empty($profilefield['regex']) && !preg_match("#".$profilefield['regex']."#i", $profile_fields[$field]))

Does that fix it?

I think the issue is that even though it may not be required, it still needs to validate the input, however should only do this if a value is provided.
Yup, that did it! Thank you, Matt, you glorious human being! Big Grin