when submitting the 'content_copy_import_form' with drupal_execute(). The following at the end of content_copy_form_submit breaks things because it explicitly calls drupal_goto()

  if (!form_get_errors()) {
    if (sizeof($imported_fields) > 0 || sizeof($imported_groups) > 0) {
      drupal_goto('admin/content/types/'. $content_info['content types'][$type_name]['url_str'] .'/fields');
    }
    else {
      drupal_goto('admin/content/types');
    }
  }

The fix is to change the drupal_goto calls to returns, like so:

  if (!form_get_errors()) {
    if (sizeof($imported_fields) > 0 || sizeof($imported_groups) > 0) {
      return 'admin/content/types/'. $content_info['content types'][$type_name]['url_str'] .'/fields';
    }
    else {
      return 'admin/content/types';
    }
  }

this allows multiple drupal_execute('content_copy_import_form', $form_values) to be placed into one function and program flow will execute correctly. I am using this to create multiple cck types during a _profile_final() call.

I can whip up a patch file if needed, but its a simple change.

-Steve

Comments

yched’s picture

Status: Active » Fixed

Yep, this has been reported many times, and I finally took the 30 secs to actually commit the fix...

Anonymous’s picture

Status: Fixed » Closed (fixed)