Support » Plugin: BP Profile Search » Range not working probably after upgrade

  • Resolved amkh

    (@amkh)


    Hi,

    I noticed range is not working probably after recent upgrade. Below I am copying the range part of the my custom template. The same template was working well earlier.

    <?php
    
    /*
     * BP Profile Search - form template 'bps-form-sample-1'
     *
     * See http://dontdream.it/bp-profile-search/form-templates/ if you wish to modify this template or develop a new one.
     * A new or modified template should be moved to the 'buddypress/members' directory in your theme's root, otherwise it
     * will be overwritten during the next plugin update.
     *
     */
    
    	$F = bps_escaped_form_data ();
    
    	wp_enqueue_script ('select2-js', 'https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.5/js/select2.min.js', array ('jquery'));
    	wp_enqueue_style ('select2-css', 'https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.5/css/select2.min.css');
    ?>
    <script>
    	jQuery(document).ready(function($) {
    		$('.bps_form select').select2({placeholder: '---'});
    	});
    </script>
    <?php
    
    	$toggle_id = 'bps_toggle'. $F->id;
    	$form_id = 'bps_'. $F->location. $F->id;
    
    	if ($F->location != 'directory')
    	{
    		echo "<div id='buddypress'>";
    	}
    	else
    	{
    ?>
    	<div class="item-list-tabs bps_header" style="clear: both;">
    	  <ul>
    		<li><?php echo $F->header; ?></li>
    <?php
    		if ($F->toggle)
    		{
    ?>
    		<li class="last">
    		  <input id="<?php echo $toggle_id; ?>" type="submit" value="<?php echo $F->toggle_text; ?>">
    		</li>
    		<script type="text/javascript">
    			jQuery(document).ready(function($) {
    				$('#<?php echo $form_id; ?>').hide();
    				$('#<?php echo $toggle_id; ?>').click(function(){
    					$('#<?php echo $form_id; ?>').toggle();
    				});
    			});
    		</script>
    <?php
    		}
    ?>
    	  </ul>
    	</div>
    <?php
    	}
    
    	echo "<form action='$F->action' method='$F->method' id='$form_id' class='standard-form bps_form'>\n";
    
    	$j = 0;
    	foreach ($F->fields as $f)
    	{
    		if ($f->display == 'hidden')
    		{
    			echo "<input type='hidden' name='$f->code' value='$f->value'>\n";
    			continue;
    		}
    
    		$name = sanitize_title ($f->name);
    		$alt = ($j++ % 2)? 'alt': '';
    		$class = "editfield $f->code field_$name $alt";
    
    		echo "<div class='$class'>\n";
    
    		switch ($f->display)
    		{
    		case 'range':
    			if ($f->type == 'birthdate')
    			{
    				echo "<label for='$f->code'>$f->label</label>\n";
    
    				echo __('from', 'bp-profile-search'). " <select style='width: auto;' name='{$f->code}_min' id='$f->code'>\n";
    				echo "<option  value=''>". __('min', 'bp-profile-search'). "</option>\n";
    				for ($k=18; $k<100; $k++)
    				{
    					$selected = ($k == $f->min)? "selected='selected'": "";
    					echo "<option $selected value='$k'>$k</option>\n";
    				}
    				echo "</select>\n";
    
    				echo __('to', 'bp-profile-search'). " <select style='width: auto;' name='{$f->code}_max'>\n";
    				echo "<option  value=''>". __('max', 'bp-profile-search'). "</option>\n";
    				for ($k=18; $k<100; $k++)
    				{
    					$selected = ($k == $f->max)? "selected='selected'": "";
    					echo "<option $selected value='$k'>$k</option>\n";
    				}
    				echo "</select>\n";
    
    				break;
    			}
    			echo "<label for='$f->code'>$f->label</label>\n";
    				echo __('from', 'bp-profile-search'). " <select style='width: auto;' name='{$f->code}_min' id='$f->code'>\n";
    				echo "<option  value=''>". __('min', 'bp-profile-search'). "</option>\n";
    				for ($k=100; $k<220; $k++)
    				{
    					$selected = ($k == $f->min)? "selected='selected'": "";
    					echo "<option $selected value='$k'>$k</option>\n";
    				}
    				echo "</select>\n";
    
    				echo __('to', 'bp-profile-search'). " <select style='width: auto;' name='{$f->code}_max'>\n";
    				echo "<option  value=''>". __('max', 'bp-profile-search'). "</option>\n";
    				for ($k=100; $k<220; $k++)
    				{
    					$selected = ($k == $f->max)? "selected='selected'": "";
    					echo "<option $selected value='$k'>$k</option>\n";
    				}
    				echo "</select>\n";
    
    				break;
    
Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Andrea Tarantini

    (@dontdream)

    Hello amkh,

    Thank you for your report.

    While I look into this issue, you could use one of the previous versions that can be downloaded at the bottom of this page:

    https://wordpress.org/plugins/bp-profile-search/advanced/

    Could you please tell me which is the latest working version?

    I regressed to Version 4.8.6 and it is working.

    There is another issue related to search. After I search any criteria and then I list the members alphabetical then the search criteria is lost. The whole list is displayed

    Plugin Author Andrea Tarantini

    (@dontdream)

    Hello amkh,

    I think I fixed the problem, could you please download a fresh copy of 4.9.1 and test it?

    If it works for you I’ll make an official release. Thank you!

    Hi andrea,

    Thank you for updating me. I tested the new plugin. The range seems to be working fine. However these issues I have noticed :-
    1. When I select multiple ranges in one search the search does not list anything. For example if I search age range and height range together.
    2. When I flip between “Last Active”, “Newest Registered” and Alphabetical” in the “Order By” then the search fails and displays the full list. I noticed when I do the first run of flipping it shows correctly but when I again change the “Order By” the full list is displayed.
    3. After searching if I select any member and look at his profile and then click back button of browser to return to search page then I get the full blank page mentioning something like “Confirm resubmit” or something similar.

    Plugin Author Andrea Tarantini

    (@dontdream)

    Hi amkh,

    I’m not able to reproduce issues 1 and 2, is it possible to see your site?

    Please make sure you have ‘Persistent Search’ enabled in your ‘Edit Form’ page, it can make the difference in some settings.

    About issue 3, that’s a browser notice asking if you wish to resubmit your search, in this case you can safely say yes.

    Hi Andrea,

    Sorry for replying late. I tried enabling persistent search and found it is working fine. Are these problems also fixed in the latest release 4.9.2? Can I safely upgrade to 4.9.2?

    Plugin Author Andrea Tarantini

    (@dontdream)

    Hi amkh,

    Yes, 4.9.2 contains these fixes. Thank you!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Range not working probably after upgrade’ is closed to new replies.