Gossamer Forum
Home : Products : DBMan : Customization :

Send first-timers to "Add" automatically

Quote Reply
Send first-timers to "Add" automatically
Does anyone know the trick to send first-timers, who just created their accounts successfully, to "add" immediately but not the "Main Menu"?

Thx!!

Quote Reply
Re: Send first-timers to "Add" automatically In reply to
Yep.

The easiest way is if you have the $db_key set to the userid field. If so, add this to the beginning of html_home:

Code:
&get_record($db_userid);
unless (%rec) {
&html_add_form;
return;
}

If you don't have the $db_key set to the userid field, let me know and I'll give you the other code.


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





Quote Reply
Re: Send first-timers to "Add" automatically In reply to
My $db_key = 'ID';

I'd be interested in that other code. Thanks!
Quote Reply
Re: Send first-timers to "Add" automatically In reply to
So users can add more than one record?

Okay. This also goes at the beginning of html_home.

Code:
$in{'Userid'} = $db_userid;
my ($status, @hits) = &query("mod");
unless ($status eq 'ok') {
&html_add_form;
return;
}

Be sure to change the Userid to the exact name of your field that holds the user id.


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







[This message has been edited by JPDeni (edited April 22, 1999).]
Quote Reply
Re: Send first-timers to "Add" automatically In reply to
I have $db_key='ID'. Now I have your trick in the html.pl. It works great! Now there should be less confusion for first-timers.
I really appreciate your help!
Quote Reply
Re: Send first-timers to "Add" automatically In reply to
JPDeni,

This mod does work nicely.

Code:
$in{'Userid'} = $db_userid;
my ($status, @hits) = &query("mod");
unless ($status eq 'ok') { &html_add_form; return;}

However after much troubleshooting, I found that it causes errors in my database file. Some side effects are: other count routines don't count very well. And when I try to import the file into access, I can see a thick black line between records. This wierd character is causing the errors.

I've tried used Edit Plus to strip any trailing spaces, I've saved it as Unix format, I've uploaded it numerous times in ascii mode, but the db file is just messed up. I have repeated the experiment by starting with fresh 0 byte db files and it happens when I add a record with this 3 line code.

If the code is #rem'ed out, I have no problems. Is the file being written to improperly, not closed, are these the control ^m's I hear about ? Any ideas ?

BTW, if I rem out this line:
$in{'Userid'} = $db_userid;

The file corruption stops, but then the code doesn't do it's job, because it takes everyone to &html_add_form.

Any ideas ?
Quote Reply
Re: Send first-timers to "Add" automatically In reply to
Hmmmm. Well, if that line is causing problems, maybe if you undefine the variable afterwards it'll fix things.

Code:
$in{'Userid'} = $db_userid;
my ($status, @hits) = &query("mod");
undef %in;
unless ($status eq 'ok') { &html_add_form; return;}

I've never had any trouble with the code, so I'm not sure what's going on, but from what you said it seems that the $in{'Userid'} is the problem.

BTW, I really appreciate your doing some debugging to find out what's happening and being so descriptive. It really helps me help you.


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





Quote Reply
Re: Send first-timers to "Add" automatically In reply to
Yep the
undef %in;
fixed it! Thanks a million again !
Quote Reply
Re: Send first-timers to "Add" automatically In reply to
This mod works fine except for logging on as an admin. Then I automatically go to add every time. Any way to get to the main menu if you are an admin but go to add if you are a first time logon?
Quote Reply
Re: Send first-timers to "Add" automatically In reply to
Stick the whole thing in an "unless" statement.

Code:
unless ($per_admin) {
$in{'Userid'} = $db_userid;
my ($status, @hits) = &query("mod");
undef %in;
unless ($status eq 'ok') {
&html_add_form;
return;
}
}


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