Feature Request: Filterable xProfile Field Labels
-
Hello,
Looking to request a feature for the xProfile fields, if this isn’t the right place to make sure a request can someone point me in the right direction.
I would love the xProfile classes be updated so the field labels are filterable, in my case this would be useful so I can replace the standard (required) denotation specifically when the xProfile field is included on the WooCommerce Checkout form to utilize the standard woocommerce asterisk (*) denotation.
The concept comes from the custom xProfile classes created by @donmik for the Buddypress Xprofile Custom Fields Type plugin;
https://wordpress.org/plugins/buddypress-xprofile-custom-fields-type/My specific implementation where the Xprofile fields are incorporated onto the Woocommerce Checkout form comes with the tandem implementation of the paid and free plugins by themekraft
Paid Primary – http://themekraft.com/store/woocommerce-buddypress-integration-wordpress-plugin/
Free Addon – https://wordpress.org/plugins/woocommerce-buddypress-integration-xprofile-checkout-manager/
Together these include the Xprofile fields onto the Checkout, however they don’t quite match with the Woocommerce fields so I had to add classes to them (currently capable through the bp_xprofile_field_edit_html_elements filter) and want to replace the (required) in the label with the appropriate asterisk.My current workaround involves jQuery to do the label replace, but I would prefer a label filter.
/** * Add Javascript to replace Buddypress (required) with Woocommerce required asterisk (*) */ add_action('woocommerce_after_checkout_form', 'wc4bp_woo_replace_required_for_xprofile_checkout_fields'); function wc4bp_woo_replace_required_for_xprofile_checkout_fields() { echo '<script>jQuery(document).ready(function($){$(".wc4bp_custom_checkout_fields_group label").each(function(i){$(this).html($(this).html().replace("(required)","<abbr class=\"required\" title=\"required\">*</abbr>"));});});</script>'; }
An example how @donmik implemented a label filter for his custom Xprofile fields;
$label = sprintf( '<label for="%s">%s%s</label>', bp_get_the_profile_field_input_name(), bp_get_the_profile_field_name(), (bp_get_the_profile_field_is_required()) ? ' ' . esc_html__( '(required)', 'buddypress' ) : '' ); // Label. echo apply_filters('bxcft_field_label', $label, bp_get_the_profile_field_id(), bp_get_the_profile_field_type(), bp_get_the_profile_field_input_name(), bp_get_the_profile_field_name(), bp_get_the_profile_field_is_required());
Hoping this is the right channel for this request, otherwise hoping someone can point me to it. Or if the plugin is available on github would be happy to make a fork request and code the change myself.
Thank you
- The topic ‘Feature Request: Filterable xProfile Field Labels’ is closed to new replies.