In my website, users can connect, see their profiles, update their profiles and visit other users profiles
So for each users, I created a profile page user-profile.tpl.php
But I've some troubles when I'm visiting other users account.
For example in my account profile page, there is a link who's redirecting me to the edit page.
I wrote this code for showing the edit link :
<?php
global $user;
print l(t('Update my profile'), "user/{$GLOBALS['user']->uid}/edit");
?>
When I'm visiting a random user page, this link appears. But I want it to appear only on my profile page
And it's the same for my profile picture, when I'm visiting a random user page, my picture is always showing.
<?php
$user_item = user_load_by_name($user->name); // or user_load( $user->uid )
print theme('user_picture', array('account' =>$user_item));
?>
I have no idea how to fix theses problems, that's why I need your help (I'm new to Drupal btw)
(I'm using Profile2)
Thanks