cesar

Anonymous
Hi,
I have a problem with the users uid. I use Geeklog 1.6.1. I want to create a block in which users insert some data, but I want to save the uid of the user that inserted the data. I've done everything, but I do not know how to know the UID of the user to save in my database.
I searched the function foo but in my lib.common.php is commented.
Thank you and sorry but my English.

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
The uid of the current user is always available in the gloabl $_USER['uid'] variable - unless it's an anonymous user, then it's not set. So you could do something like:
Text Formatted Code
if (COM_isAnonUser()) {
    $uid = 1;
} else {
    $uid = $_USER['uid'];
}

And don't forget the global $_USER; declaration.

bye, Dirk

cesar

Anonymous
Thanks Dirk.
All is ok.