PluginProbe
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor / 4.0.3
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor v4.0.3
4.0.3 4.0.2 4.0.1 4.0.0 3.16.6 3.16.5 3.16.4 3.16.3 3.16.2 3.16.1 3.16.0 3.15.9 3.9.9 3.9.5 3.9.6 3.9.7 3.9.8 1.1.7 1.1.8 1.1.9 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 All 341 releases
← All changes | admin/advanced-settings/includes/forms/placeholder-labels.php +31 -1 4.0.0 → 4.0.3 View file →
@@ -186,9 +186,9 @@
186 186 function wppb_pbpl_activate( $form ) {
187 187 $pbpl_pb_moduleSettings = get_option( 'wppb_module_settings', 'not_found' );
188 188
189 189 if( ( $pbpl_pb_moduleSettings != 'not_found' && isset( $pbpl_pb_moduleSettings['wppb_multipleRegistrationForms'] ) && $pbpl_pb_moduleSettings['wppb_multipleRegistrationForms'] == 'show' ) || ( $pbpl_pb_moduleSettings != 'not_found' && isset( $pbpl_pb_moduleSettings['wppb_multipleEditProfileForms'] ) && $pbpl_pb_moduleSettings['wppb_multipleEditProfileForms'] == 'show' ) ) {
190 - if( ! empty( $form['ID'] ) ) {
190 + if( wppb_pbpl_form_uses_per_form_option( $form ) ) {
191 191 $pbpl_saved_value = get_post_meta( $form['ID'], 'pbpl-active', true );
192 192
193 193 if( $pbpl_saved_value != 'yes' ) {
194 194 return;
@@ -202,8 +202,38 @@
202 202 wppb_pbpl_add_filters();
203 203 }
204 204 }
205 205 add_action( 'wppb_form_args_before_output', 'wppb_pbpl_activate' );
206 +
207 +
208 +/*
209 + * Function that decides whether a form is governed by the per-form "Enable Placeholders" option
210 + *
211 + * - a bare shortcode resolves to the default form, which nobody ever opted in on
212 + * - the modern form builder hides the meta box, so the option cannot be set there
213 + * - when it does not apply, the global Placeholder Labels setting decides
214 + *
215 + * @param array $form Contain the form args
216 + *
217 + * @return bool
218 + */
219 +function wppb_pbpl_form_uses_per_form_option( $form ) {
220 + if( empty( $form['ID'] ) )
221 + return false;
222 +
223 + if( empty( $form['form_name'] ) || $form['form_name'] === 'unspecified' )
224 + return false;
225 +
226 + if( ! function_exists( 'wppb_fb_is_active_for' ) )
227 + return true;
228 +
229 + $post_type = get_post_type( $form['ID'] );
230 +
231 + if( ! in_array( $post_type, array( 'wppb-rf-cpt', 'wppb-epf-cpt' ), true ) )
232 + return false;
233 +
234 + return ! wppb_fb_is_active_for( $post_type );
235 +}
206 236
207 237
208 238 /*
209 239 * Function that adds the necessary filters