Well, I spent a couple hours to figure this out because the error on activation bugged me. It was kind of fun to figure out how to make WP actually show you the error instead of “helpfully” hiding it…
After the tables are created the plugin activation runs thru the table columns making sure the columns exist and adds them if they don’t. My guess is that this really the upgrade routine to bring older table structures up to date for the current version of AdRotate. So if the user is installing the current version there is no upgrade required and the plugin will function correctly and the error can be ignored, however if a user is upgrading from a previous version the plugin will not function correctly because the tables will not have all the correct columns.
So here’s the fix:
In the adrotate-setup.php change lines 81 thru 86 from
$i = 0;
while ($row = mysql_fetch_assoc($result)) {
$field_array[] = mysql_field_name($row, $i);
$i++;
}
to
//$i = 0;
while ($row = mysql_fetch_assoc($result)) {
//$field_array[] = mysql_field_name($row, $i);
$field_array[] = $row['Field'];
//$i++;
}
Now do the same for lines 132 thru 137 and 151 thru 156. That should fix the activation error and still upgrade previous versions of AdRotate correctly.