This topic has 6 replies, 3 voices, and was last updated 7 years by Radu.

  • Author
  • #159634
     mohantyt
    Participant

    Hello,

    I have below requirements. Please guide me to implement it.

    1. I need the submit button on search member page on top as well as bottom of the search form

    2. Addition of one select box to each group of options so that it select all checkboxes for the group when we tick/click on it.

    3. Height attribute field have the option for “from”, “to” similar to age field

     

    Thanks,

    Tushar

    #159753
     Laura
    Moderator

    Hello, will assign the ticket to a higher support level who can help and advise you in your query.
    Thanks! ?

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    Laura Solanes - Graphic Designer and Web Designer

    Please be patient as I try to answer each topic as fast as i can.

    If you like the theme or the support you've received please consider leaving us a review on Themeforest!

    Always happy to help you 🙂

    #160164
     mohantyt
    Participant

    Please update me about this above requirements

    #160402
     Radu
    Moderator

    Hi,

    1. Paste this code to the functions.php file from child theme

    COPY CODE
    
    if (!function_exists('kleo_bp_search_form_horizontal')):
        function kleo_bp_search_form_horizontal ($show_button = true, $before_form=false)
        {
            global $bp_search_fields;
            if (function_exists('bp_is_active') && bp_is_active( 'xprofile' )) {}
            else
            {
                echo apply_filters('kleo_search_horizontal_no_buddypress','');
                return;
            }
    
            if (!isset($bp_search_fields['fields_horizontal']) || count ((array)$bp_search_fields['fields_horizontal']) == 0)
            {
                echo apply_filters('kleo_search_horizontal_no_fields','');
                return;
            }
    
            ?>
            <div id="search-bar">
                <div class="row">
                    <!--Search form-->
                    <form id="horizontal_search" action="<?php echo bp_get_root_domain (). '/'. bp_get_members_root_slug (). '/' ?>" method="get" class="<?php echo apply_filters('bp_search_horiz_extra_class','custom');?> dir-form twelve columns custom">
                        <div class="row">
                            <div class="one column hz-submit">
                                <button class="small button radius"><i class="icon-search"></i></button>
                            </div>
                            <?php if ($before_form || (isset($bp_search_fields['before_form_horizontal']) && !empty($bp_search_fields['before_form_horizontal']) ) ) : ?>
                                <div class="two columns">
                                    <label class="bp_search_form_filter"><?php if($before_form) echo __($before_form, 'kleo_framework'); else echo __($bp_search_fields['before_form_horizontal'],'kleo_framework');?></label>
                                </div>
                            <?php endif; ?>
    
                            <?php
                            $count = 0;
                            foreach ($bp_search_fields['fields_horizontal'] as $sf)
                            {
                                $count++;
    
                                $fname = 'field_'. $sf;
                                $posted = isset($_GET[$fname])?$_GET[$fname]:'';
                                $posted_to = isset($_GET[$fname. '_to'])?$_GET[$fname. '_to']:'';
    
                                $field = new BP_XProfile_Field ($sf);
                                $options = $field->get_children ();
    
                                if ( isset( $bp_search_fields['agerange'] ) && $sf == $bp_search_fields['agerange'] )
                                {
                                    $from = ($posted == '')? '': (int)$posted;
                                    $to = ($posted_to == '')?'': (int)$posted_to;
                                    if ($to != '' && $to < $from) $to = $from;
    
                                    echo '<div class="two columns hz-agerange hz-from">
                                    <select name="'.$fname.'" class="expand customDropdown">';
                                    echo '<option value="">'.__( (isset($bp_search_fields['agelabel'])?$bp_search_fields['agelabel']:$field->name), 'kleo_framework').' '.__('from', 'kleo_framework').'</option>';
                                    for($i=sq_option('buddypress_age_start');$i <= sq_option('buddypress_age_end');$i++)
                                    {
                                        echo '<option value="'.$i.'" '.get_selected($fname, $i, $from).' >'.$i.'</option>';
                                    }
                                    echo '</select>
                                  </div>';
    
                                    echo '<div class="two columns hz-agerange hz-to">
                                    <select name="'.$fname.'_to" class="expand customDropdown">';
                                    echo '<option value="">'.__( (isset($bp_search_fields['agelabel'])?$bp_search_fields['agelabel']:$field->name), 'kleo_framework').' '.__('to', 'kleo_framework').'</option>';
                                    for($i=sq_option('buddypress_age_start');$i <= sq_option('buddypress_age_end');$i++)
                                    {
                                        echo '<option value="'.$i.'" '.get_selected($fname.'_to', $i, $to).' >'.$i.'</option>';
                                    }
                                    echo ' </select>
                                  </div>';
                                    continue;
                                }
    
                                if ($sf == $bp_search_fields['numrange'])
                                {
                                    $from = ($posted == '' && $posted_to == '')? '': (float)$posted;
                                    $to = ($posted_to == '')? $from: (float)$posted_to;
                                    if ($to < $from)  $to = $from;
    
                                    echo '<div class="two columns hz-numrange hz-from">
                                  <input type="text" name="'.$fname.'" value="'.$from.'" placeholder="'.__( $field->name, 'kleo_framework').' '.__('from', 'kleo_framework').'" >
                                  </div>';
                                    echo '<div class="two columns hz-numrange hz-to">
                                      <input type="text" name="'.$fname.'_to" value="'.$to.'" placeholder="'.__( $field->name, 'kleo_framework').' '.__('to', 'kleo_framework').'" >
                                  </div>';
    
                                    continue;
                                }
    
                                switch ($field->type):
    
                                    case 'textarea':
                                        $value = esc_attr (stripslashes ($posted));
                                        echo "<div class='two columns hz-textarea'><input type='text' name='$fname' id='$fname' value='$value' placeholder='".__( $field->name, 'kleo_framework')."' /></div>";
                                        break;
    
                                    case 'selectbox':
                                        echo "<div class='two columns hz-select'><select class='expand' name='$fname' id='$fname'>";
                                        echo "<option value=''>".__( $field->name, 'kleo_framework')."</option>";
                                        foreach ($options as $option)
                                        {
                                            $option->name = trim ($option->name);
                                            $value = esc_attr (stripslashes ($option->name));
                                            $selected = ($option->name == $posted)? "selected='selected'": "";
                                            echo "<option $selected value='$value'>".__($value,'kleo_framework')."</option>";
                                        }
                                        echo "</select></div>";
                                        break;
    
                                    case 'multiselectbox':
                                        echo "<div class='two columns hz-multiselect'><select ".apply_filters('kleo_bp_search_multiselect_attributes',"multiple='multiple' data-customforms='disabled'")." class='expand' name='{$fname}[]' id='$fname'>";
                                        echo "<option value=''>".__( $field->name, 'kleo_framework')."</option>";
                                        foreach ($options as $option)
                                        {
                                            $option->name = trim ($option->name);
                                            $value = esc_attr (stripslashes ($option->name));
                                            $selected = (in_array ($option->name, (array)$posted))? "selected='selected'": "";
                                            echo "<option $selected value='$value'>".__($value,'kleo_framework')."</option>";
                                        }
                                        echo "</select></div>";
                                        break;
    
                                    case 'radio':
                                        echo "<div class='two columns hz-radio'>";
                                        echo "<label>".__( $field->name, 'kleo_framework')."</label>";
                                        echo '</div>';
    
                                        foreach ($options as $option)
                                        {
                                            $option->name = trim ($option->name);
                                            $value = esc_attr (stripslashes ($option->name));
                                            $selected = ($option->name == $posted)? "checked='checked'": "";
                                            echo "<div class='two columns bglabel'>";
                                            echo "<label><input $selected type='radio' name='$fname' value='$value'> ".__($value,'kleo_framework')."</label>";
                                            echo '</div>';
                                        }
                                        break;
    
                                    case 'checkbox':
                                        echo "<div class='two columns hz-checkbox-name'>";
                                        echo "<label>".__( $field->name, 'kleo_framework')."</label>";
                                        echo '</div>';
    
                                        foreach ($options as $option)
                                        {
                                            $option->name = trim ($option->name);
                                            $value = esc_attr (stripslashes ($option->name));
                                            $selected = (in_array ($option->name, (array)$posted))? "checked='checked'": "";
                                            echo "<div class='two columns bglabel hz-checkbox'>";
                                            echo "<label><input $selected type='checkbox' name='{$fname}[]' value='$value'> ".__($value,'kleo_framework')."</label>";
                                            echo '</div>';
                                        }
                                        break;
    
                                    case 'textbox':
                                    default:
                                        $value = esc_attr (stripslashes ($posted));
    
                                        echo "<div class='two columns hz-textbox'><input type='text' name='$fname' id='$fname' value='$value' placeholder='".__( $field->name, 'kleo_framework')."' /></div>";
                                        break;
    
                                endswitch;
    
                            }
    
                            echo "<input type='hidden' name='bs' value=' ' />";
                            do_action('kleo_bp_search_add_data');
                            ?>
                            <?php if ($show_button): ?>
                                <div class="two columns hz-submit">
                                    <button class="small button radius"><i class="icon-search"></i></button>
                                </div>
                            <?php else: ?>
                                <script type="text/javascript">
                                    jQuery(document).ready(function($) {
                                        $("input,select,radio,checkbox","#horizontal_search").change(function() {
                                            $("#horizontal_search").submit();
                                        });
                                    });
                                </script>
                            <?php endif;?>
    
                        </div>
                    </form>
                    <!--end search form-->
                </div><!--end row-->
            </div><!--end Search bar-->
            <?php
        }
    endif;
    

    2. I don’t understand the scenario about that, can you elaborate a little, please ?

    3. Maybe using this plugin : https://wordpress.org/plugins/bp-xprofile-range-field/

    Cheers
    R.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #160487
     mohantyt
    Participant

    Thanks for your reply.

    2. There are a lot of checkboxes for different options like(body type, languages etc). I need a select all link/button/checkbox to select all the checkboxes for languages/bodytype etc. Screenshot with few changes to understand the requirement

    Attachments:
    You must be logged in to view attached files.
    #160663
     mohantyt
    Participant

    I have implemented the plugin : https://wordpress.org/plugins/bp-xprofile-range-field/. But it displayed slider at admin panel and textbox at front end (screenshot attached).

    Attachments:
    You must be logged in to view attached files.
    #160806
     Radu
    Moderator

    Hi,

    For the 2. we don’t have a ready solution for that.

    Related to that plugin, we need some time to investigate and implement that, meanwhile, can you check how it’s with default wp theme? Is it displayed somewhere in frontend?

    Cheers
    R

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.

Log in with your credentials

Forgot your details?