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.
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
*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.
Best Regards,
Richi
Looking for quality ClipBucket Web Hosting? Look no further than Arvixe Web Hosting!
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
Hello,
I’m glad you found it useful. Anything else you want to know, just let me know.
Regards,
Richi
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.