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.
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/*
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
*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
*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.
Looking for quality ClipBucket Web HostingArvixe Web Hosting!