case 'update':
+ // Get the original Event Status. Before the update.
+ $old_event_status = $this->wpdb->get_var(
+ $this->wpdb->prepare(
+ "SELECT status
+ FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "events
+ WHERE id = %d",
+ $this->eventID
+ )
+ );
+
$this->updateCategories();
$categories = $Categories->getListSortedParentChild(false);
if ($event['status']) {
$eventUpdated = true;
+ // Check if the event is being approved
+ if ( $event['fieldData']['status']['value'] && $old_event_status ) {
+ $new_status = $event['fieldData']['status']['value'];
+ if ( $old_event_status == 20 && $new_status == 10 ) {
+ // Update approved timestamp.
+ $this->updateTimestamp('approved', $this->eventID);
+ }
+ }
+
// Update updated timestamp and name slug for URLs
$this->updateTimestamp('updated', $this->eventID);
$this->updateSlug($this->eventID);