From f2eb9f2b74e340ec384caf0b3a7b03628dec3c9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B3nio=20Gon=C3=A7alves?= Date: Thu, 29 Aug 2024 15:19:17 +0100 Subject: [PATCH] Fixed bug with user used during subscription --- index.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/index.php b/index.php index d8ccbc9..dbfb638 100644 --- a/index.php +++ b/index.php @@ -3,7 +3,7 @@ /** * Plugin Name: IoT Catalogue Integration * Description: Display in WordPress content from IoT Catalogue - * Version: 1.10.2 + * Version: 1.10.3 * Author: UNPARALLEL Innovation, Lda * Author URI: https://www.unparallel.pt */ @@ -45,10 +45,15 @@ function send_async_subscribe() { if($current_subscription == false) { return; } - $current_subscription -> get_data(); - iotcat_log_me("Data synchronized"); - $interval = intval($iotcat_field_data_update_interval)*60; - as_schedule_single_action(time() + $interval ,'async_subscribe', array() ); + $user_id = get_option("iotcat_plugin_admin_user_id"); + if($user_id > 0){ + wp_set_current_user($user_id); + $current_subscription -> get_data(); + iotcat_log_me("Data synchronized"); + $interval = intval($iotcat_field_data_update_interval)*60; + as_schedule_single_action(time() + $interval ,'async_subscribe', array() ); + } + }