Question : how to define UserID in scope URL, so that I can show a logged-in user his or her user profile to edit or review

My next problem is, I hope, a little simpler than the past few have been.

In brief: I need to define UserID in scope URL, so that I can show a logged-in user his or her own user profile to edit or review

Details:
If a user with UserID=124 logs in, then this user is able to view a page (manageUser.cfm) that lists her user profile -- only her user profile, belonging to UserID 124. I use this query to make that happen, on page manageUser.cfm:

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
  <!--- this query is on page manageUser.cfm --->
  <!--- in this query, select columns from table tbl_NBPTS_Principals --->
  <!--- we want columns for only the logged-in UserID --->
  <cfquery datasource="#ds#" name="GetUserList">
  SELECT UserID
  	 , FirstName
     , LastName
     , UserEmail
     , UserRoleID
     , SSMA_TimeStamp
     , DateRecordModified
     , NameofSchool
     , NameofDistrict
  FROM tbl_NBPTS_Principals
  WHERE UserID = <cfqueryparam cfsqltype="cf_sql_integer" value="#val(session.auth.UserID)#">
  </cfquery>

 
That calls up the correct data on page manageUser.cfm. Next, I need to show the user an edit page:

<a href="/principal/principal_registration.cfm?UserID=#URL.UserID#">Edit Your Profile</a>   <----------- this is a link on page manageUser.cfm

where she can view and edit her profile.

The problem is, UserID is not defined in scope URL. So the above link will not work. Currently, UserID is defined only in session.auth.

Is there a way to derive URL.UserID from session.auth.UserID?

I have tried variations like:  
  <a href="/principal/principal_registration.cfm?UserID=#GetUserList.UserID#">Edit Your Profile</a>
  <a href="/principal/principal_registration.cfm?UserID=#session.auth.UserID#">Edit Your Profile</a>

but these links bring me to a blank registration page.
 
When I link to page manageUser.cfm, do I need to define a UserID in scope URL?

I attach manageUser.cfm, below. How can I get an edit page to appear for a logged in UserID?

Thank you again for any advice. I realize I have been asking many questions in this forum of late.

Eric
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
<!-----
Name:        manageUser.cfm
Author:      Eric B, following Ben Forta code in ColdFusion 8 web application construction kit; gdemaria; _agx_
Description: NBPTS add and update users administration
Created:     June - July 2010
ColdFusion Version 8
MS SQL Server 2005
----->


 <!--- Set the datasource --->
 <cfset ds="ebwebwork">

 
  <!--- in this query, select columns from table tbl_NBPTS_Principals --->
  <!--- we want columns for only the logged-in UserID --->

  <cfquery datasource="#ds#" name="GetUserList">
  SELECT UserID
  	 , FirstName
     , LastName
     , UserEmail
     , UserRoleID
     , SSMA_TimeStamp
     , DateRecordModified
     , NameofSchool
     , NameofDistrict
  FROM tbl_NBPTS_Principals
  WHERE UserID = <cfqueryparam cfsqltype="cf_sql_integer" value="#val(session.auth.UserID)#">
  </cfquery>


  <!--- page header HTML / CSS --->
<cfinclude template="/SiteHeader.cfm" />



<!-- begin row1 -->
<div id="row1">

<!-- begin row1content_left -->
<div class="row1content_left">

<img src="/img/row1_photo1.jpg" width="582" height="157" alt="NBPTS" class="border0" />


</div>
<!-- /row1content_left -->


<!-- begin row1content_right -->
<div class="row1content_right">

<cfinclude template="/login_menu_template.cfm">

</div>
<!-- /row1content_right -->


<!-- end row1 -->
</div>


<!-- begin row2 -->
<div id="row2">

<h1>NBPTS Principals Interface</h1>

<h2>Principals: Manage Your Profile</h2>


<p><img src="/img/bronzestar.gif" alt="Bronze Star" style="margin:0 4px 0 0;" width="14" height="13" /><a href="/principal/principal_registration.cfm?UserID=#session.auth.UserID#"><strong>Edit Your Profile</strong></a></p>

  
   
<table class="tablecontrolpanel">

<tr style="background-color:#ebebeb;"><td><strong>User ID</strong></td>

<td class="left"><strong>First Name</strong></td>

<td class="left"><strong>Last Name</strong></td>


<td class="left"><strong>Email</strong></td>


<td class="left"><strong>School</strong></td>

<td class="left"><strong>School District</strong></td>



<td><strong>Date Modified</strong></td>
 
</tr>


 <!--- list Users --->
 <cfoutput query="GetUserList" group="UserID">

  <tr>

  
   <!--- User ID --->
   <td>#getUserList.UserID#</td>
 
  
   <!--- User First name --->
   <td class="left">#getUserList.FirstName#</td>
  
  <!--- User Last name --->
   <td class="left">#getUserList.LastName#</td>
   
     <!--- UserEmail --->
   <td class="left">#getUserList.UserEmail#</td>
  
  
       <!--- NameofSchool --->
   <td class="left">#getUserList.NameofSchool#</td>
  
    <!--- NameofDistrict --->
   <td class="left">#getUserList.NameofDistrict#</td>
  
   
          <td>
  #DateFormat(GetUserList.DateRecordModified, "mmmm d, yyyy")#
   </td>
   
   


  </tr>
 </cfoutput>
</table>

		  
	

<!-- end row2 -->
</div>
  <!--- page footer HTML / CSS --->
  <cfinclude template="/SiteFooter.cfm" />

Answer : how to define UserID in scope URL, so that I can show a logged-in user his or her user profile to edit or review

are you 200% sure you moved the table with the identity property set on the column(s) as needed?
that is the only reason I can think of of the scope_identity returning null after the insert
please double-check
Random Solutions  
 
programming4us programming4us