Active
Project:
Node Profile
Version:
5.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
4 Nov 2007 at 20:39 UTC
Updated:
27 Nov 2007 at 03:34 UTC
I've been looking into getting user pictures to link to nodeprofile rather than core profile page.
I found this code for pointing the picture to a person's usernode but wasn't sure how to modify it to direct it to nodeprofile:
/**
* Catch the theme_user_picture function and link to the usernode instead of linking to the userpage
*/
function phptemplate_user_picture(&$account) {
if (variable_get('user_pictures', 0)) {
if ($account->picture && file_exists($account->picture)) {
$picture = file_create_url($account->picture);
}
else if (variable_get('user_picture_default', '')) {
$picture = variable_get('user_picture_default', '');
}
if (isset(
$picture)) {
$alt = t('%user\'s picture', array('%user' => $account->name ? $account->name : variable_get('anonymous', 'Anonymous')));
$picture = theme('image', $picture, $alt, $alt, '', false);
if (!empty($account->uid) && user_access('access content') && module_exist('usernode')) {
$nid = usernode_get_node_id($account);
$picture = l($picture, "node/$nid", array('title' => t('View user details.')), NULL, NULL, FALSE, TRUE);
}
return
"<div class=\"picture\">$picture</div>";
}
}
}
?>
I was thinking I could change this part
if (!empty($account->uid) && user_access('access content') && module_exist('usernode')) {
$nid = usernode_get_node_id($account);
to this
if (!empty($account->uid) && user_access('access content')) {
$nid = profile_get_node_id($account);
profile is the name of the nodeprofile content type.
thanks for your help.
Comments
Comment #1
lias commentedOr should it be:
Or is this code not doable for nodeprofile?
edit:
Nope, this code doesn't work, I got a undefined function for profile_get_node_id($account)
: (