Gossamer Forum
Home : Products : DBMan : Customization :

hide field only from default

Quote Reply
hide field only from default
I was wondering if it was possible to hide a field only from a default user? What I would like to do is have regular registered users able to see the field hidden to the default user. I would like to do this with the email field of the user who input the record. So, the registered user would be able to see the email in all of the records but a default user could not. I am doing this in hopes of ecouraging visitors to register and submit their own record so they may see the email address of the the other records. Any ideas?
Great script!!

Mike
Quote Reply
Re: hide field only from default In reply to
You can do this, but you will have to create your own html_record and html_record_form. You won't be able to use the autogenerate feature.

Here's a short sub html_record that I'll use for an example:

Code:
print qq|
<table>
<tr><td>Name:</td>
<td>$rec{'Name'}</td></tr>
<tr><td>Email:</td>
<td>$rec{'Email'}</td></tr>
<tr><td>Favorite Color:</td>
<td>$rec{'Color'}</td></tr>
</table>|;

To make the email field only visible to registered users, change the above so that it looks like

Code:
print qq|
<table>
<tr><td>Name:</td>
<td>$rec{'Name'}</td></tr>|;
unless ($db_userid eq "default") {
print qq|

<tr><td>Email:</td>
<td>$rec{'Email'}</td></tr>|;
}
print qq|

<tr><td>Favorite Color:</td>
<td>$rec{'Color'}</td></tr>
</table>|;

Make sense?


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





Quote Reply
Re: hide field only from default In reply to
That makes sense! What a simple solution!

Thanks!
Quote Reply
Re: hide field only from default In reply to
You're welcome. Smile

Took me a while to get the hang of all this, too. Most times things are pretty simple, but it just takes familiarity with the code.


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