Hi,
try first with add_action( 'bp_init', 'blah...' );
You may also have to ensure you use the correct filter to remove. Those are listed in:
bp-xprofile/bp-xprofile-filters.php
Hello danbp,
I have tried all the following but no luck…
function value_field_remove_html_filter() {
remove_filter( 'bp_get_the_profile_field_value', 'xprofile_filter_kses', 1 );
}
add_action( 'bp_init', 'value_field_remove_html_filter' );
function edit_value_field_remove_html_filter() {
remove_filter ( 'bp_get_the_profile_field_edit_value', 'wp_filter_kses', 1 );
}
add_action( 'bp_init', 'edit_value_field_remove_html_filter' );
function data_field_remove_html_filter() {
remove_filter ( 'xprofile_get_field_data', 'xprofile_filter_kses', 1 );
}
add_action( 'bp_init', 'data_field_remove_html_filter' );
function data_value_before_save_remove_html_filter() {
remove_filter( 'xprofile_data_value_before_save', 'xprofile_sanitize_data_value_before_save', 1, 4 );
}
add_action( 'bp_init', 'data_value_before_save_remove_html_filter' );
function value_2_field_remove_html_filter() {
remove_filter( 'bp_get_the_profile_field_value', 'xprofile_filter_kses', 1 );
}
add_action( 'bp_init', 'value_2__field_remove_html_filter' );
function options_before_save_field_remove_html_filter() {
remove_filter( 'xprofile_field_options_before_save', 'bp_xprofile_sanitize_field_options' );
}
add_action( 'bp_init', 'options_before_save_field_remove_html_filter' );
function default_before_save_field_remove_html_filter() {
remove_filter( 'xprofile_field_default_before_save', 'bp_xprofile_sanitize_field_default' );
}
add_action( 'bp_init', 'default_before_save_field_remove_html_filter' );
I have managed to remove the html filter for Name and Description but I am not able to do the same for Xprofile fields what is that I need. Do you have any suggestions?
I would strongly advise AGAINST remove KSES filters. It’s there for your protection.
@djpaul ‘s advice is wise !
But you could try following which doesn’t compromise your security and will avoid the sky falling on your head !
First remove the filter hack, we don’t need it.
Then built your drop-down list and add only the site name instead the whole URL.
For example,
– create a new field
– call it Test drop down
– enforce visibility
– disallow clickable
– add some options: buddypress.org, wordpress.org
– save
Go to your profile > edit and choose buddypress.org. Save.
You see now buddypress.org on your profile
Now we have to make this text clickable and linked to bp.org
For this, you can use this snippet, placed in bp-custom.php
function bpfr_set_checkbox_output( $field_value ) {
// ensure xprofile is activated
if ( bp_is_active( 'xprofile' ) )
// call the field
$bp_this_field_name = bp_get_the_profile_field_name();
// field name (case sensitive)
if( $bp_this_field_name == 'Test drop down' ) {
// here we change site name to url
$field_value = str_replace('buddypress.org' ,'http://buddypress.org', $field_value);
$field_value = str_replace('wordpress.org' ,'http://wordpress.org', $field_value);
}
// fire the result!
return $field_value;
}
add_filter( 'bp_get_the_profile_field_value', 'bpfr_set_checkbox_output' );
Hello @djpaul & @danbp,
Thank you so so so much for your support!!!! I am searching 2 days now for a solution and the code you provided did the trick!!! You are awesome guys!!!!!!!!!