sub(new \DateInterval('P'.$numberOfDays.'D')); $dateToString = $date->format('Y-m-d h:i:s'); $sql .= " AND v.updated_at < '$dateToString'"; $url = api_get_path(WEB_CODE_PATH).'admin/user_list_consent.php'; $link = Display::url($url, $url); $subject = get_lang('UserRequestWaitingForAction'); $email = api_get_configuration_value('data_protection_officer_email'); $message = 'Checking requests from '.strip_tags(Display::dateToStringAgoAndLongDate($dateToString))."\n"; $result = Database::query($sql); while ($user = Database::fetch_array($result, 'ASSOC')) { $userId = $user['id']; $userInfo = api_get_user_info($userId); if ($userInfo) { $content = sprintf( get_lang('TheUserXIsWaitingForAnActionGoHereX'), $userInfo['complete_name'], $link ); if (!empty($email)) { api_mail_html('', $email, $subject, $content); } else { MessageManager::sendMessageToAllAdminUsers($defaultSenderId, $subject, $content); } $date = strip_tags(Display::dateToStringAgoAndLongDate($user['updated_at'])); $message .= "User ".$userInfo['complete_name_with_username']." is waiting for an action since $date \n"; } } echo $message; }