Add notification email

This commit is contained in:
2026-07-05 20:26:56 +02:00
parent 08ae633d01
commit 2f06a8a4f1
5 changed files with 72 additions and 220 deletions
+25 -3
View File
@@ -7,6 +7,8 @@ if (isset($_GET['deleted']))
echo '<div class="notice notice-success"><p>Deleted!</p></div>';
if (isset($_GET['created']))
echo '<div class="notice notice-success"><p>Form created!</p></div>';
if (isset($_GET['updated_form']))
echo '<div class="notice notice-success"><p>Form updated!</p></div>';
if (isset($_GET['created_field']))
echo '<div class="notice notice-success"><p>Custom field created!</p></div>';
if (isset($_GET['updated_field']))
@@ -37,9 +39,24 @@ if (isset($_GET['error']) && $_GET['error'] == 'egd_update_failed')
$form = go_form_get_form_by_id($selected_form_id);
$form_name = $form ? $form->name : 'Unknown Form';
echo "<h3> $form_name</h3>";
// Form info and edit UI
if ($form) {
echo '<div style="margin-bottom:20px; padding:15px; background:#fff; border:1px solid #ddd; border-radius:4px;">';
echo '<form method="post" action="' . admin_url('admin-post.php') . '">';
echo wp_nonce_field('go_form_update_form_action', 'go_form_update_form_nonce', true, false);
echo '<input type="hidden" name="action" value="go_form_update_form">';
echo '<input type="hidden" name="form_id" value="' . esc_attr($selected_form_id) . '">';
echo '<table class="form-table">';
echo '<tr><th><label for="form_name">Form Name:</label></th><td><input type="text" name="form_name" id="form_name" value="' . esc_attr($form->name) . '" required></td></tr>';
echo '<tr><th><label for="form_email">Notification Email:</label></th><td><input type="email" name="form_email" id="form_email" value="' . esc_attr($form->email ?? '') . '" placeholder="Optional email for signup notifications"></td></tr>';
echo '</table>';
echo '<p class="submit"><input type="submit" class="button button-primary" value="Update Form"></p>';
echo '</form>';
echo '</div>';
}
echo '<div style="margin-bottom:15px; display: flex; flex-wrap: wrap; gap: 10px;">';
action_button('go_form_delete_form', 'Delete Form', 'Delete this form and ALL entries?', $selected_form_id);
action_button('go_form_export_csv', 'Export to CSV', 'Confirm Export', $selected_form_id);
action_button('go_form_export_pairgoth', 'Export to Pairgoth', 'Confirm Export', $selected_form_id);
@@ -225,6 +242,7 @@ if (isset($_GET['error']) && $_GET['error'] == 'egd_update_failed')
echo '<input type="hidden" name="action" value="go_form_create_form">';
echo '<table class="form-table">';
echo '<tr><th><label for="form_name">Form Name:</label></th><td><input type="text" name="form_name" id="form_name" required></td></tr>';
echo '<tr><th><label for="form_email">Notification Email:</label></th><td><input type="email" name="form_email" id="form_email" placeholder="Optional email for signup notifications"></td></tr>';
echo '</table>';
echo '<p class="submit"><input type="submit" class="button button-primary" value="Create Form"></p>';
echo '</form>';
@@ -234,7 +252,11 @@ if (isset($_GET['error']) && $_GET['error'] == 'egd_update_failed')
foreach ($forms as $f) {
$url = add_query_arg(array('page' => 'go-form-settings', 'form_id' => $f->id), admin_url('admin.php'));
echo '<li><a href="' . esc_url($url) . '">' . esc_html($f->name) . '</a> <span style="color:#888">(ID: ' . esc_html($f->id) . ')</span> - <small>Shortcode: <code>[go_form id=' . esc_html($f->id) . ']</code></small></li>';
echo '<li><a href="' . esc_url($url) . '">' . esc_html($f->name) . '</a> <span style="color:#888">(ID: ' . esc_html($f->id) . ')</span> - <small>Shortcode: <code>[go_form id=' . esc_html($f->id) . ']</code></small>';
if (!empty($f->email)) {
echo ' - <span style="color:#2271b1;">Email: ' . esc_html($f->email) . '</span>';
}
echo '</li>';
}
echo '</ul>';