Adding A Custom Field To Signup

JoeyG

New Member
I'm not, or do I pretend to be proficient with php ect...

I was wondering if there is a way to add a custom field to the sign up form?
For my purpose it would be an additional email address.

My toplist currently gives out prizes to the top member each month, and instead of asking each month what their paypal address is, I would like to include a "pay to" address.

I suppose the easiest way to do this is change the language on the sign-up to inform them that this has to be the users paypal address, but I was just wondering how difficult it would be to include a custom field.

Thanks
Joe
 

Mark

Administrator
Staff member
Hi Joe, Basti is working on adding the ability to add custom fields from the admin panel and we expect it should be ready fairly soon.

If you dont want to wait, you can manually add the database field, input box and appropriate PHP code, its not too difficult but does have a few steps involved in the process and can be done with plugins.

I can post a walk through for you if you like.
 

JoeyG

New Member
Thanks Mark,

Maybe a step by step would be helpful, not only to myself but other members as well until Basti has completed it.

I don't mind waiting for the official release, I have a month before I have to pay out again. :p

Thanks Again,
Joe
 

Mark

Administrator
Staff member
its going to be a long one :)

so lets get started, I'm going to do this without plugins for the sake of simplicity since all of this will moot in a couple of weeks anyway. Note that any upgrades to the visiolist core will overwrite these changes and you will need to re-apply them. I do not encourage anyone to use this method, waiting for the feature is a good idea whenever possible.

first go to your hosting control panel and open phpmyadmin or whatever tool you have available to edit your database

add a new column to your VL_sites table called second_email
make it varchar
length 255


Now for the first PHP part: open sources/join.php

find:

PHP:
    $TMPL['category'] = $DB->escape($FORM['category'], 1);
Add AFTER:

PHP:
    $TMPL['second_email'] = $DB->escape($FORM['second_email'], 1);

Next, FIND:
PHP:
        $DB->query("INSERT INTO {$CONF['sql_prefix']}_sites (username, password, url, short_url, title, description, category, banner_url, email, join_date, active, openid, user_ip,owner)
                  VALUES ('{$TMPL['username']}', '{$password}', '{$TMPL['url']}', '{$short_url}', '{$TMPL['title']}', '{$TMPL['description']}', '{$TMPL['category']}', '{$TMPL['banner_url']}', '{$TMPL['email']}', '{$join_date}', {$CONF['active_default']}, 0, '{$user_ip}','{$TMPL['username']}')", __FILE__, __LINE__);
REPLACE WITH:

PHP:
        $DB->query("INSERT INTO {$CONF['sql_prefix']}_sites (username, password, url, short_url, title, description, category, banner_url, email, join_date, active, openid, user_ip,owner,second_email)
                  VALUES ('{$TMPL['username']}', '{$password}', '{$TMPL['url']}', '{$short_url}', '{$TMPL['title']}', '{$TMPL['description']}', '{$TMPL['category']}', '{$TMPL['banner_url']}', '{$TMPL['email']}', '{$join_date}', {$CONF['active_default']}, 0, '{$user_ip}','{$TMPL['username']}','{$TMPL['second_email']}')", __FILE__, __LINE__);

Now for the HTML part:

admin -> settings _> skins and categories -> edit child

Click on join_form from the list of templates to copy.
Then edit the join_form child template

paste this where you want the new field to show up:
Code:
  <div>
    <label for="second_email">{$lng->g_second_email}</label><br />
      <input type="text" name="second_email" size="50" value="{$second_email}" id="second_email" />
  </div><br />

Now add a new phease to your language, admin -> content ->manage languages -> add new phrase

phrase name: g_second_email
definition: Your Paypal address


and that will do it :) the same HTML/PHP changes will need to be made for the user control panel and the admin panel. Armed with the above you may be able to figure out how to make those additions, if not, post back and I'll continue the walkthrough.
 
Top