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

Custom User Field Questions

#1
I have a few questions in regards of having a custom user field:

1. How can I have a field be unique? As in, only one user can have the same value for the field, like a username.

2. How can I have two fields to be required to run a php callback? Say, a field for username and field for password. Then, after the validation is made, to have only the username field show.

3. How can I have "thank you" "error" when the field has been updated? I tried returning true with $error = 'Thank you for joining blah';
 

Jake Bunce

XenForo moderator
Staff member
#2
1) Use a callback:

http://xenforo.com/community/resources/custom-user-field-callback-validate-value.379/

To verify the value against a user database you will need to connect to that database. Here is a code example for connecting to a database:

http://xenforo.com/community/resources/run-query-on-user-upgrade-code-example.396/

This requires programming ability.

2) There is no such option. That would require you to extend the register controller with an addon. That way you can verify the two fields together.

3) Assuming you are referring to this callback:

http://xenforo.com/community/resources/custom-user-field-callback-validate-value.379/

...the error is only shown if you return false.
 
#3
1. Never saw the second link before. So I need query db::xf_user_field_value, correct?

3. It is. So there is no way to show a message on true then in vanilla, that is, without an addon, correct?