Alling buttons

This commit is contained in:
2026-07-05 19:05:29 +02:00
parent f5b5af5372
commit 6cebf05e32
2 changed files with 17 additions and 15 deletions
+14 -11
View File
@@ -151,7 +151,8 @@ function go_form_get_custom_value($entry_id, $field_id)
return $wpdb->get_var($wpdb->prepare(
"SELECT value FROM {$wpdb->prefix}go_form_entry_custom_values
WHERE entry_id = %d AND field_id = %d",
$entry_id, $field_id
$entry_id,
$field_id
));
}
@@ -232,12 +233,12 @@ function go_form_handle_submission()
// Send notification email
// $to = 'nikola@petrovv.com';
// $subject = 'New Go Tournament Registration';
// $message = "A new player has signed up:\n\n";
// $message .= "Form ID: {$form_id}\n";
// $message .= "Name: {$data['first_name']} {$data['last_name']}\n";
// wp_mail($to, $subject, $message);
wp_redirect($_SERVER['HTTP_REFERER']);
@@ -435,7 +436,7 @@ add_action('admin_post_go_form_delete_custom_field', 'go_form_delete_custom_fiel
function go_form_update_egd_data()
{
go_form_admin_action('update_egd_data');
if (!isset($_POST['value_one'])) {
wp_redirect(admin_url('admin.php?page=go-form-settings'));
exit;
@@ -453,9 +454,9 @@ function go_form_update_egd_data()
$pin = trim($entry->egd_number);
$url = 'https://europeangodatabase.eu/EGD/GetPlayerDataByPIN.php?pin=' . urlencode($pin);
$response = wp_remote_get($url, ['timeout' => 10]);
if (is_wp_error($response)) {
continue;
}
@@ -503,7 +504,7 @@ function go_form_update_entry()
global $wpdb;
$entry_id = intval($_POST['entry_id']);
$form_id = intval($_POST['form_id']);
$rating = intval($_POST['rating']);
$rank = intval($_POST['rank']);
if ($rating < -900) {
@@ -541,13 +542,15 @@ function go_form_update_entry()
} else {
$value = sanitize_text_field($value);
}
// Check if custom value exists
$existing = go_form_get_custom_value($entry_id, $field->id);
if ($existing !== null) {
$wpdb->update("{$wpdb->prefix}go_form_entry_custom_values",
['value' => $value],
['entry_id' => $entry_id, 'field_id' => $field->id]);
$wpdb->update(
"{$wpdb->prefix}go_form_entry_custom_values",
['value' => $value],
['entry_id' => $entry_id, 'field_id' => $field->id]
);
} else {
$wpdb->insert("{$wpdb->prefix}go_form_entry_custom_values", [
'entry_id' => $entry_id,
+3 -4
View File
@@ -58,14 +58,13 @@
<?php if ($show_admin): ?>
<td> <?= esc_html($e->rating) ?> </td>
<td>
<td style="white-space: nowrap;">
<a href="<?= add_query_arg(array('page' => 'go-form-settings', 'form_id' => $form_id ?? 0, 'edit_entry' => $e->id), admin_url('admin.php')) ?>"
class="button button-small">Edit</a>
<?php action_button('go_form_delete_entry', 'Delete', 'Delete this entry?', $e->id); ?>
class="button" style="margin-right: 4px;">Edit</a>
<span style="display: inline-block;"><?php action_button('go_form_delete_entry', 'Delete', 'Delete this entry?', $e->id); ?></span>
</td>
<?php endif; ?>
</tr>
<?php endforeach; ?>