XF 2.2 regex for location

chrisf

Member
Is there a way to use a regex for the location field on user registration? Looking at code it looks like it would have to be something custom but I wanted to double check. We require people to put their city and state in the field and we typically only get one or the other. Like the regex for the username I would like to apply a regex for location to make sure there are at least two words in the field. It does not guarantee we get clean information but at least it stops them from submitting only one of them. Thanks!
 
Solution
It would require editing the account_details template to move the custom field to just above the website field.
A conditional statement would be required to extract the data for that field only, if you have other custom fields.

It would also require another conditional statement around the default custom field code to prevent the same field showing twice.
Interesting... we use the core location field to display peoples location in the user box. I could setup the new field and then via SQL copy the current core location field to the new custom field. From there I suspect I just need to enable the custom location in the messages style property. Is there anything else I would need to do to make it work off the top of your head? Also is there a way to put the custom location field above website so it displays in the same location as the core location. Thanks!
 
It would require editing the account_details template to move the custom field to just above the website field.
A conditional statement would be required to extract the data for that field only, if you have other custom fields.

It would also require another conditional statement around the default custom field code to prevent the same field showing twice.
 
Solution
You could disable/not use the core location field and use a custom user field, which allows for regex validation.
Is there annother solution but for core location field?
In my case the core locations field is used for a membermap (and thats good so). ;)

Copy core location field is at this case no option. I think that will require some custom code work.
 
Top Bottom