If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.
If you have a global variable containing the current username i.e. [glob_username] then you can go to to edit fields, go to the CreatedByField and set the default [glob_user] to the insert value. Check the forced value field.
Most of us here are fellow SC users. SC is pretty cool to use. The global vars are very easy.
Essentially anything with brackets around it is a global var - you can use them in your PHP code in the events of any app.
[glo_dog] = "this get stored in the global variable as a string";
[glo_cat] = 1.257;
When you make a global var you can call it anything you want, but I usually make it have glo_ or something easy for me to spot months later when debugging.
Another concept in SC is that globals can be coming in or going out of an app. If you look under application, global variables - you will see every global you have used in your event code. It goes in there automatically, as soon as you save code in any event. However, you usually have to specify which direction it is coming. I usually check SESSION and OUT, if I created the global in teh current app and will be using it in another app, like passing the second app a value it will need to process something. If the global is only being used in an app, as if it is coming from outside the app, check IN.
You can do other things with globals, like using them in the settings of an app. Like putting a [glo_this_title] into the layout's title setting, then use an event like OnScriptInit or something to set the value based on your PHP code. You have to look at which events get triggered when (sometimes a tricky thing), but it works great. Globals are also involved in GET and PUT type parameter passing too - but you will have to look that up in the help and this forum.
Good luck my friend,
PS There is also a viewer built into SC that lets you see the global variables in the session while you are developing things. If you have used SC to create your security apps, they already set some things for you that you can reuse in other apps... explore around the login app events and see what is there.