Add a Custom Field to the Upload Form in Clip-Bucket v2

Hello,

If you are wondering how to add a new required field to your video upload form, today’s your lucky day because I’ve written an article that will go through each step for achieving this. This has been tested in Clip-Bucket v2.6, it may or may not work in other versions. If you want to add a custom field, but not required I will emphasize that down below in the corresponding step.

e3

Note: Backup the files we are going to edit in case you want to revert changes.

1. Open upload.class.php, located inside ./includes/classes/*

2. Find

//Setting Anchors

Before that note there is a closing parentheses and a semicolon );

3. Before the semicolon and parentheses, we will add the following code that will create our new text input field named newfield:

'newfield'	=> array('title'=> "Our New Field",
							 'type'=> 'textfield',
							 'name'=> 'newfield',
							 'id'=> 'newfield',
							 'value'=>  cleanForm($newfield),
							 'size'=>'45',
							 'db_field'=>'db_newfield',
							 'required'=>'yes',
							 ),

Our code will look like this:

 'tags'		=> array('title'=> lang('tag_title'),
							 'type'=> 'textfield',
							 'name'=> 'tags',
							 'id'=> 'tags',
							 'value'=> cleanForm(genTags($tags)),
							 'hint_1'=> '',
							 'hint_2'=>  lang('vdo_tags_msg'),
							 'db_field'=>'tags',
							 'required'=>'yes',
							 'validate_function'=>'genTags'	
							 ),
		'newfield'	=> array('title'=> "Our New Field",
							 'type'=> 'textfield',
							 'name'=> 'newfield',
							 'id'=> 'newfield',
							 'value'=>  cleanForm($newfield),
							 'size'=>'45',
							 'db_field'=>'db_newfield',
							 'required'=>'yes',
							 ),
		 );
		//Setting Anchors

e2

*If you don’t want the field to be required, set ‘required’=>’no’

4. Now you need to create the column inside cb_video that will correspond to your new field. In this example our column is called db_newfield. This is the column it will save the information to, so if you want to change the column name, also change this. The query to add the new field is:

ALTER TABLE `cb_video` ADD `db_newfield` VARCHAR( 300 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL

e1

*If you need more length in your field, replace that 300 with your desired one.

5. Now everything is ready to test your upload form. Save and Upload.

Everything should be good now. If for some reason it doesn’t work for you, or you get stuck at any step, please do not hesitate to contact me. Any comment, suggestion, question, etc., please let me know and I’ll be more than glad to assist you.

Best Regards,

Richi

Looking for quality ClipBucket Web Hosting? Look no further than Arvixe Web Hosting!

Tags: , , , , , , , , , , , | Posted under ClipBucket | RSS 2.0

Author Spotlight

Richi González

Richi González

I started programming when I was 12. I'm a Developer and have been working with the Clip-Bucket script since it came out. I'm the Liaison between Arvixe and Clip-Bucket, so anything you need regarding Clip-Bucket or any particular computer-related subject you need, let me know so I can assist you.

3 Comments on Add a Custom Field to the Upload Form in Clip-Bucket v2

  1. Rajeev says:

    Hello Richi González ,

    Thank you very much for your valuable information . Your information is very useful for customizing the
    CB registration page.

    Great work :)

    Rajeev

  2. Vojtech says:

    Hello Richi,

    I’ve tried to add a custom field, but it’s not working. I’ve realized (via firebug), when I upload video, it don’t get videoid via file_uploader.php, got answer – {“error”:”Invalid ‘Kontakt'”}

    array:
    ‘febio_kontakt’ => array(‘title’ => lang(‘kontakt’), ‘type’ => ‘textfield’, ‘name’ => ‘febio_kontakt’, ‘id’ => ‘febio_kontakt’, ‘value’ => cleanForm($febio_kontakt), ‘db_field’ => ‘febio_kontakt’, ‘required’ => ‘yes’),

    please help.
    V.

Leave a Reply

Your email address will not be published. Required fields are marked *


2 × 4 =

You may use these HTML tags and attributes: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>