millsie provided you the answer!
To clarify...
1) ADD a new field called
hideemail or even better
EmailPermission in the
db_def hash in the
default.cfg file. Make this a Yes or No field.
2) Then define this field as a
%db_checkbox_field or
%db_radio_field in the
default.cfg file.
3) Then in your
sub html_record_form routine, add this field as you defined it as either a checkbox or radio field (using the print &build_checkbox_field codes).
4) Then in the
sub html_record routine add the following codes:
Code:
if (($per_admin) && ($rec{'EmailPermission'} eq "No")) {
print qq|Email Address: <a href="$rec{'Email'}">$rec{'Email'}</a>|;
}
else {
print qq|Email Address: Not Available|;
}
The translation of these codes is that if the person accessing the database is the
admin and if the Permission of the field is
No, then only the Admin will be able to view it.
Else...if the person enters Yes to have the Email address added publicly, then everyone can view it.
Adding the {$per_admin) condition will ensure that people cannot search for the Email field in your search form.
Of course, another solution is to create your own search form (turning off auto-generation off) and only include specific fields in the search form and NOT use the
keyword option.
Then you would follow the above steps, except that in your
sub html_record routine, you would replace the codes I've posted above with a variation of what
millsie posted:
Code:
if ($rec{'EmailPermission'} eq "Yes")) {
print qq|Email Address: <a href="$rec{'Email'}">$rec{'Email'}</a>|;
}
else {
print qq|Email Address: Not Available|;
}
Regards,
------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums