Use atkGetUser() outside nodes/modules: Difference between revisions
Appearance
This HowTo describes how you can use getUser() outside a node or a module |
mNo edit summary |
||
| (7 intermediate revisions by 5 users not shown) | |||
| Line 1: | Line 1: | ||
{{howto|Advanced|[[Meinaart van Straalen]] <meinaart@zicht.nl>}} | {{howto|Advanced|[[Meinaart van Straalen]] <meinaart@zicht.nl>}} | ||
This | This Howto describes how you can use atkGetUser() outside a node or a module. I used this, for example, to display some information about the user on the welcome.php page. | ||
< | The call to atksecure() also makes sure that nobody can access the file without logging in first. | ||
<syntaxhighlight lang="php"> | |||
$config_atkroot = "./"; | $config_atkroot = "./"; | ||
include_once("atk.inc"); | include_once("atk.inc"); | ||
// Now you can use | atksession(); | ||
$user = | atksecure(); | ||
// Now you can use atkGetUser() | |||
$user = atkGetUser(); | |||
// If you want to do the same thing as me you will need an instance of the atkDb | // If you want to do the same thing as me you will need an instance of the atkDb | ||
$db = | $db = atkGetDb(); | ||
</ | </syntaxhighlight> | ||
Very short | Very short Howto but very handy if you needed this. Took me some time to figure it out. I hope it helps. | ||
Latest revision as of 13:51, 12 February 2010
|
ATK Howto: Use atkGetUser() outside nodes/modules
|
This Howto describes how you can use atkGetUser() outside a node or a module. I used this, for example, to display some information about the user on the welcome.php page.
The call to atksecure() also makes sure that nobody can access the file without logging in first.
$config_atkroot = "./";
include_once("atk.inc");
atksession();
atksecure();
// Now you can use atkGetUser()
$user = atkGetUser();
// If you want to do the same thing as me you will need an instance of the atkDb
$db = atkGetDb();
Very short Howto but very handy if you needed this. Took me some time to figure it out. I hope it helps.