Gossamer Forum
Home : Products : DBMan : Customization :

Can Admin add records when dbkey=userid?

Quote Reply
Can Admin add records when dbkey=userid?
I have my db set up, so that users can add only one record and so that new signups go directly to the add form. So it works well to have the $dbkey=$userid, but I would like for admin to have unlimited add capablility. Is this possible?
Quote Reply
Re: Can Admin add records when dbkey=userid? In reply to
Yes. You will need to add something unique as the userid for the field, though. And you'll need to make the following change to sub add_record in db.cgi:

Change

Code:
# Set the userid to the logged in user.
($auth_user_field >= 0) and ($in{$db_cols[$auth_user_field]} = $db_userid);

to

Code:
# Set the userid to the logged in user.
unless ($per_admin) {
($auth_user_field >= 0) and ($in{$db_cols[$auth_user_field]} = $db_userid);
}


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





Quote Reply
Re: Can Admin add records when dbkey=userid? In reply to
I'm not quite sure what you mean. Do you mean that I'll need to edit the $db_key field every time I add a record as admin? (Currently, this field is invisible, but I can always change that.)
-Brian
Quote Reply
Re: Can Admin add records when dbkey=userid? In reply to
Yes. You will need to make the field visible, at least to admins. (Make it an admin-only field.) You have to put something in the field.


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