I have been able to achieve what I need by changing the module here:

function youtube_uploader_get_settings_form() {
  $ret['youtube_uploader_publishing_options'] = array(
    '#type' => 'radios',
    '#title' => t('Default privacy options'),
    '#description' => t('More info on !here', array('!here' => l(t('YouTube support page'), 'http://support.google.com/youtube/bin/answer.py?hl=en&answer=157177'))),
    '#options' => array('public' => t('Public'), 'unlisted' => t('Unlisted'), 'private' => t('Private')),
    '#default_value' => strtolower(variable_get('youtube_uploader_publishing_options', 'unlisted')),
  //Added: 'private' => t('Private') - being the added code.

How do I achieve this without hacking the module?

1 Answer 1


hook_form_alter() is what you're looking for. This function, when invoked in any module, will let you modify any form array created/rendered by Drupal's form API. For example, in a module named mymodule you could add the following function in mymodule.module.

function mymodule_form_alter(&$form, &$form_state, $form_id) {
  //modify youtube_uploader_get_settings_form to add Private to #options array
  if($form_id == 'youtube_uploader_get_settings_form') {
    $form['youtube_uploader_publishing_options']['#options']['private'] = t('Private');

function xxxx_custom_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'field_ui_field_edit_form' && isset($form['instance']['settings']['youtube_settings']['youtube_uploader_publishing_options'])) {
    $privateOptions = array('public' => t('Public'), 'unlisted' => t('Unlisted'), 'private' => t('Private'));
    $form['instance']['settings']['youtube_settings']['youtube_uploader_publishing_options']['#options'] = $privateOptions;
  • Excellent! I've used that principal and now I have my Video Uploaded to YouTube with a private setting - without hacking the module. The code for anyone else looking to do this worked out to be: Oct 28, 2015 at 10:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.