Gossamer Forum
Home : Products : DBMan : Customization :

Making New Users Add a Record?

Quote Reply
Making New Users Add a Record?
Still haven't sorted this one out!

Can anyone tell me how to take the user straight to the 'Add Record' page when they first log in. I want them to have to input their details for a member database (the only database I have at the moment) before they see anything else.

Maybe a check to see if the user owns a record and if they don't then they must add one, else they go to the main page.

I have the secure password mod installed.

Many thanks,

Marcus.
Quote Reply
Re: Making New Users Add a Record? In reply to
Have you seen the other recent posts on this topic and tried them? I'm just wondering if I should repost the information or if you had problems with what I had posted before.


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





Quote Reply
Re: Making New Users Add a Record? In reply to
JPDeni,

I tried the stuff Eliot suggested after my first post, but it didn't work unfortunately. Haven't seen any other posts on the topic - could you point me to them please?

Many thanks,

Marcus
Quote Reply
Re: Making New Users Add a Record? In reply to
If you are using the userid field as the key (meaning that each user has only one record in the database), you can add the following to sub html_home:

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

If users might have more than one record, use the following instead:

Code:
$in{$db_cols[$auth_user_field]} = $db_userid;
my ($status,@hits) = &query('view');
unless ($status eq "ok") {
&html_add_form;
return;
}

Either way, put this code at the beginning of sub html_home, just after the comment lines, but before &html_print_headers.

You can use the second bit of code even if you do use the userid field for the key field, but it might be a little slower, especially if you have a lot of records.


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





Quote Reply
Re: Making New Users Add a Record? In reply to
Thanks, this works. I used the second bit of code.

It has caused another problem though. My database is just personal details of the users and the email field is not editable in the modify/add form - it's just displayed and there's a link to the change email form of your mod. Now, before when users went to the home page and then to the add record form, the email address appeared. Now, by jumping straight to the add form, it isn't there and you can't fill it in and it won't accept the record without it.

Any ideas?

Thanks for your help.

Marcus.
Quote Reply
Re: Making New Users Add a Record? In reply to
Mmm. Re-reading my last post, I'm not sure it made sense. Let me know if you didn't get what I was babbling on about.
Quote Reply
Re: Making New Users Add a Record? In reply to
I sorta understand what you're saying, but I don't know what would be causing it without looking at the code.


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





Quote Reply
Re: Making New Users Add a Record? In reply to
JP,

If you have time (and inclination) the code can be viewed at:

http://www.comp.lancs.ac.uk/normate/html.txt
http://www.comp.lancs.ac.uk/normate/defaultcfg.txt

Let me see if I can explain the problem more clearly. Because I used the secure password mod which has a change password function, I made the email field in the record not editable. But as this is a required field, a record cannot be submitted without it. The code which takes us straight to the add page causes the email to be left blank for some reason, which is the problem.

If I make the email field not required, I'm allowed to submit the record, but the email never appears unless I do a 'change email'.

Thanks,

Marcus.

[This message has been edited by Marcus Duffy (edited October 18, 1999).]
Quote Reply
Re: Making New Users Add a Record? In reply to
Someone else had the same question yesterday and I figured it out.

At the very beginning of sub html_add_form, add

Code:
$in{'add_form'} = 1;

That should do it. Please let me know.


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





Quote Reply
Re: Making New Users Add a Record? In reply to
JPD,

Looks like that has done the trick! You truly are the expert at this stuff aren't you?

Thank you *VERY* much, you star.

Marcus.
Quote Reply
Re: Making New Users Add a Record? In reply to
It's just experience. But thank you for the compliment! Smile


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