XF 2.0 Location as optional on registration form

Mr Lucky

Well-known member
I would like to have location as an optional field on the registration form, but I can only find a way to show it there as being required.

Yes, I could use a custom field, but that would not show when Location is ticked in Style properties: Message user info elements

Is this possible?

Thanks
 
If I don't tick the Require box, then I see no location field in the registration form at all. It's either required or else it isn't there. Were you able to make it optional and show up in the registration form?
 
Ah I see what you mean. No, I don't require location and only show the required fields in the registration form (to make registration quicker).
 
Ah, good then I'm not imagining it!

I want to encourage users to show location, but not enforce it. Obviously I can ask them to fill the filed after registering, but it would be nice to just have the optional field there on registering.
 
You could just create a new custom user field in the meantime in place of the default, use the value html field to link to google maps or some such.
 
You could just create a new custom user field in the meantime in place of the default,

I've tried that, but the problem is gthe default (non custom) location can be ticked to show in the Style properties message elements. I specifically want the default location field to be optional but still show in registration form.
 
I've tried that, but the problem is gthe default (non custom) location can be ticked to show in the Style properties message elements. I specifically want the default location field to be optional but still show in registration form.
You can get a custom field to show when ticking Style Properties > Message Elements (tick Custom fields and make sure the custom field itself has "Viewable in message user info" ticked). In addition you can also set a custom field to be both optional and to show in the user registration form (tick/untick the relevant General options for the custom field).

Whilst this isn't exactly what you want (which is a good idea) this should achieve what you require until/if the devs implement the suggestion.
 
Whilst this isn't exactly what you want (which is a good idea) this should achieve what you require until/if the devs implement the suggestion.

OK, that's good to know I wasn't aware.

However my current situation is I have loads of users with Location already . If I change the reg. form to useing the custom field, I will be showing two entries in the message elements.
 
Just asking again because although I can do this via a user field, I have reasons not to.

So what I am after is:

Location field to show on registration form but optional. (Currently if you untick required in options, it won't show on regisatration)
 
The only way to do it with the built in functionality is to disable the core field, create a custom user field, and use a query to populate the custom user field with location data for members who have entered it in the core field.
 
OK I suspected as much.

BUT

I did just get it to work though, but maybe this will break something:

In register_macros

Code:
<xf:macro name="location_row"
    arg-fieldName="location"
    arg-value="">

    
    
        <xf:textboxrow name="{$fieldName}" value="{$value}"
            label="{{ phrase('location') }}"
            hint="{{ phrase('optional') }}" />
    
    
</xf:macro>
 
Back
Top Bottom