Advanced Search Question

3 posts by 2 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: March 9, 2010   (RSS)

By InHouse - March 4, 2010

In one Editor List View we display a column of info using the ListPage Fields value of createdBy.fullname to show a contributor's full name in the List. We do not store the actual full name in this table, but only in the User Accounts table.

I'd like the user to be able to search that List View for that name (or a portion thereof). Have tried entering an Advanced Search option as:

Name|createdBy.fullname

But this produces no results on a search.

Can anyone suggest a way to do this?

Jayme

Re: [InHouse] Advanced Search Question

By Dave - March 8, 2010

Hi Jayme,

It doesn't do that, but I made it do it now. Try this:

- open /lib/menus/default/list_functions.php
- search for: get fieldschema
- Add the code in red:
// get fieldschema for single field searches:
$fieldSchema = @$schema[ $fieldnames[0] ];
if ($fieldSchema) { $fieldSchema['name'] = $fieldnames[0]; }

// special case: add createdBy.fieldname search functionality
if (preg_match("/^createdBy\.(.*?)$/i", $fieldsAsCSV, $matches)) {
$name = 'createdByUserNum_match';
$lastValue = @$_REQUEST[$name];
$displayAs = 'dropdown';
$fieldSchema = array(
'name' => '_not_used_',
'optionsType' => 'table',
'optionsTablename' => 'accounts',
'optionsValueField' => 'num',
'optionsLabelField' => $matches[1],
);
}


- Go to: Admin > Section Editors > Your Section > Searching (Tab)
- Add this to add a search fields by user: Name|createdBy.fullname

Hope that helps! Let me know if that works for you. :)
Dave Edis - Senior Developer
interactivetools.com