Gossamer Forum
Home : Products : DBMan : Customization :

Keyword searches hidden fields

Quote Reply
Keyword searches hidden fields
Hi,

The keyword search searches ALL fields. How could I prevent it to search fields that I want to keep hidden or non-searchable? Is there a simple way to do that?

Thanks!
Quote Reply
Re: Keyword searches hidden fields In reply to
If you have set your "form-length" to -1 for these fields in your .cfg file, you could add a line to sub query in db.cgi.

After

Code:
if ($i == $auth_user_field) { $i++; next; }

add

Code:
if ($db_form_len[$i] == -1) { $i++; next; }

If you wanted to have some fields that were searchable by admin only, set the form-length for those fields to -2 and add the following to sub query (just below the code I listed above).

Code:
if (($db_form_len[$i] == -2) && (!$per_admin)) { $i++; next; }



------------------
JPD





Quote Reply
Re: Keyword searches hidden fields In reply to
Thanks JPD for your help.

But for some reason, it does not seem to work. I looked again and again to see if I had done a mistake, but I haven't see anything. I set up the fields to -2 and it does not work...

I have no clue...
Quote Reply
Re: Keyword searches hidden fields In reply to
You're not logged in as "admin" when you're testing this, are you? (I had to ask. Smile )

Can I see your database in action? I'll just need to be able to have "view" permission.



------------------
JPD





Quote Reply
Re: Keyword searches hidden fields In reply to
It took me a long time to figure it out because I don't know Perl and I don't know dbman too much, but it seems to be working now!

It should be, I think:

if ($db_form_len{$column} == -1) { $i++; next; }
if (($db_form_len{$column} == -2) && (!$per_admin)) { $i++; next; }


with $column instead of $i !

Thanks JPD for your help. You are doing an incredible work here in this forum. Good night!
Quote Reply
Re: Keyword searches hidden fields In reply to
You're absolutely right! (See, I make these mistakes so you will have to figure it out for yourself and learn about how it works. Wink )

Congratulations!


------------------
JPD