Gossamer Forum
Home : Products : DBMan : Customization :

Re: [booboo] ADMIN add new record for registered user

Quote Reply
Re: [booboo] ADMIN add new record for registered user In reply to
This is referenced in the FAQ under a few different thread, but here is the solution:

Add userid automatically when adding records:

In sub get_defaults replace:

foreach $field (keys %db_defaults) {
$default{$field} = $db_defaults{$field};
}

with:

foreach $field (keys %db_defaults) {
$default{$field} = $db_defaults{$field};
####### add userid in add form ###########
unless ($per_admin) { ($auth_user_field >=0) and ($db_defaults{$db_cols[$auth_user_field]} = $db_userid); }
}


In sub add_record instead of:

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

use:

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

This will allow you as admin to manually enter the userid so the record owner can then modify his/her record.

Hope this helps

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Subject Author Views Date
Thread ADMIN add new record for registered user booboo 1487 Jul 21, 2002, 11:20 PM
Post Re: [booboo] ADMIN add new record for registered user
joematt 1438 Jul 22, 2002, 9:34 AM
Post Re: [booboo] ADMIN add new record for registered user
LoisC 1447 Jul 22, 2002, 12:26 PM