Jump to content

Use atkGetUser() outside nodes/modules: Difference between revisions

From NusaATK
Despam
changed getUser into atkGetUser, todo: create a new page for this with a diffrent title
Line 1: Line 1:
{{howto|Advanced|[[Meinaart van Straalen]] <meinaart@zicht.nl>}}
{{howto|Advanced|[[Meinaart van Straalen]] <meinaart@zicht.nl>}}


This Howto describes how you can use getUser() outside a node or a module. I used this, for example, to display some information about the user on the welcome.php page.
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.
The call to atksecure() also makes sure that nobody can access the file without logging in first.
Line 12: Line 12:
atksecure();
atksecure();


// Now you can use getUser()
// Now you can use atkGetUser()
$user = getUser();
$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

Revision as of 22:51, 12 December 2007

ATK Howto: Use atkGetUser() outside nodes/modules

Complexity: Advanced
Author: Meinaart van Straalen <meinaart@zicht.nl>

List of other Howto's

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.