Gossamer Forum
Home : Products : DBMan SQL : Discussion :

Adding member record after signup

Quote Reply
Adding member record after signup
Please see the introduction to this thread.

The directory already contains details of 1000+ companies. These will be given a user name and password. When they log in they should see a "modify company details" link. They should not see an "add company" link (1 company record per member, and the primary key is also the userid field).

When a new member signs up and logs in for the first time, they need to see a "add your company details" link, but not a "modify company details" link.

So when a member logs in, we need to know whether a record exists in the company table and display the appropriate link. So we need to run a query like

select comp_id from Company.

If the query returns a row, we display the modify link. If the query returns no rows, we display the add link.

Doesn't sound too bad. Can anyone explain how we do this in dbman sql 2 please?

When administrator logs in he should of course see all links.

many thanks
Tim Ault
Oxford UK
Quote Reply
Re: [timbo] Adding member record after signup In reply to
Hello.

To do this, have an important field (for example email, which you know they will fill out when they add their details) empty. Then, in your templates, add an if statement

<%unless admin_p%>

<%if companyemail%><a href=db.cgi?db=<%db%>&do=modify_form>Modify Company Details</a><%else%>

<a href=db.cgi?db=<%db%>&do=modify_form>Add your company's details</a><%endif%> <%endif%>

<%if admin_p%><a href=db.cgi?db=<%db%>&do=add_form>Add new company</a> | <a href=modifylink.html>Modify this company's details</a>

<%endif%>

Now, this will check if your field has data for those that are not admin, and will either display the add or modify options, while to an admin, both options will be seen. (Note: if youre using the same modify form for both add details and modify details, you dont have to worry about the admin thing... it will be the same. However, this way, you can have the admin able to add a new company and have another template called "new" for example, where you modify the "modify_form.html" file found in your default template set (copy and paste the whole template set, rename the new set as "new", then modify "modify_form.html" on the "new" template set. Once this is set up, you could have newcomers (those that havent added their details) shown a "Welcome to my site! Please add your company details" add details form, while those returning (just modifying) would be shown a "thank you for updating your information" page. This can be done by adding "&t=new" to the "db.cgi?db=<%db%>&do=modify_form&t=new> on the add details link.

Hope this answers your question. Thats the way I would do it.