1

Is it possible to setup a search form that searches both Members and Channel Entries.

I want to then show a single results page where i can show both the members and channel entries that come from the search request.

I have Low Search and Solspace User.

Possible?

1 Answer 1

0

Not that I know of (Low or SolSpace may chime in if I'm wrong about their modules capacities), however you could do some "magic" on the results template. I'm thinking if you just do a content/entries search, then on your results page you could do a manual/PHP user search (as users have limited fields!) on the results template, appending these results as needed.

By example, something like this :

<?php
    //get the search term
    $searchTerm = ee()->uri->segment(3);

    //here split the actual search term from the search string

    //Now search the members table
    $searchedUsers = array();
    //search username, screen name and email...
    $query = ee()->db->like('user_name',$searchTerm)
                     ->or_like('screenname',$searchTerm)
                     ->or_like('email',$searchTerm)
                     ->get('members');
    foreach ( $query->result_array() as $row ) {
        $searchedUsers[] = $row;
    }
?>

{!-- here we display the channel entries results --}
{exp:low_search:results query="{segment_3}" limit="10"}
    {if count ==  1}<ol>{/if}
        <li>{title}</li>
    {if count == total_results}</ol>{/if}
    {if no_results}No search results{/if}
{/exp:low_search:results}

{!-- And now the member results --}
<?php 
    if ( !empty($searchedUsers) { 
        echo "<ol>";
        foreach ( $searchedUsers as $sUser ) {
            echo "<li>".$sUser['screenname']." - ".$sUser['email']."</li>";
        }
        echo "</ol>";
    }
?>

(you'll probably need PHP on Output so you can parse the search tags and get the search term)

By example, absolutely untested but should be a good starting point!

After thought - please read

Now I think about it, doesn't SolSpace User use a channel to store users data? I could be wrong but maybe you just need to identify the User Channel and feed that into Low Search? Hopefully SolSpace will pop in and confirm if this works (They're regularly active so shouldn't be too long ;) )... Scrap this, I was thinking of another module

7
  • Thanks Blatant, as you said, I will wait and see if @Solspace or Low can provide a solution out of the box, if not I will give your solution a try.
    – ljm
    Commented Apr 21, 2015 at 23:45
  • For Super Search at least, this is not possible: Super Search searches for channel entries only. I recommend submitting this as a Feature Request under the specific add-on category. It'll also give other users the option to vote up the feature request, and help us prioritize features to add in upcoming versions of this add-on. :) support.solspace.com/support/discussions
    – Solspace
    Commented Apr 22, 2015 at 8:23
  • Thanks SolSpace, I will vote it up. Appologies I beleive I was thinking of Zoo Visitor when I was talking about your User module and storing in a channel entry. My bad!
    – Blatant
    Commented Apr 22, 2015 at 8:37
  • Like Super Search, Low Search only returns channel entries. However, using Zoo Visitor and Low Search Members will associate members to channel entries and make them searchable, too.
    – Low
    Commented Apr 22, 2015 at 8:58
  • Thanks Low, Low Search Members looks good, looks like it'll do the job without the need for Zoo Visitor. does Low Search Members work with SolSpace User fields too?
    – Blatant
    Commented Apr 22, 2015 at 9:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.