blank search yields all users

13 years 2 months ago #150884 by Thelowlandpiper
blank search yields all users was created by Thelowlandpiper
I want a simple search as in Facebook etc; no entry = no results. How do I get this?
I currently display search criteria before displaying the list; but the user can click the FIND button without entering any criteria and the full list displays;

Please Log in to join the conversation.

13 years 2 months ago #150912 by krileon
Replied by krileon on topic Re: blank search yields all users
You'd need to develop an integration to alter the userlists search query when no criteria is specified to ensure the list returns no results. Sorry, there's no other way to do this. Currently the userlist will return all results if no criteria is specified.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

13 years 2 months ago #150966 by Thelowlandpiper
Replied by Thelowlandpiper on topic Re: blank search yields all users
i wonder why this option was chosen rather than what seems more sensible, that no entry be shown; still, I presume that somewhere there is a piece of js that translates as 'If the search criteria array is empty then display all the list"; it looks to me as if this is in the function cbsearchkrit(thisSelect) and that the line is
"if ( kindval == '' ) {
35 $(thisSelect).parent( 'div' ).next('div.cbSearchCriteria').slideUp('slow');
36 } else { "

If this is right then I could presumably just comment out the line; I see this code in Firebug in the header page of the search results page but where do I find the actual code to edit it?
Or am I up the wrohng creek here?

Please Log in to join the conversation.

13 years 2 months ago #150973 by Thelowlandpiper
Replied by Thelowlandpiper on topic |SOLVED [sort of]: blank search yields all users
Well, no that's not the place; what I've now done is to edit the file comprofiler.html.php;
kine 1714 reads:
// Render the list itself:

echo HTML_comprofiler::_cbTemplateRender( $cbTemplate, $myUser, 'List', 'drawListBody', array( &$users, &$columns, &$tableContent, $listid, $ueConfig ) );

I've amended this to read
// Render the list itself:

if ($searchResultDisplaying) {

echo HTML_comprofiler::_cbTemplateRender( $cbTemplate, $myUser, 'List', 'drawListBody', array( &$users, &$columns, &$tableContent, $listid, $ueConfig ) );


}

and this seems to work; If I click the FIND button without entering search criteria a blank results page is displayed; it's not perfect becuase the page header with the number of list users is displayed, but it's better than displaying the entire list ...

Please Log in to join the conversation.

13 years 2 months ago #150974 by nant

Thelowlandpiper wrote: If I click the FIND button without entering search criteria a blank results page is displayed; it's not perfect becuase the page header with the number of list users is displayed, but it's better than displaying the entire list ...


Usability question: why would someone click on the find button to begin with if no criteria has been given?

All searching works like this - look at Joomla User backend - if you keep filter empty all records are returned.

Please Log in to join the conversation.

13 years 2 months ago #150977 by Thelowlandpiper
Replied by Thelowlandpiper on topic Re: |SOLVED [sort of]: blank search yields all users
I've added the following to make it a little more friendly
if ($searchResultDisplaying) {
echo HTML_comprofiler::_cbTemplateRender( $cbTemplate, $myUser, 'List', 'drawListBody', array( &$users, &$columns, &$tableContent, $listid, $ueConfig ) );
}else {
echo '<div id="cbBlanklist">You did not enter any search criteria: click the back button to search again<div>';
}

the class 'cbBlanklist' could be defined in the css file to display the message more saisfactorily,

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.247 seconds

Facebook Twitter LinkedIn