Skip to:
Content
Pages
Categories
Search
Top
Bottom

Suppressing rich text on xprofile text area


  • Antipole
    Participant

    @antipole

    Hi… I want to suppress the rich text feature on my user profile field Credentials. I understand I can do this using a filter and believe I need something like this in my bp-custom.php file:

    add_filter( 'bp_xprofile_is_richtext_enabled_for_field', false, bp_the_profile_field_id( 'fieldname=Credentials' ) );
    However, bp_the_profile_field_id() does not exist but I need someway to supply the field ID which is not apparent to me.

    Any guidance, please?

    thanks, Tony

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

  • @mcuk
    Participant

    @mcuk


    danbp
    Participant

    @danbp

    To get the field_id, simply go to admin xprofile field editor and mouse over the edit button. The id can be seen in the bottom left cornet of your brower.

    Example use field_id 3. Snippet goes to bp-custom.php

    
    function antipole_remove_rich_text( $field_id = null ) {
        if ( ! $field_id ) {
            $field_id = bp_get_the_profile_field_id( '3' );
        }
     
        $field = xprofile_get_field( $field_id );
      
        if ( $field ) {
            $enabled = false;
        }
    }
    add_filter( 'bp_xprofile_is_richtext_enabled_for_field', 'antipole_remove_rich_text' );

    Antipole
    Participant

    @antipole

    Thank you very much @danbp. This does exactly what I wanted.

    Only ‘problem’ is that I don’t understand how it works. You are setting $field to be the required field definition. Then you set what appears to be the local variable $enabled to false, but don’t reference it any further or return it.

    Or is there more to ‘$enabled’ than I am seeing?

    Pardon my ignorance.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Suppressing rich text on xprofile text area’ is closed to new replies.
Skip to toolbar