• Resolved Carsten Lund

    (@carsten-lund)


    Hi Andrea, thanks for the update, hope you are doing well?

    I have a question to, why the Custom Xprofile Field type From/To Value, which can be used to show 2 numbers or text strings.

    But it can’t be added as a search field. Maybe it is because of the nature of the field type, I just can’t se why?

    From/To Value is the only which does not have drop down select boxes. You once helped, changing two input boxes to drop down select boxes with the code below. Would it be possible to change the From/To Value fields the same way?

    Regards
    Carsten

    
    // BP SEARCH By default, the range is displayed using two input boxes, but we can change that to two drop-down select boxes
    
    add_action( 'bps_field_before_search_form', 'change_display' );
    function change_display( $f ) {
    // for the "age range" search mode
    	if ( $f->code == 'field_578' && $f->display == 'integer-range' ) {
    		$f->display = 'range-select';
    		$range      = range( 18, 99 );
    		$f->options = array( '' => '' ) + array_combine( $range, $range );
    	}
    
    // for the "hight range" search mode
    	if ( $f->code == 'field_5037' && $f->display == 'integer-range' ) {
    		$f->display = 'range-select';
    		$range      = range( 140, 210 );
    		$f->options = array( '' => '' ) + array_combine( $range, $range );
Viewing 1 replies (of 1 total)
  • Plugin Author Andrea Tarantini

    (@dontdream)

    Hi Carsten,

    The ‘From/To values’ field type provided by BuddyPress Xprofile Custom Field Types is not registered with BP Profile Search, that’s why it’s not available as a search field.

    You could ask the BuddyPress Xprofile Custom Field Types team to register that field type, or you could try using a native field type, e.g. ‘Number’.

    The code I provided is only meant for search fields, unfortunately it doesn’t work for profile fields.

Viewing 1 replies (of 1 total)
  • The topic ‘Can’t add From/To Value field type as search field’ is closed to new replies.