Gossamer Forum
Home : Products : DBMan : Customization :

adding a new record for a registered user

Quote Reply
adding a new record for a registered user
Greetings!

How can an admin add a record for a registered user? I do not have default permissions. Can anyone help out?

Regards,
FDD

Quote Reply
Re: adding a new record for a registered user In reply to
Add another field called Modify_User or something like that...this will allow you to add users and have them still "own" the record.

More info can be found if you search this forum for Modify User.

Regards,

Eliot Lee
Quote Reply
Re: adding a new record for a registered user In reply to
I do not know what you mean by not having default permissions - as a normal, the admin is set-up to have all permissions.

If you can add and edit (as admin) the entries and the record owner is displayed in an accessible field. You could simply create the record then modify the entry (using your admin login) to change the record owner field.


The only other way I can think of for adding a record and having someone else 'own' the record would be to create the record then download the database and change the user from admin to the registered user in the actual database entry.

You could also try searching this forum and the unofficial faq's site for ideas (linked in the Resources area at the top of this forum.)


Good luck!


Quote Reply
Re: adding a new record for a registered user In reply to
Karen's suggestion is a bit cumbersome...adding another USER field like I suggested will do what you want. All you have to do is have both USER field accessible via the ADMIN form and then edit the main USER field to be the appropriate user who owns the record.

Regards,

Eliot Lee
Quote Reply
Re: adding a new record for a registered user In reply to
Thanks Eliot, Karen!

I have a field called 'username' which serves as a key field. This field is automatically filled up. Does modifying this field work like the one you mentioned Eliot? How can I do this?

Best regards,
FDD

Quote Reply
Re: adding a new record for a registered user In reply to
Yes...BUT if you as ADMIN want to edit the file in the future, it would be better to have an additional field to "track" who modified the record with the MAIN username field reserved for the RECORD OWNER...

Regards,

Eliot Lee
Quote Reply
Re: adding a new record for a registered user In reply to
A simple solution would be 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);
}

This will allow admin to add a record and assign a username or if a user is logged in it will automatically add their userid as the user.

This solution if sound in the FAQ below under the section for "Administration & Setup"

Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/