This commit is contained in:
1 parent
d77be150d9
commit
5210c9d2e6
11 files changed
+732
-284
No files matched your search
@@ -8,6 +8,8 @@ if (!defined('ABSPATH')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
global $wpdb;
|
||||
|
||||
// Preveri, če ima uporabnik pravice za dostop
|
||||
if (!current_user_can('manage_options')) {
|
||||
return;
|
||||
@@ -67,6 +69,10 @@ if (isset($_POST['wheel_save_settings']) && check_admin_referer('wheel_settings_
|
||||
}
|
||||
update_option('wheel_spin_products', $spin_products);
|
||||
|
||||
// Dnevni spin - shrani izbrano kolo
|
||||
$daily_spin_wheel_id = isset($_POST['wof_daily_spin_wheel_id']) ? intval($_POST['wof_daily_spin_wheel_id']) : '';
|
||||
update_option('wof_daily_spin_wheel_id', $daily_spin_wheel_id);
|
||||
|
||||
// Prikaži sporočilo o uspehu
|
||||
add_settings_error('wheel_settings', 'settings_updated', __('Nastavitve so bile uspešno shranjene.', 'wheel-of-fortune'), 'updated');
|
||||
}
|
||||
@@ -79,6 +85,11 @@ $max_spins = get_option('wheel_max_spins', 0);
|
||||
$send_emails = get_option('wheel_send_emails', false);
|
||||
$spin_products = get_option('wheel_spin_products', array());
|
||||
|
||||
// Pridobi vsa kolesa za dropdown
|
||||
$wheels_table = $wpdb->prefix . 'wof_wheels';
|
||||
$wheels = $wpdb->get_results("SELECT * FROM $wheels_table ORDER BY id ASC", ARRAY_A);
|
||||
$daily_spin_wheel_id = get_option('wof_daily_spin_wheel_id', '');
|
||||
|
||||
// Prikaži sporočila o napakah/uspehu
|
||||
settings_errors('wheel_settings');
|
||||
?>
|
||||
@@ -118,6 +129,20 @@ settings_errors('wheel_settings');
|
||||
<p class="description"><?php echo esc_html__('Maksimalno število spinov, ki jih lahko ima uporabnik. Vrednost 0 pomeni brez omejitve.', 'wheel-of-fortune'); ?></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<label for="wof_daily_spin_wheel_id"><?php echo esc_html__('Kolo za dnevni spin', 'wheel-of-fortune'); ?></label>
|
||||
</th>
|
||||
<td>
|
||||
<select id="wof_daily_spin_wheel_id" name="wof_daily_spin_wheel_id">
|
||||
<option value=""><?php echo esc_html__('Izberi kolo', 'wheel-of-fortune'); ?></option>
|
||||
<?php foreach ($wheels as $wheel): ?>
|
||||
<option value="<?php echo esc_attr($wheel['id']); ?>" <?php selected($daily_spin_wheel_id, $wheel['id']); ?>><?php echo esc_html($wheel['name']); ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<p class="description"><?php echo esc_html__('Vsi registrirani uporabniki bodo vsakih 24 ur prejeli 1 spin na izbranem kolesu.', 'wheel-of-fortune'); ?></p>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- Možnost za pošiljanje e-pošte je odstranjena, saj se e-pošta pošlje vedno -->
|
||||
<input type="hidden" name="wheel_send_emails" value="1" />
|
||||
</table>
|
||||
|
||||
Reference in new issue
Block a user