ajmartin
Posts: 11
|
| Posted: 12/07/2004, 5:33 PM |
|
I am sure this is easy, I am still getting to grips with the layout of CodeCharge.
I have a form that is accessible only after an admin has logged in.
On that form, I have a hidden field that I want to assign the logged in users name too.
What is the easiest way to do this.
Regards
Adam
|
 |
 |
ajmartin
Posts: 11
|
| Posted: 12/07/2004, 6:05 PM |
|
well... I am halfway there...
using CCGetUserLogin()
however, I want too display a friendly name rather than the login name. I see that CCGetUserLogin() calls CCGetSession which looks up session_vars....
so now I just need too see where the $HTTP_session_vars are set and set my own...
all easy (hopefully).
Loving this program.
lets a programmer get down to work/\
adam
|
 |
 |
peterr
Posts: 5971
|
| Posted: 12/07/2004, 6:14 PM |
|
You're almost there. The name is not stored in session variables, so you will probably need to use the CCDLookUp function together with the CCGetUserID() function, which retrieves the user's ID.
Take a look at sample CCDLookUp usage at http://docs.codecharge.com/studio/html/ProgrammingTechn...gleDBValue.html http://docs.codecharge.com/studio/html/QuickStart/Creat...SendEmails.html http://docs.codecharge.com/studio/html/Components/Funct.../CCDLookUp.html
Probably something like this would work (simplified version):
CCDLookUp("user_name", "users", "user_id=". CCGetUserID(), $DBConnectionName)
I'm only not sure if this will work in the "Default Value" property of your field. You may need to create a Before Show event that will provide global access to the database connection (global $DBConnectionName) and then execute the above code.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
ajmartin
Posts: 11
|
| Posted: 12/07/2004, 6:51 PM |
|
Thanks,
I easily did this by setting a new $HTTP_Session variable at the same time as the login variables are set.... may as well utilise the connection.
I then copied CCGetUserLogin() function and created CCGetUserName()
very very easy.
works a charm\\Adam
|
 |
 |
|