Hi,
Just trying out the simple MyEvents plugin (http://wordpress.org/extend/plugins/myevents/). There is a problem when trying to delete an entry in the list of events. The global value $wpdb isn't available in the function called. It's available elsewhere in the same class.
I presume this is because of the way the delete function is called:
if (isset($_POST['action']))
{
if ( $_POST['action'] == 'options' ) {
$myevents->settings['pattern'] = $_POST['pattern'];
$myevents->save_options();
}
if ( $_POST['action'] == 'add' && isset($_POST['name']) && $_POST['name'] <> '' ) {
$item = new Event();
$item->name = $_POST['name'];
$item->location = $_POST['location'];
$item->date = $_POST['aa'] . '-' . $_POST['mm'] . '-' . $_POST['jj'];
$item->save();
}
if ( $_POST['action'] == 'edit' && isset($_POST['name']) && $_POST['name'] <> '' ) {
$item = Event::getFromIndex($_POST['itemid']);
$item->name = $_POST['name'];
$item->location = $_POST['location'];
$item->date = $_POST['aa'] . '-' . $_POST['mm'] . '-' . $_POST['jj'];
$item->save();
}
}
if (isset($_GET['delitem']))
{
Event::delete($_GET['delitem']);
}
All the POST action functions work and the Event class can access $wpdb, but with the last one, which checks for $_GET['delitem'] $wpdb returns an empty value when called in the Event class.
Any ideas what the problem is? Thanks.