• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 2.0 Adding Custom Registration Box

#1
My forum is fora Facebook group and requires manual moderator approval to confirm they are members of the group. I would like to add a field to the registration for them to put their Facebook name in. However, I want this field to be hidden from their profile by default. Is there an addon or customization that I can do to the registration page.

Situation. Member Jim Jones signs up with username HamRadio1974. As of right now I have to keep posting in the facebook group reminding people to message me theire username so that I know to approve their site registration. If they had an option for them to add 'Jim Jones' to a Note field or something that is hidden from their profile view but able to be seen by Admin that would be amazing.
 

Chris D

XenForo developer
Staff member
#2
Go to Admin > Users > Custom user fields and create a new field.

Under "General options" set it up like this:

1508198438062.png

That will make the field required, make it editable by the user and only once and show it during registration. It will essentially mean the field will only be seen during registration and nowhere else (unless a moderator/admin is editing the user) and the user will need to enter a value to be able to complete the registration form.

Oh and under "Options for text fields" you can select "Validator" and type "Facebook" under "Value match requirements" and this will also ensure a value is entered in the expected format.

Because the user change log details are shown in the Approval queue, the value of the Facebook field should be shown there.
 
#3
Awesome, if I use the current Facebook contact field and change the settings as you have listed. Is there a way to force existing members to update it on their next login?
 

Chris D

XenForo developer
Staff member
#4
The only reason I didn't suggest using the existing one is in case people wanted to have it on their profile as well, in which case for your purposes you'll probably want the two fields but, yeah, you can just use the existing one if you wish.

Unfortunately there is no way to force it for existing users.
 
#5
How does the Validator work. I just did a test registration with nofacebook in the field with and it still let the test user register.
 
#6
Also, how do I view the text from the field as a moderator? It does not show up in the approval queue. The only way I could find what the test user input contained was going into edit user via admin. If I have forum moderators is there a way they can view it also?
 

Chris D

XenForo developer
Staff member
#7
How does the Validator work. I just did a test registration with nofacebook in the field with and it still let the test user register.
Oh it only detects whether the string might be valid for a Facebook profile. e.g. if you type "dfsdf sdf sdf dfs fs" that would fail because it has spaces in. In fact the only characters allowed are a-z A-Z 0-9 and dot. It will also allow you to paste in your full Facebook profile URL and it will extrapolate the ID from that.

Also, how do I view the text from the field as a moderator? It does not show up in the approval queue. The only way I could find what the test user input contained was going into edit user via admin. If I have forum moderators is there a way they can view it also?
We show the user change log details if we believe if it is possible the user could be a spammer (generally new, non-staff accounts). If you're testing this by setting the approval state on an existing user who perhaps has been around a while or staff then this is why.
 
#8
hmm, ya, it was a fresh registration. I used an incognito window, clean session. Pretending I was a new registration, it did require input into the facebook box which was good, got the confirmation email, clicked ok, test user still not able to view forums (waiting registration permissions is set that way). Then I switched over and logged into my admin account, saw the new Test User in the queue but the input from the facebook field was not viewable anywhere.
 

Chris D

XenForo developer
Staff member
#9
On reflection, that might be because we don't log a registration as a "change" as such because they're all new values rather than changes.

As an admin you can only edit a user from the Admin CP.

As a moderator, if you have the "Edit basic user profiles" option then there's a special member edit page.

You can access that by going to the user's profile, clicking the menu and selecting "Edit".

However, you might just want to edit the template, approval_item_user:

Above:
HTML:
<xf:macro template="approval_queue_macros" name="spam_log" arg-spamDetails="{$spamDetails}" />
Add:
HTML:
<xf:formrow label="{{ phrase('custom_fields') }}">
<xf:macro template="custom_fields_macros" name="custom_fields_view"
   arg-type="users"
   arg-group="{{ null }}"
   arg-set="{$content.Profile.custom_fields}"
   arg-valueClass="pairs pairs--rows" />
</xf:formrow>