Preventing visitors from finding users in a search

February 8th, 2005

My Plone site is intended to be view-only to most of the world. So you can come and browse around, but you can't contribute unless I give you a logon. That part was easy to set up, but I also wanted to prevent non-contributors from seeing the Members list or members' pages. It's easy to prevent the Members folder from being displayed, but it's not quite so easy to prevent people from running a site-wide search that will hit on something within the Members area.

I discovered how to do this on the following useful plone.org page:

Limiting Search to Sections of Site
http://plone.org/documentation/howto/how-to-limit-search

This page also reveals (part of) something else I wanted to do. I'd seen on other Plone site (e.g. http://scs.ictp.it/) a search box with a drop-down list that allows you to search sections of the site, or other websites (Amazon, Google, etc). This page shows how to do the site-section part of this.

The relevant sections are:
As done on plone.org by Joel Burton and
Limiting search to a member's folder by Bill Page

One of the trickiest thing about following instructions for customizing Plone is to find stuff in the ZMI. I had to search a bit to find global_searchbox, and then how to add a script to the skins folder. Here's how it's done:

global_searchbox is in the portal_skins/plone_templates folder within your Plone site (for me this is /plone/portal_skins/plone_templates).

You make a copy for customizing, so the next time you want to edit this you can find it in your custom folder (e.g. for me /plone/portal_skins/custom).

To add the Python script to your skins folder, as directed in "Limiting search to a member's folder", you need to copy and paste the script into a text file, get rid of stray spaces at the start of the first few lines, then save the file locally. Then, in the ZMI, go to the portal_skins folder of your Plone site (in my case this is /plone/portal_skins). Click the Add button, top right. Scroll down until you can select Script (Python). You can then browse to the script file you want to upload, making sure you give the new object the correct name.

To do
I still need find out how to include extra-site searches within this drop-down.

Leave a comment