This topic is locked

Custom Snippet

5/31/2005 8:03:16 PM
PHPRunner General questions
pplaut author

Hi,

I have come to the point, I think, where i am going to have to write some customer code.
No biggie, I just want to make sure I put this in the correct place.
It looks like a field is edit all or not all.
I have certain fields I would like the users to edit on the form

and certain fields only admins can edit, like memberhsip renewal date.
So, I was thinking....
$editfieldlist[array_search("renewal_date",$fieldlist)]="renewal_date";

if(GetFilenameField("renewal_date"))

$filenamelist["renewal_date"]=GetFilenameField("renewal_date");

if(UseRTE("renewal_date"))

$richedit=1;
if I put something like
if groupaccess admin then
$editfieldlist[array_search("renewal_date",$fieldlist)]="renewal_date";

if(GetFilenameField("renewal_date"))

$filenamelist["renewal_date"]=GetFilenameField("renewal_date");

if(UseRTE("renewal_date"))

$richedit=1;

else
The problem I see with this method is if I regenerate the code, it will overwrite my hand coding.
So, I was thinking if I could have an

admin script in the includes directory

which somehow would be called when the edit script was called and basically accomplish the same thing but preserve the integrity of the generated code.
That may be too complicated though
Any advice on this would be appreciated.
Thanks

Peer

pplaut author 5/31/2005

Ok i tried a bunch of different things................

I am missing something here.

I am trying to get the following field to not appear on the form if the user is NOT the admin.
I don't get any errors, the field just still displays on the form.
If ($sUserName="admin"){
$editfieldlist[array_search("member_since",$fieldlist)]="member_since";

if(GetFilenameField("member_since"))

$filenamelist["member_since"]=GetFilenameField("member_since");

if(UseRTE("member_since"))

$richedit=1;

}
Thanks for your help.
Peer

Sergey Kornilov admin 6/3/2005

Peer,
this task is rather complicated.
I recommend you to build two projects: one with full set of editable fields and another - with reduced set. Then you can compare two ..._edit.php files and find out what modifications are needed.

You can make it easily using some file comparing software i.e. WinMerge.