By default, $content_profile
variable is NULL
in user-picture.tpl.php
file, while you don't explicitly load its contents with content_profile_load() function or make this variable available in this template too. (Citing from the official readme about the places where this variable is available: "The $content_profile variable is available in the page, node, comment, user_name, user_profile, user_signature, search_result and some other templates.")
I think it's a better solution to create your own user-profile.tpl.php
(you should copy it from /modules/user
directory to your own theme's templates
directory, and delete theme registry cache after that), where the $content_profile
variable is already set, and print the customized user profile picture in this one.
When you use the Content Profile module's get_variable()
function, you usually get an array
or NULL
(if the variable doesn't exist).
If it's an image field (and you query its content with e.g. $content_profile->get_variable('profile', 'field_photo');
), the content of the variable looks something like this:
array (
0 =>
array (
'filename' => 'default_avatar1.gif',
'filepath' => 'sites/default/files/imagefield_default_images/default_avatar1.gif',
'filemime' => 'image/gif',
'source' => 'default_image_upload',
'destination' => 'sites/default/files/imagefield_default_images/default_avatar1.gif',
'filesize' => 5711,
'uid' => '1',
'status' => 1,
'timestamp' => 1320633662,
'fid' => '54',
'default' => true,
'nid' => '446',
),
)
So in your case, you should rather do something like this (in the appropriate place in user-profile.tpl.php
file):
$user_profile_photo = $content_profile->get_variable('profile', 'field_photo');
print l( theme('imagecache', 'msg_profile_pic', $user_profile_photo[0]['filepath'], 'just a test image', 'test image'), 'user/'.$account->uid, array('html' => true) );
Of course, 'field_photo'
must be a valid CCK field (previously set in Content Profile's fields), and 'msg_profile_pic'
must be a valid ImageCache preset.
Just tested, it works on my site.