XF 1.5 Custom user fields

#1
I want to know if its possible to change the display order of customer fields along with Xenforo pre-built fields such as Name, email etc. Example: I have added a new customer field 'Title' and want to display it in the registration before Xenforo pre-built field 'Name'. Similarly want to display custom 'Phone' field after pre-built 'Email'. Below is the order.

1) Title
2) Name
3) Email
4) Phone

I have already changed the display order for the pre-built fields in the template. But could not find a way to sort custom fields as its driven by loop rather individual fields in the template.



I will appreciate any pointers here.

Thanks.
 

Jake Bunce

XenForo moderator
Staff member
#2
It would be cumbersome to do this with template edits. I suggest using javascript to move the fields on document ready. For example:

Admin CP -> Appearance -> Templates -> register_form

Add this code to the top:

Rich (BB code):
<script type="text/javascript">

$(document).ready(function(){
	var usernameDL = $('input#ctrl_username').parent().parent();
	var myCustomFieldDL = $('dl.customFieldEdittestfield');
	
	myCustomFieldDL.insertAfter(usernameDL);
});

</script>
You just need to inspect the page and make sure you are selecting the right elements.
 
#3
Hi Jake,

Thanks for responding to my query. I tried your code but it did not work. I suppose the red 'testfield' in your code refers to the custom field name that I used while adding this custom field. E.g. Title, Phone etc. Any other pointer what I might be doing wrong here? Also what 'd1' in your code is referring to?
Regards,
 

Jake Bunce

XenForo moderator
Staff member
#5
Hi Jake,

Thanks for responding to my query. I tried your code but it did not work. I suppose the red 'testfield' in your code refers to the custom field name that I used while adding this custom field. E.g. Title, Phone etc. Any other pointer what I might be doing wrong here? Also what 'd1' in your code is referring to?
Regards,
Yes, it is the field id. You need to inspect the page source to confirm the selectors. More generally, this requires some js and jQuery ability.

If you post the URL of your forum then I can inspect the register page and confirm the selectors for use in the javascript.
 
Top