Welcome to Geeklog, Anonymous Wednesday, December 25 2024 @ 08:47 pm EST

Geeklog Forums

How to know the uid of a user for use in personal blocks


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.
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
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
 Quote

cesar

Anonymous
Thanks Dirk.
All is ok.
 Quote

All times are EST. The time is now 08:47 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content