My Profile link seems off

Status: 
Open
Question: 

I wanted to do the text link as demonstrated in 4.4.2 (pg50) of the Drupal Fun book. I put the following PHP into a block:

<?php
global $user;
$myuid = $user->uid;
$node = content_profile_load(profile, $myuid);
//profile above = the name of our content type
$profileid = $node->nid;
print l('My profile','node/'.$profileid);
//l() is a function provided by Drupal that creates a link.
//l(link display text, path after main path)
?>

What I expect to happen is if I am on "Chris's" account page, I'd expect that block to take me to Chris's profile. Unfortunately, what the link points to instead is my own profile (or whatever user I'm logged in as at that time). Did I screw something up in the php or are my expectations off?

Responses

1. The link is actually working

The link is actually working like it should. It is a link to go to your own profile.

If you want to put this block on the user page. You will have to modify it something like this:

?php
$otheruid = arg(1);
$node = content_profile_load(profile, $otheruid);
$profileid = $node->nid;
print l('My profile','node/'.$profileid);
?>

I did not check this, might be arg(2) not sure.