No replies
littly_kitty's picture
Offline
Bug Finder
Joined: 01/20/2008
Juice: 155
Was this information Helpful?

DRUPAL 6

I am using the preprocess function to theme my Ubercart product forms so they are more user-friendly.

Everything works fine, except when I upload an image, I get the following error message:

An unrecoverable error occurred. The uploaded file likely exceeded the maximum file size (100 MB) that this server supports.

If I disable my theming modifications, everything works fine, so I know that the problem must rely with modifications, but I can't see what is wrong!!

Here are the modifications:

Modifications to the template.php file (Theme name is "swb")

// we register the form to the theme registry
function swb_theme(){
  return array(
    'photo_product_node_form' => array(
      'arguments' => array('form' => NULL),
      'template' => 'photo_product_node_form',
    ),
  );
}

// we pass variables to the template
function swb_preprocess_photo_product_node_form(&$vars) {

  $vars['title'] = drupal_render($vars['form']['title']);
  $vars['body'] = drupal_render($vars['form']['body_field']);
  $vars['format'] = drupal_render($vars['form']['body_field']['format']);
  $vars['model'] = drupal_render($vars['form']['base']['model']);
  $vars['cost'] = drupal_render($vars['form']['base']['prices']['cost']);
  $vars['sell_price'] = drupal_render($vars['form']['base']['prices']['sell_price']);
  $vars['field_image_cache'] = drupal_render($vars['form']['field_image_cache']);
  $vars['field_user_access'] = drupal_render($vars['form']['field_user_access']);

  unset($form['menu']);
  unset($form['author']);
  unset($form['form']['base']['prices']['list_price']);
  unset($form['form']['base']['weight']);
  unset($form['form']['base']['dimensions']);
  unset($form['form']['base']['pkg_qty']);
  unset($form['form']['base']['default_qty']);
  unset($form['body_field']['format']);
}

Modifications to photo_product_node_form.tpl.php file (Theme name is "swb")

  <h2> Who can access this Photo? </h2>
  <p> Tip: make sure you have created the user first </p>
    <?php print $field_user_access  ?>

  <h2>Add the Photo</h2>
  <?php print $title; ?>
  <?php print $field_image_cache ?>
 
  <h2>Add Sales Information</h2>
  <?php print $model; ?>
 
  <?php print $cost; ?>
  <?php print $sell_price; ?>