Main
Index
Search
Posts
Who's
Online
Log
In

Home: Products: CMS Builder: Plugins & Add-ons:
Advanced Search Question

 

 


InHouse
User

Mar 4, 2010, 10:46 AM

Post #1 of 3 (2363 views)
Shortcut
Advanced Search Question Can't Post

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


Dave
Staff / Moderator


Mar 8, 2010, 4:35 PM

Post #2 of 3 (2328 views)
Shortcut
Re: [InHouse] Advanced Search Question [In reply to] Can't Post

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:

Code
    // 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
 


InHouse
User

Mar 9, 2010, 7:22 AM

Post #3 of 3 (2318 views)
Shortcut
Re: [Dave] Advanced Search Question [In reply to] Can't Post

Works perfectly Dave! A very useful new feature.

You genius remains unsurpassed - but that Chris guy might give you a run for your money now and then. ;-)

J.