Alling buttons
This commit is contained in:
@@ -151,7 +151,8 @@ function go_form_get_custom_value($entry_id, $field_id)
|
|||||||
return $wpdb->get_var($wpdb->prepare(
|
return $wpdb->get_var($wpdb->prepare(
|
||||||
"SELECT value FROM {$wpdb->prefix}go_form_entry_custom_values
|
"SELECT value FROM {$wpdb->prefix}go_form_entry_custom_values
|
||||||
WHERE entry_id = %d AND field_id = %d",
|
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
|
// Send notification email
|
||||||
// $to = 'nikola@petrovv.com';
|
// $to = 'nikola@petrovv.com';
|
||||||
// $subject = 'New Go Tournament Registration';
|
// $subject = 'New Go Tournament Registration';
|
||||||
|
|
||||||
// $message = "A new player has signed up:\n\n";
|
// $message = "A new player has signed up:\n\n";
|
||||||
// $message .= "Form ID: {$form_id}\n";
|
// $message .= "Form ID: {$form_id}\n";
|
||||||
// $message .= "Name: {$data['first_name']} {$data['last_name']}\n";
|
// $message .= "Name: {$data['first_name']} {$data['last_name']}\n";
|
||||||
|
|
||||||
|
|
||||||
// wp_mail($to, $subject, $message);
|
// wp_mail($to, $subject, $message);
|
||||||
|
|
||||||
wp_redirect($_SERVER['HTTP_REFERER']);
|
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()
|
function go_form_update_egd_data()
|
||||||
{
|
{
|
||||||
go_form_admin_action('update_egd_data');
|
go_form_admin_action('update_egd_data');
|
||||||
|
|
||||||
if (!isset($_POST['value_one'])) {
|
if (!isset($_POST['value_one'])) {
|
||||||
wp_redirect(admin_url('admin.php?page=go-form-settings'));
|
wp_redirect(admin_url('admin.php?page=go-form-settings'));
|
||||||
exit;
|
exit;
|
||||||
@@ -453,9 +454,9 @@ function go_form_update_egd_data()
|
|||||||
|
|
||||||
$pin = trim($entry->egd_number);
|
$pin = trim($entry->egd_number);
|
||||||
$url = 'https://europeangodatabase.eu/EGD/GetPlayerDataByPIN.php?pin=' . urlencode($pin);
|
$url = 'https://europeangodatabase.eu/EGD/GetPlayerDataByPIN.php?pin=' . urlencode($pin);
|
||||||
|
|
||||||
$response = wp_remote_get($url, ['timeout' => 10]);
|
$response = wp_remote_get($url, ['timeout' => 10]);
|
||||||
|
|
||||||
if (is_wp_error($response)) {
|
if (is_wp_error($response)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -503,7 +504,7 @@ function go_form_update_entry()
|
|||||||
global $wpdb;
|
global $wpdb;
|
||||||
$entry_id = intval($_POST['entry_id']);
|
$entry_id = intval($_POST['entry_id']);
|
||||||
$form_id = intval($_POST['form_id']);
|
$form_id = intval($_POST['form_id']);
|
||||||
|
|
||||||
$rating = intval($_POST['rating']);
|
$rating = intval($_POST['rating']);
|
||||||
$rank = intval($_POST['rank']);
|
$rank = intval($_POST['rank']);
|
||||||
if ($rating < -900) {
|
if ($rating < -900) {
|
||||||
@@ -541,13 +542,15 @@ function go_form_update_entry()
|
|||||||
} else {
|
} else {
|
||||||
$value = sanitize_text_field($value);
|
$value = sanitize_text_field($value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if custom value exists
|
// Check if custom value exists
|
||||||
$existing = go_form_get_custom_value($entry_id, $field->id);
|
$existing = go_form_get_custom_value($entry_id, $field->id);
|
||||||
if ($existing !== null) {
|
if ($existing !== null) {
|
||||||
$wpdb->update("{$wpdb->prefix}go_form_entry_custom_values",
|
$wpdb->update(
|
||||||
['value' => $value],
|
"{$wpdb->prefix}go_form_entry_custom_values",
|
||||||
['entry_id' => $entry_id, 'field_id' => $field->id]);
|
['value' => $value],
|
||||||
|
['entry_id' => $entry_id, 'field_id' => $field->id]
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
$wpdb->insert("{$wpdb->prefix}go_form_entry_custom_values", [
|
$wpdb->insert("{$wpdb->prefix}go_form_entry_custom_values", [
|
||||||
'entry_id' => $entry_id,
|
'entry_id' => $entry_id,
|
||||||
|
|||||||
@@ -58,14 +58,13 @@
|
|||||||
<?php if ($show_admin): ?>
|
<?php if ($show_admin): ?>
|
||||||
|
|
||||||
<td> <?= esc_html($e->rating) ?> </td>
|
<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')) ?>"
|
<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>
|
class="button" style="margin-right: 4px;">Edit</a>
|
||||||
<?php action_button('go_form_delete_entry', 'Delete', 'Delete this entry?', $e->id); ?>
|
<span style="display: inline-block;"><?php action_button('go_form_delete_entry', 'Delete', 'Delete this entry?', $e->id); ?></span>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user