Date added show public

This commit is contained in:
2026-05-08 11:29:21 +02:00
parent 768f7467e3
commit 1f141fac7d
4 changed files with 15 additions and 27 deletions

View File

@@ -37,16 +37,10 @@ function go_form_activate()
email varchar(255) DEFAULT NULL, email varchar(255) DEFAULT NULL,
egd_number varchar(20) DEFAULT NULL, egd_number varchar(20) DEFAULT NULL,
comment text DEFAULT NULL, comment text DEFAULT NULL,
created_at datetime DEFAULT CURRENT_TIMESTAMP NOT NULL, created_at date DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY (id), PRIMARY KEY (id),
KEY form_id (form_id) FOREIGN KEY (form_id) REFERENCES $forms(id) ON DELETE CASCADE
) $charset;"); ) $charset;");
// Add default form if none exist
$existing_forms = $wpdb->get_var("SELECT COUNT(*) FROM $forms");
if ($existing_forms == 0) {
$wpdb->insert($forms, ['name' => 'Default Form']);
}
} }
register_activation_hook(__FILE__, 'go_form_activate'); register_activation_hook(__FILE__, 'go_form_activate');
@@ -107,15 +101,11 @@ function go_form_handle_submission()
wp_die('Security check failed'); wp_die('Security check failed');
global $wpdb; global $wpdb;
$form_id = isset($_POST['form_id']) ? intval($_POST['form_id']) : 1; if (isset($_POST['form_id'])) {
$form_id = intval($_POST['form_id']);
// Check if form exists } else {
$form_exists = $wpdb->get_var($wpdb->prepare( wp_redirect($_SERVER['HTTP_REFERER']);
"SELECT COUNT(*) FROM {$wpdb->prefix}go_form_forms WHERE id = %d", exit;
$form_id
));
if (!$form_exists) {
$form_id = 1; // Fallback to default form
} }
$rating = intval($_POST['rating']); $rating = intval($_POST['rating']);
@@ -218,11 +208,8 @@ function go_form_delete_form()
if (isset($_POST['value_one'])) { if (isset($_POST['value_one'])) {
global $wpdb; global $wpdb;
$id = intval($_POST['value_one']); $id = intval($_POST['value_one']);
if ($id > 1) {
$wpdb->delete("{$wpdb->prefix}go_form_entries", ['form_id' => $id]);
$wpdb->delete("{$wpdb->prefix}go_form_forms", ['id' => $id]); $wpdb->delete("{$wpdb->prefix}go_form_forms", ['id' => $id]);
} }
}
$redirect_url = add_query_arg(array('page' => 'go-form-settings', 'deleted' => 1), admin_url('admin.php')); $redirect_url = add_query_arg(array('page' => 'go-form-settings', 'deleted' => 1), admin_url('admin.php'));
wp_redirect($redirect_url); wp_redirect($redirect_url);
exit; exit;

View File

@@ -7,10 +7,10 @@
<th>Club</th> <th>Club</th>
<th>Rank</th> <th>Rank</th>
<th>EGD Number</th> <th>EGD Number</th>
<th>Date Added</th>
<?php if ($show_admin): ?> <?php if ($show_admin): ?>
<th>Rating</th> <th>Rating</th>
<th>Email</th> <th>Email</th>
<th>Date Added</th>
<th>Action</th> <th>Action</th>
<th>Comment</th> <th>Comment</th>
<?php endif; ?> <?php endif; ?>
@@ -27,12 +27,12 @@
<td> <?= esc_html($e->club) ?> </td> <td> <?= esc_html($e->club) ?> </td>
<td> <?= esc_html($ranks[$e->rank]) ?> </td> <td> <?= esc_html($ranks[$e->rank]) ?> </td>
<td> <?= esc_html($e->egd_number) ?> </td> <td> <?= esc_html($e->egd_number) ?> </td>
<td> <?= esc_html($e->created_at) ?> </td>
<?php if ($show_admin): ?> <?php if ($show_admin): ?>
<td> <?= esc_html($e->rating) ?> </td> <td> <?= esc_html($e->rating) ?> </td>
<td> <?= esc_html($e->email) ?> </td> <td> <?= esc_html($e->email) ?> </td>
<td> <?= esc_html($e->created_at) ?> </td>
<td> <td>
<?php action_button('go_form_delete_entry', 'Delete', 'Delete this entry?', $e->id); ?> <?php action_button('go_form_delete_entry', 'Delete', 'Delete this entry?', $e->id); ?>
</td> </td>

View File

@@ -19,7 +19,8 @@ echo "removed pods"
#exit 0 #exit 0
# Recreate pod # Recreate pod
podman pod create -n $POD_NAME -p 8090:80 podman pod create -n $POD_NAME -p 8090:80 -p 3306:3306
# Start MariaDB # Start MariaDB
podman run --detach --pod $POD_NAME \ podman run --detach --pod $POD_NAME \

View File

@@ -25,7 +25,7 @@ podman pull docker.io/wordpress
# Create a pod instead of --link. # Create a pod instead of --link.
# So both containers are able to reach each others. # So both containers are able to reach each others.
podman pod create -n $POD_NAME -p 8090:80 podman pod create -n $POD_NAME -p 8090:80 -p 3306:3306
podman run --detach --pod $POD_NAME \ podman run --detach --pod $POD_NAME \
-e MYSQL_ROOT_PASSWORD=$DB_PASS \ -e MYSQL_ROOT_PASSWORD=$DB_PASS \