Files
wp-go-form/go-form-plugin/templates/table.php
Nikola Petrov 2d537f07dd Add complete custom fields implementation and entry editing
- Add custom field CRUD in admin UI (create, read, update, delete)
- Display custom fields on frontend form with proper field types
- Save custom field values on form submission
- Display custom field columns in entries table (admin and public)
- Include custom field values in all export formats (CSV, PairGoTh, OpenGotha, McMahon)
- Add Edit button and form for entries
- Update entry handler to support editing with custom field values
- Add success/error notices for all admin actions

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-05-12 13:02:33 +02:00

67 lines
1.9 KiB
PHP

<table class="wp-list-table widefat striped">
<thead>
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>Country</th>
<th>Club</th>
<th>Rank</th>
<th>EGD Number</th>
<th>Date Added</th>
<?php
// Add custom field columns
foreach ($custom_fields as $field):
if ($field->is_public || $show_admin):
echo '<th>' . esc_html($field->field_name) . '</th>';
endif;
endforeach;
?>
<?php if ($show_admin): ?>
<th>Rating</th>
<th>Action</th>
<?php endif; ?>
</tr>
</thead>
<tbody>
<?php foreach ($entries as $e): ?>
<tr>
<td> <?= esc_html($e->first_name) ?> </td>
<td> <?= esc_html($e->last_name) ?> </td>
<td> <?= esc_html($e->country) ?> </td>
<td> <?= esc_html($e->club) ?> </td>
<td> <?= esc_html($ranks[$e->rank]) ?> </td>
<td> <?= esc_html($e->egd_number) ?> </td>
<td> <?= esc_html($e->created_at) ?> </td>
<?php
// Display custom field values
foreach ($custom_fields as $field):
if ($field->is_public || $show_admin):
echo '<td>';
$value = go_form_get_custom_value($e->id, $field->id);
if ($field->field_type === 'checkbox') {
echo $value ? 'Yes' : 'No';
} else {
echo esc_html($value);
}
echo '</td>';
endif;
endforeach;
?>
<?php if ($show_admin): ?>
<td> <?= esc_html($e->rating) ?> </td>
<td>
<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); ?>
</td>
<?php endif; ?>
</tr>
<?php endforeach; ?>
</tbody>
</table>