0

I am creating a webcam system to go on my phpFox site and am attempting to get the current user's ID. I've tried the following, but to no avail.

ob_start();
session_start();

function get_user_id() {
    $userid = null;
    $id = Phpfox::getUserBy('user_id');
    if (!empty($id)) {
        $userid = $id;
    }
    return $userid;
}

$idd = get_user_id();

echo("User ID: " . $idd);

How would I get the user ID of the current user?

Chris Forrence
  • 10,042
  • 11
  • 48
  • 64
Andrew Aubury
  • 113
  • 12

2 Answers2

2

In phpFox, you can get the current user ID with the following function:

$iUserId = Phpfox::getUserId();
Chris Forrence
  • 10,042
  • 11
  • 48
  • 64
Ankit Agrawal
  • 6,034
  • 6
  • 25
  • 49
1

On module, you can use:

$iUserId = Phpfox::getUserId();

On App, you can use:

$iUserId = user()->id;
Trung Ngon
  • 51
  • 1