Jump to content

Recommended Posts

Posted

Hello, I'm trying to create a front end search from custom fields stored in the user system template.

For example I've created a custom field "last_name", what selector can I use to find all the users with "smith" last name in my users table?

and how how to combine search terms?, for example to match a search for last name "smith" that have a status of married (married also a custom field in the user template)

Thank you

Posted
$u = $users->find("last_name=Smith");
foreach($u as $uu) {
    echo "{$uu->first_name} {$uu->last_name}<br>";
}

// combine: (marital_status is a page-reference field in my test setup)
$u = $users->find("marital_status=divorced, last_name=Smith");
foreach($u as $uu) {
    echo "{$uu->first_name} {$uu->last_name}, {$uu->marital_status->title} <br>";
}

 

  • Like 4

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...