• Resolved metalhead

    (@aaronthomas1979)


    Hello,

    I have several custom fields, which are all required, however, I would like to
    prevent “(required)” from showing up after each field, as it looks very unattractive. I’d rather just tell users that “All fields are required.”

    I removed (required) from all PHP files in the Xprofile plugin’s folder, and I also removed it from the register.php, completely, but it still shows up.

    Does anyone know how I can hide it?

    PS) I was able to hide it from the username, password, & email fields by editing register.php, and I was able to hide it from xprofile field’s birthday selector, but I just can’t seem to hide it from the other areas, such as the Drop Down Select Box and the Text Box.

    Thank you!

    • This topic was modified 9 years, 7 months ago by metalhead.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author donmik

    (@atallos)

    Add this to your functions.php:

    add_filter( 'bxcft_field_label', 'my_custom_label' );
    function my_custom_label( $label ) {
        return str_replace( esc_html__( '(required)', 'buddypress' ), '', $label );
    }

    It should remove all required text from labels. This will work only with the field types from my plugin.

    Thread Starter metalhead

    (@aaronthomas1979)

    Thanks for your reply!

    I added the code, but it didn’t work for me, for some reason.

    I’m using a child theme, so let me explain all the places I tried adding the code:

    added it to child theme’s functions.php <- no luck, removed it from there
    added it to parent theme’s functions.php <- no luck, removed it from there
    added it to bp-xprofile-custom-fields-type.php (just a guess) <- no luck, removed it

    Is there anything else you can think of that might be getting in the way of this new function from working?

    Thanks again!

    Plugin Author donmik

    (@atallos)

    Ummm, maybe your theme is adding the text? It works on my test site.

    Send me an url if you can.

    Thread Starter metalhead

    (@aaronthomas1979)

    Thanks for your help. A link is right here.

    I did remove the string (required) from all of the plugin’s php files. Would that throw the function off?

    Plugin Author donmik

    (@atallos)

    Hi,

    So I can see you are only using birthdate from my plugin, and this is the only field which is not displaying the required string. This is because the code you added is working.

    The rest of your fields are from buddypress plugin, so they don’t work with the code using my plugin’s filter.

    Add the following code to your theme’s stylesheet, and hide the required word with some css:

    .bp-required-field-label {
        display: none;
    }

    For the field type location, I don’t know what plugin you are using but if this is a plugin you should talk with his author or maybe simply translating the required string to be just a blank space.

    Thread Starter metalhead

    (@aaronthomas1979)

    Thank you! This resolved it. Thanks for everything!

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Hide (required)’ is closed to new replies.