Skip to content

Commit dc3ad66

Browse files
authored
Consolidating or reorganizing TEC integration code (weDevsOfficial#1786)
* enhancement tec-integration-improvements * Add filter to exclude pro-only form fields in free version Introduced the 'wpuf_form_fields_data' filter to allow modification of form fields before returning them. Implemented logic in Free_Loader to filter out fields marked as pro-only when the pro plugin is not active, ensuring only free fields are available in the free version. * Remove commented-out pro feature event date fields Deleted commented code related to Event Start and End date fields, which are pro features, from the event form template for improved code clarity and maintainability. * Remove filter for pro-only fields in free version Eliminated the filter that excluded pro-only fields when the pro plugin is not active. This change simplifies the loader and may allow all fields to be visible regardless of plugin status.
1 parent c5f7d11 commit dc3ad66

5 files changed

Lines changed: 24 additions & 571 deletions

File tree

includes/Admin/Forms/Form.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,17 @@ public function get_fields() {
367367

368368
// return $this->form_fields;
369369

370-
return $form_fields;
370+
/**
371+
* Filter form fields data array before returning
372+
*
373+
* Allows filtering the complete form fields array. Used to filter out
374+
* pro-only fields when pro plugin is not active.
375+
*
376+
* @since WPUF_SINCE
377+
*
378+
* @param array $form_fields The array of form fields data
379+
* @param int $this->id The form ID
380+
*/
381+
return apply_filters( 'wpuf_form_fields_data', $form_fields, $this->id );
371382
}
372383
}

includes/Integrations/Events_Calendar/Templates/Event_Form_Template.php

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -75,64 +75,6 @@ public function get_form_fields() {
7575
'id' => uniqid('wpuf_', true),
7676
'is_new' => true
7777
],
78-
[
79-
'input_type' => 'date',
80-
'template' => 'date_field',
81-
'required' => 'yes',
82-
'label' => __( 'Event Start', 'wp-user-frontend' ),
83-
'name' => '_EventStartDate',
84-
'is_meta' => 'yes',
85-
'help' => '',
86-
'width' => 'large',
87-
'format' => 'yy-mm-dd',
88-
'time' => 'yes',
89-
'wpuf_cond' => $this->conditionals,
90-
'id' => uniqid('wpuf_', true),
91-
'is_new' => true
92-
],
93-
[
94-
'input_type' => 'text',
95-
'template' => 'text_field',
96-
'required' => 'no',
97-
'label' => __( 'Event Start UTC', 'wp-user-frontend' ),
98-
'name' => '_EventStartDateUTC',
99-
'is_meta' => 'yes',
100-
'width' => 'large',
101-
'default' => $this->get_utc_time(),
102-
'css' => 'wpuf_hidden_field',
103-
'wpuf_cond' => $this->conditionals,
104-
'id' => uniqid('wpuf_', true),
105-
'is_new' => true
106-
],
107-
[
108-
'input_type' => 'text',
109-
'template' => 'text_field',
110-
'required' => 'no',
111-
'label' => __( 'Event End UTC', 'wp-user-frontend' ),
112-
'name' => '_EventEndDateUTC',
113-
'is_meta' => 'yes',
114-
'width' => 'large',
115-
'default' => $this->get_utc_time( '+2 hours' ),
116-
'css' => 'wpuf_hidden_field',
117-
'wpuf_cond' => $this->conditionals,
118-
'id' => uniqid('wpuf_', true),
119-
'is_new' => true
120-
],
121-
[
122-
'input_type' => 'date',
123-
'template' => 'date_field',
124-
'required' => 'yes',
125-
'label' => __( 'Event End', 'wp-user-frontend' ),
126-
'name' => '_EventEndDate',
127-
'is_meta' => 'yes',
128-
'help' => '',
129-
'width' => 'large',
130-
'format' => 'yy-mm-dd',
131-
'time' => 'yes',
132-
'wpuf_cond' => $this->conditionals,
133-
'id' => uniqid('wpuf_', true),
134-
'is_new' => true
135-
],
13678
[
13779
'input_type' => 'checkbox',
13880
'template' => 'checkbox_field',

0 commit comments

Comments
 (0)