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

Custom Profile Field - Callback for member_autocomplete

Discussion in 'XenForo Development Discussions' started by KozmoK, Jul 28, 2013.

  1. KozmoK

    KozmoK Active Member

    Hello! And thanks for looking at this

    I'd like to add "Referrer" to my registration, is there a php callback I can use to do the "member_autocomplete" so they don't have to know how to spell the username?

    Edit: I am guessing the callback is executed when the field validates, in which case I would need to check if the person exists.

    Thanks in advance,

    Kozmo


    Update: I figured it out myself.

    I added a enum directly in the sql table for xf_user_field for type "usersearch"

    then on the custom referrer field, I went in and changed the type manually in phpmyadmin to "usersearch" that I just added the enum to, then....

    one simple edit on "custom_field_edit" added the green lines (well I guess I can't add green to the HTML/CODE tags... Anyways, its the field_type usersearch block

    HTML:
    <xen:elseif is="{$field.field_type} == 'textarea'" />
                <textarea name="custom_fields[{$field.field_id}]"
                    id="ctrl_custom_field_{$field.field_id}"
                    data-validatorname="custom_field_{$field.field_id}"
                    class="textCtrl Elastic">{$field.field_value}</textarea>
            <xen:elseif is="{$field.field_type} == 'usersearch'" />
                <input type="search" name="custom_fields[{$field.field_id}]"
                value="{$field.field_value}"
                placeholder="{xen:phrase name}..." results="0" class="textCtrl AutoComplete"
                data-validatorname="custom_field_{$field.field_id}"
                data-autoSubmit="true" />
        
            <xen:elseif is="{$field.field_type} == 'radio'" />
     
    Last edited: Jul 28, 2013

Share This Page