Skip to:
Content
Pages
Categories
Search
Top
Bottom

Filtering question

  • Avatar of Henry
    Henry
    Participant

    @henrywright-1

    I am trying to filter the edit profile radio button using the filter bp_get_the_profile_field_options_radio

    I am basically trying to add a class ‘regular-radio’ to the radio input. My code is:

    function edit_profile_radio($test) {
    	$test = '<label><input' . $selected . ' type="radio" class="regular-radio" name="field_' . $field->id . '" id="option_' . $options[$k]->id . '" value="' . esc_attr( stripslashes( $options[$k]->name ) ) . '"> ' . esc_attr( stripslashes( $options[$k]->name ) ) . '</label>';
    	return $test;
    }
    add_filter( 'bp_get_the_profile_field_options_radio', 'edit_profile_radio' );

    This isn’t working I think because I’m missing something with reference to the $options[$k], $field->id, $selected, $k

    The code I am trying to filter is on line 562 in buddypress/bp-xprofile/bp-xprofile-template.php

    Can anyone point me in the right direction?

Viewing 1 replies (of 1 total)
  • Avatar of Henry
    Henry
    Participant

    @henrywright-1

    Seem to have got the bugger working by adding the following to the function:

    global $field;
    $options = $field->get_children();

    and passing the proper number of variables to the function:

    function edit_profile_radio($test, $options, $field, $selected, $k)

    and

    add_filter( 'bp_get_the_profile_field_options_radio', 'edit_profile_radio', 10, 5 );

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.