Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
0c2be4f
refactor: clean and optimize events template
Ubayed-Bin-Sufian Feb 9, 2026
c93908f
fix(footer): fix enqueue mismatch and footer config initialization
Ubayed-Bin-Sufian Feb 10, 2026
91f5447
style(phpcbf): auto-fix coding standards
Ubayed-Bin-Sufian Feb 10, 2026
6317074
remove redundant files
Ubayed-Bin-Sufian Feb 10, 2026
49b2ef2
Merge branch 'main' into refactor/events-template-arch
Ubayed-Bin-Sufian Feb 11, 2026
5e9048e
fix: handle wp_insert_post() returning 0 in ajax_add_event()
Ubayed-Bin-Sufian Feb 11, 2026
d9397a9
fix(ajax): handle wp_update_post() failure in event update handler
Ubayed-Bin-Sufian Feb 11, 2026
4df7423
fix(admin): update event time placeholder to match input type
Ubayed-Bin-Sufian Feb 11, 2026
546409d
fix(admin): improve footer sanitization
Ubayed-Bin-Sufian Feb 12, 2026
9b00d33
fix(admin): improve AJAX error handling
Ubayed-Bin-Sufian Feb 12, 2026
e0b8398
docs: remove unused items field from wpfa_test_news_feed docblock
Ubayed-Bin-Sufian Feb 17, 2026
921074e
style: broaden footer form selectors to include textarea
Ubayed-Bin-Sufian Feb 17, 2026
b9f361b
fix(js): standardize AJAX error handling across all event actions
Ubayed-Bin-Sufian Feb 19, 2026
5a79b7b
fix(js): handle both string and object error responses in footer AJAX
Ubayed-Bin-Sufian Feb 21, 2026
2257c23
fix: update event counter to reflect total count of all events
Ubayed-Bin-Sufian Feb 21, 2026
3189151
Refactor: Extract speaker AJAX handlers into dedicated class
Ubayed-Bin-Sufian Feb 23, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 43 additions & 11 deletions admin/class-wpfaevent-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,12 @@ public function render_event_meta_box( $post ) {

$start_date = get_post_meta( $post->ID, 'wpfa_event_start_date', true );
$end_date = get_post_meta( $post->ID, 'wpfa_event_end_date', true );
$time = get_post_meta( $post->ID, 'wpfa_event_time', true );
$location = get_post_meta( $post->ID, 'wpfa_event_location', true );
$url = get_post_meta( $post->ID, 'wpfa_event_url', true );
$lead_text = get_post_meta( $post->ID, 'wpfa_event_lead_text', true );
$reg_link = get_post_meta( $post->ID, 'wpfa_event_registration_link', true );
$cfs_link = get_post_meta( $post->ID, 'wpfa_event_cfs_link', true );
$speakers = get_post_meta( $post->ID, 'wpfa_event_speakers', true );

// Normalize to array
Expand All @@ -258,14 +262,30 @@ public function render_event_meta_box( $post ) {
<th><label for="wpfa_event_end_date"><?php esc_html_e( 'End Date', 'wpfaevent' ); ?></label></th>
<td><input type="date" id="wpfa_event_end_date" name="wpfa_event_end_date" value="<?php echo esc_attr( $end_date ); ?>" class="regular-text"></td>
</tr>
<tr>
<th><label for="wpfa_event_time"><?php esc_html_e( 'Event Time', 'wpfaevent' ); ?></label></th>
<td><input type="time" id="wpfa_event_time" name="wpfa_event_time" value="<?php echo esc_attr( $time ); ?>" class="regular-text" placeholder="e.g., 10:00 AM - 4:00 PM"></td>
</tr>
<tr>
<th><label for="wpfa_event_location"><?php esc_html_e( 'Location', 'wpfaevent' ); ?></label></th>
<td><input type="text" id="wpfa_event_location" name="wpfa_event_location" value="<?php echo esc_attr( $location ); ?>" class="regular-text"></td>
</tr>
<tr>
<th><label for="wpfa_event_lead_text"><?php esc_html_e( 'Lead Text', 'wpfaevent' ); ?></label></th>
<td><input type="text" id="wpfa_event_lead_text" name="wpfa_event_lead_text" value="<?php echo esc_attr( $lead_text ); ?>" class="regular-text" placeholder="<?php esc_attr_e( 'Short description for hero section', 'wpfaevent' ); ?>"></td>
</tr>
<tr>
<th><label for="wpfa_event_url"><?php esc_html_e( 'Event URL', 'wpfaevent' ); ?></label></th>
<td><input type="url" id="wpfa_event_url" name="wpfa_event_url" value="<?php echo esc_attr( $url ); ?>" class="regular-text" placeholder="https://"></td>
</tr>
<tr>
<th><label for="wpfa_event_registration_link"><?php esc_html_e( 'Registration Link', 'wpfaevent' ); ?></label></th>
<td><input type="url" id="wpfa_event_registration_link" name="wpfa_event_registration_link" value="<?php echo esc_attr( $reg_link ); ?>" class="regular-text" placeholder="https://eventyay.com/e/..."></td>
</tr>
<tr>
<th><label for="wpfa_event_cfs_link"><?php esc_html_e( 'Call for Speakers Link', 'wpfaevent' ); ?></label></th>
<td><input type="url" id="wpfa_event_cfs_link" name="wpfa_event_cfs_link" value="<?php echo esc_attr( $cfs_link ); ?>" class="regular-text" placeholder="https://eventyay.com/e/.../cfs"></td>
</tr>
<tr>
<th><label for="wpfa_event_speakers"><?php esc_html_e( 'Speakers', 'wpfaevent' ); ?></label></th>
<td>
Expand Down Expand Up @@ -369,22 +389,34 @@ public function save_event_meta( $post_id ) {
return;
}

if ( isset( $_POST['wpfa_event_start_date'] ) ) {
update_post_meta( $post_id, 'wpfa_event_start_date', sanitize_text_field( wp_unslash( $_POST['wpfa_event_start_date'] ) ) );
}
// List of all meta fields to save
$meta_fields = array(
'wpfa_event_start_date',
'wpfa_event_end_date',
'wpfa_event_time',
'wpfa_event_location',
'wpfa_event_lead_text',
'wpfa_event_url',
'wpfa_event_registration_link',
'wpfa_event_cfs_link',
);

if ( isset( $_POST['wpfa_event_end_date'] ) ) {
update_post_meta( $post_id, 'wpfa_event_end_date', sanitize_text_field( wp_unslash( $_POST['wpfa_event_end_date'] ) ) );
}
foreach ( $meta_fields as $field ) {
if ( isset( $_POST[ $field ] ) ) {
$value = wp_unslash( $_POST[ $field ] );

if ( isset( $_POST['wpfa_event_location'] ) ) {
update_post_meta( $post_id, 'wpfa_event_location', sanitize_text_field( wp_unslash( $_POST['wpfa_event_location'] ) ) );
}
// Special handling for URL fields
if ( in_array( $field, array( 'wpfa_event_url', 'wpfa_event_registration_link', 'wpfa_event_cfs_link' ), true ) ) {
$value = esc_url_raw( $value );
} else {
$value = sanitize_text_field( $value );
}

if ( isset( $_POST['wpfa_event_url'] ) ) {
update_post_meta( $post_id, 'wpfa_event_url', esc_url_raw( wp_unslash( $_POST['wpfa_event_url'] ) ) );
update_post_meta( $post_id, $field, $value );
}
}

// Handle speakers array
if ( isset( $_POST['wpfa_event_speakers'] ) && is_array( $_POST['wpfa_event_speakers'] ) ) {
$speakers = array_map( 'absint', $_POST['wpfa_event_speakers'] );
update_post_meta( $post_id, 'wpfa_event_speakers', $speakers );
Expand Down
Loading
Loading