- Added explicit checks to prevent authentication redirects on registration page - Added ensure_registration_page_public() method with priority 1 to run before other auth checks - Included registration-pending and training-login pages in public pages list - Added fallback function in main plugin file to remove auth hooks on registration page This ensures that users can access /trainer/registration/ without being logged in, as intended for new trainer signups.
55 lines
No EOL
1.6 KiB
PHP
55 lines
No EOL
1.6 KiB
PHP
<?php
|
|
/**
|
|
* Event Form Handler
|
|
*
|
|
* @package HVAC_Community_Events
|
|
*/
|
|
|
|
namespace HVAC_Community_Events;
|
|
|
|
/**
|
|
* Class Event_Form_Handler
|
|
*
|
|
* Handles event form submission field mapping
|
|
*/
|
|
class Event_Form_Handler {
|
|
|
|
/**
|
|
* Constructor
|
|
*/
|
|
public function __construct() {
|
|
add_filter('tec_events_community_submission_form_data', array($this, 'map_description_field'), 10, 1);
|
|
add_filter('tec_events_community_submission_validate_before', array($this, 'map_description_before_validation'), 5, 1);
|
|
}
|
|
|
|
/**
|
|
* Map tcepostcontent to post_content before validation
|
|
*
|
|
* @param array $submission_data The form submission data
|
|
* @return array Modified submission data
|
|
*/
|
|
public function map_description_before_validation($submission_data) {
|
|
// If tcepostcontent exists but post_content doesn't, map it
|
|
if (isset($submission_data['tcepostcontent']) && empty($submission_data['post_content'])) {
|
|
$submission_data['post_content'] = $submission_data['tcepostcontent'];
|
|
}
|
|
|
|
return $submission_data;
|
|
}
|
|
|
|
/**
|
|
* Map description field for form data
|
|
*
|
|
* @param array $form_data The form data
|
|
* @return array Modified form data
|
|
*/
|
|
public function map_description_field($form_data) {
|
|
// Ensure post_content is set from tcepostcontent
|
|
if (isset($_POST['tcepostcontent']) && empty($_POST['post_content'])) {
|
|
$_POST['post_content'] = $_POST['tcepostcontent'];
|
|
$form_data['post_content'] = $_POST['tcepostcontent'];
|
|
}
|
|
|
|
return $form_data;
|
|
}
|
|
} |