<?php
/*
Plugin Name: Custom Generate SKU
Description: Automatically generate a SKU for new records in the 'Products' table
Version: 1.00
Requires at least: 2.03
*/

addAction('record_presave', '_custom_generate_sku_record_presave', null, 3);

function _custom_generate_sku_record_presave($tableName, $isNewRecord = null, $oldRecord = null) {
  if (!$isNewRecord) { return; }
  if ($tableName != 'Products') { return; }
  $_REQUEST['sku'] = uniqid();
}

?>
