When a banner has width size of 728px, the user/uid/affiliate banner display will be broken in most themes because the banner + the text area for the banner code is displayed side by side.

I changed the code for displaying the banner to ( function _uc_affiliate2_display_banners()):

$line[] = $banner . ''. $banner_link .'';

and the header of the table to :

$header[] = array('field' => 'banner_preview', 'data' => t('Banner Preview & Banner Code'));

But I think the proper way is to implement theme hook since this matter is connected to a theme?

Is it ok if I create a hook_theme for this function?

Comments

bojanz’s picture

Sure, do it and post it here.

duckzland’s picture

Sorry that I cant provide a proper patch, No linux available.

anyway,

/**
 * Implementation of hook_theme().
 *
 */
function uc_afiiliate2_theme() {
  return array(
    'uc_affiliate2_display_products' => array(
      'arguments' => array(),
	),
  );
}

function uc_affiliate2_links_export() {
  $ids = func_get_args();
  $output = '<br /><img src="'. $GLOBALS['base_url'] .'/misc/watchdog-error.png'.'" /> is the placeholder image in case none is present. <br />';

  if ($ids[0] == 'all') {
    $products = _uc_affiliate2_get_products('html');
  }
  else {
    $products = _uc_affiliate2_get_products('html', $ids);
  }

  $output .= theme(uc_affiliate2_display_products , $products); // CHANGE THIS

  return $output;
}

I think that is sufficient to make the function themeable

function theme_uc_affiliate2_display_products($products) { // CHANGE THIS
  global $base_url;

  $header[] = array('field' => 'product_title', 'data' => t('Product Title'));
  $header[] = array('field' => 'preview', 'data' => t('Preview'));
  $header[] = array('field' => 'code', 'data' => t('Code'));

  if(count($products) < 1) {
    return t('No products found.');
  }

  foreach ($products as $key => $product) {
    $line = array();

    $line[] = $key;
    $line[] = $product;
    $line[] = '<textarea cols="60" rows="4">'. $product .'</textarea>';

    $rows[] = $line;
  }

  return theme('table', $header, $rows);;
}
jazzdrive3’s picture

Yeah, I'm getting this problem too. The code to copy is pushed way off the side of the page. Broken.

Is something like this going to be committed soon?

Thanks.

bojanz’s picture

If someone provides a proper and tested patch, yes.
Otherwise, no, since development pretty much stopped.

tmwagner’s picture

StatusFileSize
new30.68 KB

One solution that I think would really help, would be the ability to CHOOSE which image is displayed as a thumbnail.
The Affiliate Banner Template "suggests" that there is some flexibility (i.e., we can insert as many (tags?) as we wish...)

The problem is, the banner uses the default main image. Most instances would tend to use an image as large as practicable... that, in turn breaks the affiliate thumbnail concept.

avpaderno’s picture

Version: 6.x-2.0 » 6.x-2.x-dev
Issue summary: View changes
Status: Active » Closed (outdated)

I am deleting the content of unrelated files added by a spammer. I am also closing this issue, since Drupal 6 isn't supported anymore.

I apologize for bumping this issue.