4images Forum & Community

4images Issues / Ausgaben => Discussion & Troubleshooting => Topic started by: Yan on December 20, 2009, 12:59:24 PM

Title: How i get a current user ID ?
Post by: Yan on December 20, 2009, 12:59:24 PM
I need to get current user ID, and paste it to template like member.php?id=$current_user_id
Title: Re: How i get a current user ID ?
Post by: V@no on December 20, 2009, 06:36:42 PM
Since I don't know what you are trying to do, and because no links should be constructed in template itself, without first parsed through $site_sess->url() function, I'd suggest use this in the template:
Code: [Select]
<a href="<?php
global $site_sess$user_info$user_table_fields;
echo 
$site_sess->url(ROOT_PATH."member.php?".URL_USER_ID."=".$user_info[$user_table_fields['user_id']];
?>
">link text</a>
Title: Re: How i get a current user ID ?
Post by: Yan on December 20, 2009, 09:34:46 PM
Thanks, its works  :D

One more questions. I need a show some content only for admin
Something like this:

<if current user =admin>
content
</if>
Title: Re: How i get a current user ID ?
Post by: V@no on December 20, 2009, 09:54:38 PM
{if is_admin}   {endif is_admin}