XF 1.5 Can't find any info on Registration Options in manual

Jim McClain

Member
I have spent a lot of time searching for all the various options for registration in the xenForo manual, but can find precious little.

There is a default profile field for Occupation, but apparently it is not editable, nor is it an option to make this field required during registration. I would like this to be the case, but I can find nothing in the manual about the field. I have found other xF threads that mention the field being on their registration forms, but it isn't on mine.

When my forum was powered by vB 3.8, I did have a field for Occupation and all of that info was converted to the xF profiles. So, how do I make that a required field on the registration form? Or is my xF installation wonky somehow?
 
The default occupation field is not a custom field - it's a core field much like other fields like a username or email address. There's a few other fields like this, including homepage, gender and location.

You can make your occupation field required and make it appear during registration by editing that field on the Admin CP > Users > Custom User Fields page.

Coincidentally we are removing this field in XF 2.0 and converting it to a custom field (for upgrades only) so you're a bit ahead of the game having it as a custom field now ;)

Of course you'll have the issue of having two occupation fields, so to address that you'll need to remove the core field from the account_personal_details template, manually.
 
Thanks for the quick reply, Chris. So, the default Occupation field was not a configurable option to show on the registration form? I thought I saw it on a screenshot or mentioned in one of the search results I found.

I'm hesitant about editing templates. I had lots of custom edits to templates in vB, but I am not familiar with the xF system enough yet. What happens to custom edits when there is a xF update?

What is the proper markup to hide something in a template, if I don't want to completely remove it (I usually do that during testing and then remove if my edits work). Will <!-- --> work, or should I use <xen:comment> </xen:comment>?
 
Thanks for the quick reply, Chris. So, the default Occupation field was not a configurable option to show on the registration form? I thought I saw it on a screenshot or mentioned in one of the search results I found.
No, it's not configurable. Perhaps other people have done the same thing with a custom field or they had an add-on to display it.
I'm hesitant about editing templates. I had lots of custom edits to templates in vB, but I am not familiar with the xF system enough yet. What happens to custom edits when there is a xF update?
Your edits will take priority between upgrades. If we modify the same template during an upgrade (which is unlikely - we haven't modified that template since XenForo 1.3.0 Alpha) then the template will be marked as "outdated". This is where your edit still exists, but the system knows a newer version of the template is available. When a template is marked as outdated, there is a 3 way merge system which will allow you to often automatically merge your changes into the new version of the template.

There's some details about that here: https://xenforo.com/community/resources/a-guide-to-xenforo-1-2-and-templates.2115/ Specifically the "Directly Editing Templates" part.

What is the proper markup to hide something in a template, if I don't want to completely remove it (I usually do that during testing and then remove if my edits work). Will <!-- --> work, or should I use <xen:comment> </xen:comment>?
Yeah, I'd use the <xen:comment> tags.
 
Thanks for the information, Chris. That's very helpful.

Since I now have a new profile field that is required to complete the registration, I'd like to eliminate the redundancy by commenting out the default Occupation field that shows in member profiles and cards. However, probably a third of my 15,000 members have a value in that field from my vB installation. I'm wondering if there is a database query that could be run in MyPHPadmin that will copy or move all the existing data in the default Occupation field to the new custom profile field. If I could run that query, I can safely remove the default field without removing the important information it provides in my user's profile.

My long-term hope is that profiles will be more advanced in future versions of xF. For my niche oriented forum that also gets a lot of traffic from consumers and DIYers, this is an important feature of the site.
 
Update: I edited 6 templates to remove from view the default Occupation field, commenting each element out. These are the templates:

account_personal_details
member_edit
member_view
member_view_share_block
message_user_info
news_feed_item_user_occupation​
 
I recommend taking a full database back up before doing this, but I think the query you need is:

Code:
UPDATE xf_user_field_value AS ufv
SET ufv.field_value = (
   SELECT up.occupation
   FROM xf_user_profile AS up
   WHERE ufv.user_id = up.user_id
)
WHERE ufv.field_id = 'customfield';
Where 'customfield' is the ID of the occupation field in XF.

Then rebuild the user cache:

Admin CP > Tools > Rebuild Caches > Rebuild User Caches
 
Thanks Chris. I'll give that a whirl.
Wellll, I'm not sure that dance was as satisfying as I'd hoped. The query ran very quickly - just a few seconds. Then I rebuilt user caches, which took 20 minutes or so (I didn't actually watch the clock, but it felt like 20). I looked at my own profile and did not see a change. I looked at other profiles I knew had data in the default Occupation and not in my custom profile field and I saw "Occupation" with data in it, but didn't see my custom profile field, which should have been titled "Your Occupation."

I remember earlier hiding all of the default Occupation instances, so I thought that was odd they showed in the profiles. Is there a chance that the field viewable to the public was renamed Occupations from my Your Occupation? I go into my Personal Details form and the only Occupation visible is Your Occupation. The text box is empty, so I change my occupation, that forced me to edit the regular expression I used in the Value Match Requirements because the system spit out an error, then saved my new occupation and it shows just like it should.

I don't know what happened, but it all seems to be working just the way I want. I did rename the title of the field to "Occupation" so the person reading it doesn't think some idiot titled it wrong. All I can think is what I have been told by more than a few xF fanboys: it's magical. Yep, it is. :D
 
Back
Top Bottom