| 1 |
<?php |
| 2 |
// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- View file, its variables are local to the include scope, not true globals. |
| 3 |
defined('ABSPATH') || die('Restricted Access'); |
| 4 |
|
| 5 |
use AcyMailing\Classes\UserClass; |
| 6 |
|
| 7 |
if (($form->settings['termspolicy']['tracking_consent'] ?? 'no') !== 'yes') { |
| 8 |
return; |
| 9 |
} |
| 10 |
|
| 11 |
$currentEmail = acym_currentUserEmail(); |
| 12 |
if (!empty($currentEmail)) { |
| 13 |
$existingUser = (new UserClass())->getOneByEmail($currentEmail); |
| 14 |
if (!empty($existingUser->id)) { |
| 15 |
return; |
| 16 |
} |
| 17 |
} |
| 18 |
|
| 19 |
echo '<div class="onefield fieldacytracking" id="field_tracking_'.esc_attr($form->form_tag_name).'">'; |
| 20 |
echo '<label for="mailingdata_tracking_'.esc_attr($form->form_tag_name).'">'; |
| 21 |
echo '<input type="hidden" name="user[tracking]" value="0"/>'; |
| 22 |
echo '<input id="mailingdata_tracking_'.esc_attr($form->form_tag_name).'" class="checkbox" type="checkbox" name="user[tracking]" value="1"/> '.esc_html( |
| 23 |
acym_translation('ACYM_TRACKING_CONSENT') |
| 24 |
); |
| 25 |
echo '</label>'; |
| 26 |
echo '</div>'; |
| 27 |
|