Hi Dan,
Do you have to have a separate table, or can you make the PlumUser and Student tables synonymous, and just extend the
PlumUser table to handle your extra requirements? Then you always know the user that logged in is the student. You can
still deal with several other forms, by having those extra fields accept nulls during registration and then fill them
out later with your other forms. Smoke and mirrors ;)
Another option is to create a session user or student structure at login and store the userid to the
session.student.studentid, for instance. I have done this by modifying the security.cfc to initialize the session
structure (user in this case) if the userQuery returns a row (valid user). I use this structure to store all kinds of
info, like how many rows they want to display in a list, as opposed to having it hardcoded.
See the code at about line 56.
<cfif userQuery.RecordCount NEQ 1>
<cfif Application.persistentScope EQ "Session">
<cfset Session.email = Arguments.Email>
<cfset Session.password = Arguments.Password>
<cfelse>
<cfset Client.email = Arguments.Email>
<cfset Client.password = Arguments.Password>
</cfif>
<cfif Application.allowUsersToCreateTheirOwnProfiles>
<cfthrow type="Authenticate.UserNotFound"
message="You are not in our system."
errorcode="66010">
<cfelse>
<cfthrow type="Authenticate.UserNotAllowedToCreateProfile"
message="That email address is not in our system. Please try
a different address."
errorcode="66020">
</cfif>
<cfelse>
<!--- JAF: 10/17/04; add session variables to track user --->
<cfset Session.user = StructNew()>
<cfscript>
Session.user.userID = userQuery.UserID;
Session.user.accessLevel = userQuery.AccessLevel;
Session.user.lastLogin = userQuery.LastLogin;
Session.user.timesLoggedIn = userQuery.TimesLoggedIn +1;
Session.user.rowsPerPage = userQuery.RowsPerPage;
Session.user.displayIcons = userQuery.DisplayIcons;
</cfscript>
<!--- JAF: 10/17/04; update login statistics --->
<cfinvoke
component="#Application.Security#"
method="UpdateUserStats"
userID=#userQuery.userid#
timesloggedin = #Session.user.timesLoggedIn#>
</cfif>
HTH,
Jeff
Nall Daniel A GS-09 336 TRSS/TSUD wrote:
My site has several forms for users to fill out. The main table
(Students) has studentID as its primary key and UserID (PlumUser table)
as its foreign key. How do I ensure that the Students form gets the
correct UserID inserted and the following forms (which have studentID as
their foreign keys) get the correct studentID inserted? Users
(students) must be logged in to fill out these forms.
Respectfully,
Dan Nall
**********************************************************************
You can subscribe to and unsubscribe from lists, and you can change
your subscriptions between normal and digest modes here:
http://www.productivityenhancement.com/support/DiscussionListsForm.cfm
**********************************************************************