From 2bba3e27356a64f2ae7ce96145cc8989ffac6541 Mon Sep 17 00:00:00 2001 From: "DESKTOP-8C1CTRA\\erikv" Date: Wed, 27 Sep 2017 14:09:43 +0200 Subject: [PATCH] - added uninstall hook - moved function from deactivator to uninstaller.php - deactivator.php only unsets user field instead of deleting all options. --- admin/partials/support-hours-functions.php | 25 ++++++++++---------- includes/class-support-hours-deactivator.php | 9 ++++--- includes/class-support-hours-uninstaller.php | 6 ++--- support-hours.php | 2 +- 4 files changed, 22 insertions(+), 20 deletions(-) diff --git a/admin/partials/support-hours-functions.php b/admin/partials/support-hours-functions.php index 4c465f7..abd3a78 100644 --- a/admin/partials/support-hours-functions.php +++ b/admin/partials/support-hours-functions.php @@ -1,6 +1,7 @@ format('H:i'); + $used_hours = AddTime($workFields); $used_hours= minuszeros($used_hours); - $bought_hours_calc = hoursToMinutes($options['bought_hours']); - - // TODO: hier een nieuwe functie voor vinden die ook meer uren dan 24 toelaat. @3:59 pakt het systeem wel. 24 uur, pakt ie wel maar geen error. Vanaf boven de 24 uur een error. - - $bought_hours = new DateTime($options['bought_hours']); - $bought_hours = $bought_hours->format('H:i'); + $bought_hours = $options['bought_hours']; $bought_hours = minuszeros($bought_hours); - $current_color = get_user_option( 'admin_color' ); + + if (strpos($used_hours, ':') !== false){ $size = 'small'; } else{ diff --git a/includes/class-support-hours-deactivator.php b/includes/class-support-hours-deactivator.php index 67722b5..ac0cbd1 100644 --- a/includes/class-support-hours-deactivator.php +++ b/includes/class-support-hours-deactivator.php @@ -30,9 +30,12 @@ class Support_Hours_Deactivator { * @since 1.0.0 */ public static function deactivate() { - //delete_option('support-hours'); - // TODO: checken of deze functie goed werkt met het verwijderen van de user accounts. - delete_option('support-hours','support-hours["users"]'); + //Get entire array + $SupportHourOptions = get_option('support-hours'); + //Alter the options array appropriately + $SupportHourOptions['users'] = ''; + //Update entire array + update_option('support-hours', $SupportHourOptions); } } diff --git a/includes/class-support-hours-uninstaller.php b/includes/class-support-hours-uninstaller.php index af17f8a..6b3a984 100644 --- a/includes/class-support-hours-uninstaller.php +++ b/includes/class-support-hours-uninstaller.php @@ -1,7 +1,7 @@