• Resolved kayapati

    (@kayapati)


    Is there any way to change the Label from “Account Type” (from Roles field) to “My Label Name”, I have used Dropdown Roles with the label name “My Label Name” in my Profile form, and I have choosen Roles dropdown in search fitler, but the Label is displaying as a “Account Type” I need the label name which I have added in Profile form like “My label Name”

    Image draft will give more details.

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @kayapati

    You can change it in the form builder.

    Just edit the Account Type field in the Profile Form / Register Form. You will see two fields for naming the fields: Title & Label. You need to change the Label to update the Filter label.

    Regards,

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @kayapati

    I just checked that it’s not working.

    You can try this code snippet:

    add_filter("um_search_fields","um_custom_search_field_role_select", 10, 2 );
    function um_custom_search_field_role_select( $attrs, $field_key ){
    
        if( 'role_select' == $field_key ){
            $attrs['label'] = __('My Label Name','ultimate-member');
        }
    
        return $attrs;
    }

    Regards,

    Thread Starter kayapati

    (@kayapati)

    Champ its working, but What I need is the “My Label name” should be dynamic, it means, what ever Label name we add in the Default Profile form that should become a Label name in search fitler.

    I just named “My Label Name” as a reference.

    Thread Starter kayapati

    (@kayapati)

    Champ any chance to have a look at this request?

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @kayapati

    I’m investigating this issue along with Birth Date/Age issue between Profile & Directory.

    I’ll get back to you.

    Regards,

    Thread Starter kayapati

    (@kayapati)

    Thank you.

    Plugin Author Mykyta Synelnikov

    (@nsinelnikov)

    Hi @kayapati

    For dynamically filter’s label you could use this code snippet:

    add_filter( "um_search_fields", "um_custom_search_field_role_select", 10, 2 );
    function um_custom_search_field_role_select( $attrs, $field_key ) {
    
    	$profile_forms_fields = get_post_meta( {profile form ID here}, '_um_custom_fields', true );
    
    	if ( 'role_select' == $field_key ) {
    		$attrs['label'] = $profile_forms_fields['role_select']['label'];
    	}
    
    	return $attrs;
    }

    Let me know if this works,
    Thanks!

    Thread Starter kayapati

    (@kayapati)

    {profile form ID here}

    It means, we need to manually add the form ID?

    Is there any way it works automatically without manually adding form ID?

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @kayapati

    I’ve committed a code to add the third parameter directory_id to the filter. It will be pushed on the next update: https://github.com/ultimatemember/ultimatemember/commit/80d6d70b52ed609848698424c5762f8fdcffeed3

    Regards,

    Thread Starter kayapati

    (@kayapati)

    Great Thank you very much.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Roles Label in search filter’ is closed to new replies.