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

Registration Referrer Member AutoComplete

KozmoK

Active member
#1
KozmoK submitted a new resource:

Registration Referrer - Registration Referrer Template mod

If you ever wanted to have your custom registration referral field do a XenForo member name auto complete, then this tweak is for you. Its probably not the right way to do it, as I add a enum type to the XenForo table, but it was quick and easy.

Please backup your db, as necessary as I am not responsible for anything you did to your forum.

Step 1
Create a Custom referrer field in AdminCP - set all the options you want on it.

Step 2...
Read more about this resource...
 

KozmoK

Active member
#3
Its a custom registration field


Well, on my site - I like to reward people who send people to my site, so I want them to fill it out to credit the propper people if they purchase a subscription.

So - with this mod, it allows them to find the member properly.
 

KozmoK

Active member
#5
I had made two versions of this, one with the db edits, and php file edits, and found that the template edit is much easier for the novice so I removed the ones with php edits/sql.
 
Last edited:

KozmoK

Active member
#7
Ok I reverted and tested it, it worked fine:

Here is the first 26 lines of "custom_field_edit" Green is inserted, and red is altered, black is existing.... if it still doesnt work, please paste these lines from your template here...i'm sure it something simple.

<dl class="ctrlUnit customFieldEdit{$field.field_id}">
<dt>
<label for="ctrl_custom_field_{$field.field_id}">{$field.title}:</label>
<xen:if is="{$field.required}"><dfn>{xen:phrase required}</dfn></xen:if>
</dt>
<dd>

<xen:if is="{$field.field_id} == 'Referrer'">
<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} == 'textbox'" />
<input type="text" name="custom_fields[{$field.field_id}]" value="{$field.field_value}"
id="ctrl_custom_field_{$field.field_id}"
data-validatorname="custom_field_{$field.field_id}"
class="textCtrl" maxlength="{xen:if $field.max_length, $field.max_length}"
/>

<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} == 'radio'" />
 
Last edited:
#8
Template custom_field_edit :(

Code:
<dl class="ctrlUnit">

    <dt>
        <label for="ctrl_custom_field_{$field.field_id}">{$field.title}:</label>
        <xen:if is="{$field.required}"><dfn>{xen:phrase required}</dfn></xen:if>
    </dt>
    <dd>
        <xen:if is="{$field.field_type} == 'textbox'">
            <input type="text" name="custom_fields[{$field.field_id}]" value="{$field.field_value}"
                id="ctrl_custom_field_{$field.field_id}"
                data-validatorname="custom_field_{$field.field_id}"
                class="textCtrl" maxlength="{xen:if $field.max_length, $field.max_length}"
            />
        <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} == 'radio'" />
            <ul class="checkboxColumns">
            <xen:if is="!{$field.required}">
                <li><label><input type="radio" name="custom_fields[{$field.field_id}]" value="" {xen:checked '{$field.field_value} == ""'} /> <span class="muted">{xen:phrase no_selection}</span></label></li>
            </xen:if>
            <xen:foreach loop="$field.fieldChoices" key="$choice" value="$text">
                <li><label><input type="radio" name="custom_fields[{$field.field_id}]" value="{$choice}" {xen:checked '{$field.field_value} == {$choice}'} /> {xen:raw $text}</label></li>
            </xen:foreach>
            </ul>
        <xen:elseif is="{$field.field_type} == 'select'" />
            <select name="custom_fields[{$field.field_id}]" id="ctrl_custom_field_{$field.field_id}" class="textCtrl">
            <xen:if is="!{$field.required} OR !{$field.hasValue}">
                <option value="">&nbsp;</option>
            </xen:if>
            <xen:foreach loop="$field.fieldChoices" key="$choice" value="$text">
                <option value="{$choice}" {xen:selected '{$field.field_value} == {$choice}'}>{xen:raw $text}</option>
            </xen:foreach>
            </select>
        <xen:elseif is="{$field.field_type} == 'checkbox'" />
            <ul class="checkboxColumns">
            <xen:foreach loop="$field.fieldChoices" key="$choice" value="$text">
                <li><label><input type="checkbox" name="custom_fields[{$field.field_id}][{$choice}]" value="{$choice}" {xen:checked 'isset({$field.field_value.{$choice}})'} /> {xen:raw $text}</label></li>
            </xen:foreach>
            </ul>
        <xen:elseif is="{$field.field_type} == 'multiselect'" />
            <select name="custom_fields[{$field.field_id}][]" id="ctrl_custom_field_{$field.field_id}" class="textCtrl" size="7" multiple="multiple">
            <xen:if is="!{$field.required} OR !{$field.hasValue}">
                <option value="">&nbsp;</option>
            </xen:if>
            <xen:foreach loop="$field.fieldChoices" key="$choice" value="$text">
                <option value="{$choice}" {xen:selected 'isset({$field.field_value.{$choice}}'}>{xen:raw $text}</option>
            </xen:foreach>
            </select>
        </xen:if>

        <xen:if hascontent="true"><p class="explain"><xen:contentcheck>{xen:raw $field.description}</xen:contentcheck></p></xen:if>
        <input type="hidden" name="custom_fields_shown[]" value="{$field.field_id}" />
    </dd>
