feat(profile): disable ads toggle on certain domains

Introduced a condition to disable the advertisements toggle for specific domains, enhancing user experience by clearly distinguishing environments where ad configurations are not applicable.

By explicitly disabling the toggle on unsupported domains, it guides users towards intended interactions within the application, reducing potential support inquiries and user frustration related to advertisement settings in non-production environments.
This commit is contained in:
Kumi 2024-05-31 18:20:12 +02:00
parent 8b99a1faa1
commit 368c8767f0
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -348,7 +348,17 @@ $page->navigation();
<label><?= __('Advertisements') ?></label>
<div class="ui toggle checkbox advertisements">
<?php if (true === $user->getAdvertisements()) { ?>
<?php
$wishthis_hosts = [
'wishthis.localhost',
'wishthis.online',
'rc.wishthis.online',
'dev.wishthis.online',
];
if (!in_array($_SERVER['HTTP_HOST'], $wishthis_hosts, true)) { ?>
<input type="checkbox" name="enable-advertisements" disabled="disabled" />
<?php } elseif (true === $user->getAdvertisements()) { ?>
<input type="checkbox" name="enable-advertisements" checked="checked" />
<?php } else { ?>
<input type="checkbox" name="enable-advertisements" />