Where In The Code To Get User Id?

I am trying to create something to go on our backend, and when I tried to put my code into a smarty function it didn't work because this didn't work

$company_id = $_smarty_tpl->tpl_vars['auth']->value['user_id'];

in the cache file of this template, this would work, however in the function file of this script, this does not work. What are alternative methods to getting the user ID?

you can get user id in tpl:

{$auth.user_id}

-Himanshu Dangwal

Please use.

Templates:

{$auth.user_id}

or

{$smarty.session.auth.user_id}

PHP files:

$auth['user_id']

or

$_SESSION['auth']['user_id']

Please use.

Templates:

{$auth.user_id}

or

{$smarty.session.auth.user_id}

PHP files:

$auth['user_id']

or

$_SESSION['auth']['user_id']

Perfect, Thank you both for the answer, but I needed the PHP answer so thank you eCom

You are welcome!