Gossamer Forum
Home : Products : DBMan : Customization :

Admin changable field but only viewable to user

Quote Reply
Admin changable field but only viewable to user
is this possible??

I have this code and am wondering how i make it viewable to users, and they CANT modify it

print qq||;
if ($rec{'Membership Status'}) {
print qq||;
if ($per_admin) {
print qq|
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>Membership Status:</FONT></TD>
<TD WIDTH="80%"> <$font>$rec{'Membership Status'}</Font></TD></TR>
|;




Quote Reply
Re: Admin changable field but only viewable to user In reply to
 
In your html_record_form try changing:

if ($per_admin) {
to:
if (($per_admin) or (!$in{'modify'})) {



Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/
Quote Reply
Re: Admin changable field but only viewable to user In reply to
Don't change the form.

Change the code you posted above to

Code:

if ($rec{'Membership Status'}) {
print qq|
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>Membership Status:</FONT></TD>
<TD WIDTH="80%"> <$font>$rec{'Membership Status'}</Font></TD></TR>
|;
}
(I added a { to the end. You probably just didn't copy it from your file.)

JPD
http://www.jpdeni.com/dbman/
Quote Reply
Re: Admin changable field but only viewable to user In reply to
I worked it out
This is just a post to let others know if they wish to do so

In the html.pl file if you have an admin editable field and you wish to have it shown to users do the following.

Original code:

if ($rec{'Membership Status'}) {
print qq||;
if ($per_admin) {
print qq|
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>Membership Status:</FONT></TD>
<TD WIDTH="80%"> <$font>$rec{'Membership Status'}</Font></TD></TR>
|;
}

change to

if ($rec{'Membership Status'}) {
print qq||;
if ($per_admin or $per_view) {
print qq|
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>Membership Status:</FONT></TD>
<TD WIDTH="80%"> <$font>$rec{'Membership Status'}</Font></TD></TR>
|;
}

This will enable the users to see the field but not edit the field.