Andrew Aubury
Andrew Aubury

Reputation: 113

How do I get the current user details for a phpFox website?

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?

Upvotes: 0

Views: 474

Answers (2)

Trung Ngon
Trung Ngon

Reputation: 51

On module, you can use:

$iUserId = Phpfox::getUserId();

On App, you can use:

$iUserId = user()->id;

Upvotes: 1

Ankit Agrawal
Ankit Agrawal

Reputation: 6124

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

$iUserId = Phpfox::getUserId();

Upvotes: 2

Related Questions