Added Control element for manual cronjobs

This commit is contained in:
Thomas Günther 2024-08-12 15:48:55 +02:00
parent ca02db7b28
commit f7ca614b38
3 changed files with 31 additions and 2 deletions

View File

@ -12,6 +12,7 @@
* Text Domain: bdp-kompass * Text Domain: bdp-kompass
*/ */
use Bdp\Libs\WpConfigEditor;
use Bdp\Modules\EventParticipants\Controllers\MainController as EventsMain; use Bdp\Modules\EventParticipants\Controllers\MainController as EventsMain;
use Bdp\Modules\KompassSettings\Controllers\SettingsPage as KomnpassSettings; use Bdp\Modules\KompassSettings\Controllers\SettingsPage as KomnpassSettings;
use Bdp\Modules\LimitLoginAttempts\Controllers\OptionsPage as OptionsPageAlias; use Bdp\Modules\LimitLoginAttempts\Controllers\OptionsPage as OptionsPageAlias;
@ -32,7 +33,9 @@ function bdp_plugin_init() {
Security::ProhibitBots(); Security::ProhibitBots();
Security::SetPageFilters(); Security::SetPageFilters();
if (null == get_option('kompass_already_installed', null)) { # WpConfigEditor::updateConfig('DISABLE_WP_CRON', true);
if (null == get_option('kompass_already_installed', null)) {
Seo::setup(); Seo::setup();
Security::setup(); Security::setup();
update_option('kompass_already_installed', true); update_option('kompass_already_installed', true);

View File

@ -3,6 +3,8 @@
namespace Bdp\Modules\KompassSettings\Controllers; namespace Bdp\Modules\KompassSettings\Controllers;
use Bdp\Libs\WpConfigEditor;
class SettingsPage class SettingsPage
{ {
public static function add_menu() { public static function add_menu() {
@ -89,6 +91,11 @@ class SettingsPage
if (isset($_POST['used_for_state'])) { update_option('paged_used_for_state', true); } if (isset($_POST['used_for_state'])) { update_option('paged_used_for_state', true); }
if (isset($_POST['self_register'])) { update_option('user_can_register', true); } if (isset($_POST['self_register'])) { update_option('user_can_register', true); }
if (isset($_POST['use_mareike_theme'])) { update_option('use_mareike_theme', true); } if (isset($_POST['use_mareike_theme'])) { update_option('use_mareike_theme', true); }
if (isset($_POST['external_cronjobs'])) {
WpConfigEditor::updateConfig('DISABLE_WP_CRON', true);
} else {
WpConfigEditor::deleteConfigKey('DISABLE_WP_CRON');
}
kompass_print_message_box('Die Einstellungen wurden gespeichert.'); kompass_print_message_box('Die Einstellungen wurden gespeichert.');
} }

View File

@ -1,4 +1,7 @@
<form action="<?php echo esc_url(admin_url('options-general.php?page=kompass-settings')); ?>" method="post"> <?php
use Bdp\Libs\WpConfigEditor;
?>
<form action="echo esc_url(admin_url('options-general.php?page=kompass-settings')); ?>" method="post">
<input type="hidden" name="save" value="1"> <input type="hidden" name="save" value="1">
<h2>Kompass Einstellungen</h2> <h2>Kompass Einstellungen</h2>
<table> <table>
@ -15,6 +18,22 @@
</td> </td>
</tr> </tr>
<tr>
<td style="font-weight: bold; padding: 10px;">Externe Cron-Ausführung</td>
<td>
<div class="switch-container">
<input name="external_cronjobs"
<?php
if (WpConfigEditor::getConfigValue('DISABLE_WP_CRON') )
echo ' checked ';?> type="checkbox" id="external_cronjobs" class="switch">
<label for="external_cronjobs" class="switch-label">
<span class="switch-inner" data-on="ON" data-off="OFF"></span>
<span class="switch-switch"></span>
</label>
</div>
</td>
</tr>
<tr> <tr>
<td style="font-weight: bold; padding: 10px;">Nutzer können sich selbst anmelden</td> <td style="font-weight: bold; padding: 10px;">Nutzer können sich selbst anmelden</td>
<td> <td>