Posted on: 02/11/10 04:40am
By: Anonymous (cesar)
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.
Re: How to know the uid of a user for use in personal blocks
Posted on: 02/11/10 04:53am
By: Dirk
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
Re: How to know the uid of a user for use in personal blocks
Posted on: 02/11/10 07:09am
By: Anonymous (cesar)
Thanks Dirk.
All is ok.