</dl>
 

KozmoK

Active member
#10
I dont see where you edited it at all... oh crap, Im running 1.2 RC 2

I wonder if that matters?

all's I did was insert the green lines above, and altered that red one - dont know how to make it simpler then that.
 
#11
I edited template ..RED

<dl class="ctrlUnit">
<dt>
<label for="ctrl_custom_field_{$field.field_id}">{$field.title}:</label>
<xen:if is="{$field.required}"><dfn>{xen:phrase required}</dfn></xen:if>
</dt>
<dd>

<xen:if is="{$field.field_id} == 'ReferrerForum'">
<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:if is="{$field.field_type} == 'textbox'">
<input type="text" name="custom_fields[{$field.field_id}]" value="{$field.field_value}"
id="ctrl_custom_field_{$field.field_id}"
data-validatorname="custom_field_{$field.field_id}"
class="textCtrl" maxlength="{xen:if $field.max_length, $field.max_length}"
/>
<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} == 'radio'" />
<ul class="checkboxColumns">
<xen:if is="!{$field.required}">
<li><label><input type="radio" name="custom_fields[{$field.field_id}]" value="" {xen:checked '{$field.field_value} == ""'} /> <span class="muted">{xen:phrase no_selection}</span></label></li>
</xen:if>
<xen:foreach loop="$field.fieldChoices" key="$choice" value="$text">
<li><label><input type="radio" name="custom_fields[{$field.field_id}]" value="{$choice}" {xen:checked '{$field.field_value} == {$choice}'} /> {xen:raw $text}</label></li>
</xen:foreach>
</ul>
<xen:elseif is="{$field.field_type} == 'select'" />
<select name="custom_fields[{$field.field_id}]" id="ctrl_custom_field_{$field.field_id}" class="textCtrl">
<xen:if is="!{$field.required} OR !{$field.hasValue}">
<option value="">&nbsp;</option>
</xen:if>
<xen:foreach loop="$field.fieldChoices" key="$choice" value="$text">
<option value="{$choice}" {xen:selected '{$field.field_value} == {$choice}'}>{xen:raw $text}</option>
</xen:foreach>
</select>
<xen:elseif is="{$field.field_type} == 'checkbox'" />
<ul class="checkboxColumns">
<xen:foreach loop="$field.fieldChoices" key="$choice" value="$text">
<li><label><input type="checkbox" name="custom_fields[{$field.field_id}][{$choice}]" value="{$choice}" {xen:checked 'isset({$field.field_value.{$choice}})'} /> {xen:raw $text}</label></li>
</xen:foreach>
</ul>
<xen:elseif is="{$field.field_type} == 'multiselect'" />
<select name="custom_fields[{$field.field_id}][]" id="ctrl_custom_field_{$field.field_id}" class="textCtrl" size="7" multiple="multiple">
<xen:if is="!{$field.required} OR !{$field.hasValue}">
<option value="">&nbsp;</option>
</xen:if>
<xen:foreach loop="$field.fieldChoices" key="$choice" value="$text">
<option value="{$choice}" {xen:selected 'isset({$field.field_value.{$choice}}'}>{xen:raw $text}</option>
</xen:foreach>
</select>
</xen:if>
</xen:if>

<xen:if hascontent="true"><p class="explain"><xen:contentcheck>{xen:raw $field.description}</xen:contentcheck></p></xen:if>
<input type="hidden" name="custom_fields_shown[]" value="{$field.field_id}" />
</dd>
</dl>
 

KozmoK

Active member
#12
You didnt edit the "<xen:if is="{$field.field_type} == 'textbox'">" as I did above....

it should be:

<xen:elseif is="{$field.field_type} == 'textbox'" />

please notice the elseif difference and the /> at the end


and dont put the extra end </xen:if> - I never said to add that.
 
Last edited: