Friday 27 February 2015

How to add custom fields in user registration form in osclass.

In osclass user's registration form , you will see only few fields that's not enough for a user to register.
Osclass has functions to call the extra fields in the registration form. That can be called separately or it can be called by running a hook at last of the users registration page of osclass script.

Here i explain you the easiest way to implement the extra fields in the user registration form.First we need to download the 'requiredreg' plugin to achieve it in easy way. The name of the plugin is required registration plugins its a free plugin. we can directly download it and install in osclass and activate it.

After done the above things we just need to call a hook function in the user registration page of osclass, which is inside the theme folder user-registration.php file. 

call this hook at the end of the user-registration.php file but before submit button.

           <?php osc_run_hook('user_register_form'); ?>

    For Example:

             <?php osc_run_hook('user_register_form'); ?>
                    <div class="control-group">
                        <div class="controls">
                            <button type="submit" ><?php _e("Enregistrer", 'bender'); ?></button>
                        </div>
                    </div>
                </form>

Normally it will add the following fields inside the user registration form.

1)User Email

2)User Address

3)User Website Address

4)User Fax

5)Users country

We can remove the unwanted fields from the plugins form.php file.