Remove email and comment from enty table they will go to costum values
This commit is contained in:
@@ -86,9 +86,7 @@ Both tables are automatically removed when the plugin is uninstalled.
|
|||||||
| Club | Yes | Club name |
|
| Club | Yes | Club name |
|
||||||
| Rank | Yes | Go rank (30k to 9p) |
|
| Rank | Yes | Go rank (30k to 9p) |
|
||||||
| Rating | No | EGD rating (auto-calculated from rank if missing) |
|
| Rating | No | EGD rating (auto-calculated from rank if missing) |
|
||||||
| Email | No | Email address |
|
|
||||||
| EGD Number | No | European Go Database PIN |
|
| EGD Number | No | European Go Database PIN |
|
||||||
| Comment | No | Additional notes |
|
|
||||||
|
|
||||||
## Hooks
|
## Hooks
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ header('Content-Type: text/csv; charset=utf-8');
|
|||||||
header('Content-Disposition: attachment; filename="go-form-' . sanitize_title($form_name) . '-export.csv"');
|
header('Content-Disposition: attachment; filename="go-form-' . sanitize_title($form_name) . '-export.csv"');
|
||||||
|
|
||||||
$output = fopen('php://output', 'w');
|
$output = fopen('php://output', 'w');
|
||||||
fputcsv($output, ['ID', 'First Name', 'Last Name', 'Country', 'Club', 'Rank', 'Rating', 'Email', 'EGD Number', 'Comment', 'Date Added']);
|
fputcsv($output, ['ID', 'First Name', 'Last Name', 'Country', 'Club', 'Rank', 'Rating', 'EGD Number', 'Date Added']);
|
||||||
|
|
||||||
foreach ($entries as $e) {
|
foreach ($entries as $e) {
|
||||||
global $ranks;
|
global $ranks;
|
||||||
@@ -27,9 +27,7 @@ foreach ($entries as $e) {
|
|||||||
$e->club,
|
$e->club,
|
||||||
$ranks[$e->rank] ?? '',
|
$ranks[$e->rank] ?? '',
|
||||||
$e->rating,
|
$e->rating,
|
||||||
$e->email,
|
|
||||||
$e->egd_number,
|
$e->egd_number,
|
||||||
$e->comment,
|
|
||||||
$e->created_at
|
$e->created_at
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,9 +28,7 @@ function go_form_activate()
|
|||||||
club varchar(100) DEFAULT NULL,
|
club varchar(100) DEFAULT NULL,
|
||||||
rank tinyint(2) DEFAULT 0,
|
rank tinyint(2) DEFAULT 0,
|
||||||
rating smallint(5) DEFAULT 0,
|
rating smallint(5) DEFAULT 0,
|
||||||
email varchar(255) DEFAULT NULL,
|
|
||||||
egd_number varchar(20) DEFAULT NULL,
|
egd_number varchar(20) DEFAULT NULL,
|
||||||
comment text DEFAULT NULL,
|
|
||||||
created_at date DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
created_at date DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
||||||
PRIMARY KEY (id),
|
PRIMARY KEY (id),
|
||||||
FOREIGN KEY (form_id) REFERENCES $forms(id) ON DELETE CASCADE
|
FOREIGN KEY (form_id) REFERENCES $forms(id) ON DELETE CASCADE
|
||||||
@@ -113,9 +111,7 @@ function go_form_handle_submission()
|
|||||||
'club' => sanitize_text_field($_POST['club'] ?? ''),
|
'club' => sanitize_text_field($_POST['club'] ?? ''),
|
||||||
'rank' => $rank,
|
'rank' => $rank,
|
||||||
'rating' => $rating,
|
'rating' => $rating,
|
||||||
'email' => sanitize_email($_POST['email'] ?? ''),
|
|
||||||
'egd_number' => sanitize_text_field($_POST['egd_number'] ?? ''),
|
'egd_number' => sanitize_text_field($_POST['egd_number'] ?? ''),
|
||||||
'comment' => sanitize_textarea_field($_POST['comment'] ?? '')
|
|
||||||
];
|
];
|
||||||
|
|
||||||
if (empty($data['first_name']) || empty($data['last_name'])) {
|
if (empty($data['first_name']) || empty($data['last_name'])) {
|
||||||
|
|||||||
@@ -99,15 +99,8 @@
|
|||||||
<label for="egd_number">EGD Number:</label><input type="text" name="egd_number" id="egd_number">
|
<label for="egd_number">EGD Number:</label><input type="text" name="egd_number" id="egd_number">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
|
||||||
<label for="email">Email:</label><input type="email" name="email" id="email">
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<label for="comment">Comment</label>
|
|
||||||
<textarea name="comment" id="comment" rows="3"></textarea>
|
|
||||||
|
|
||||||
<p>* Required fields</p>
|
<p>* Required fields</p>
|
||||||
<input type="submit" name="go_form_submit" value="Submit">
|
<input type="submit" name="go_form_submit" value="Submit">
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -10,9 +10,7 @@
|
|||||||
<th>Date Added</th>
|
<th>Date Added</th>
|
||||||
<?php if ($show_admin): ?>
|
<?php if ($show_admin): ?>
|
||||||
<th>Rating</th>
|
<th>Rating</th>
|
||||||
<th>Email</th>
|
|
||||||
<th>Action</th>
|
<th>Action</th>
|
||||||
<th>Comment</th>
|
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@@ -32,11 +30,9 @@
|
|||||||
<?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>
|
<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>
|
||||||
<td> <?= esc_html($e->comment) ?> </td>
|
|
||||||
|
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user