I want only to show one picture on the profile pages, but to display user pictures on nodes in general.

If I view a node profile as a seperate page, the picture should be displayed. When it's integrated into the profile or usernode, additional pictures shouldn't be displayed because one is already displayed by the profile or usernode.

Comments

schnizZzla’s picture

By additional I mean the duplicates.

fago’s picture

sry, I'm not used with core user pictures.
Which part of the template adds it to the node? (http://api.drupal.org/api/5/function/theme_node)

fago’s picture

Status: Active » Fixed
schnizZzla’s picture

no problem, it's solved, for anyone who is interested, i shouted this on g.d.o

schnizZzla’s picture

Title: Removing pictures from profiles » Removing pictures from profiles (phpTemplate)
Component: Documentation » Code
Category: support » bug
Priority: Normal » Minor
Status: Fixed » Postponed (maintainer needs more info)

I'm re-opening this, because of my detectives work. Someone should read this. I found a solution without changing the template files. But I believe this doesn't work without a patch to the nodeprofile.module. At least in my case, it seems a bug.

I don't want to add more code to the templates. So instead I used the override _phptemplate_variables in template.php like this:

function _phptemplate_variables($hook, $vars = array()) { 
{
  if (!$vars['page'])
  {
    $vars['picture'] = "";
  }
  return $vars;
}

But whenever I viewed the node whether it was integrated in the profile or alone. Every time the page variable was set to true.
I saw that in nodeprofile.module the following call is used in both functions theme_nodeprofile_display_full and theme_nodeprofile_display_teaser:

      return theme('nodeprofile_display_box', $element, node_view($node, FALSE, TRUE, FALSE));

After switching the third argument for node_view to false, which is the page value, it finally worked:

      return theme('nodeprofile_display_box', $element, node_view($node, FALSE, FALSE, FALSE));

To remove avatars from the profile, but leave them on node profile nodes, when displaying as a page NOT integrated, with this setting, I do NOT need:

  • creating a node-X.tpl.php with additional code
  • adding code to node.tpl.php

I hope that change can be reviewed. If I get this right the nodeprofiles theming functions where called, when the nodes are integrated into the profile.


sry, I'm not used with core user pictures.
Which part of the template adds it to the node? (http://api.drupal.org/api/5/function/theme_node)

You can see what the problem is, in this code in phpTemplate.engine:

$variables['picture'] = theme_get_setting('toggle_node_user_picture') ? theme('user_picture', $node)

It calls the user.modules theme_user_picture function where the check if $account->picture is true happens.
At the end a themed $picture is passed as a template variable. I don't see any other variable for that. Maybe some ninjas can help...

schnizZzla’s picture

Title: Removing pictures from profiles (phpTemplate) » Wrong Argument FALSE for $page on node_view ?
Status: Postponed (maintainer needs more info) » Active

When true is passed everything seems fine...

fago’s picture

Status: Active » Closed (won't fix)

hm, yeah. I've done that, because so the user page looks nicer if one uses default settings.
$page = FALSE will print a quite big node title link - which doesn't suit there much as there are already user categories titles. So I think it's better to leave it as it is, however if you want to change the parameters just create an template for your used function (teaser / full node view) and adapt the parameters.

schnizZzla’s picture

"So I think it's better to leave it as it is, however if you want to change the parameters just create an template for your used function (teaser / full node view) and adapt the parameters."

Thanks for the explanation.

Yeah, you're right, overriding is also possible. On the other hand, by default there are already too much h2 titles in the profile.

At least I have gained more "esoteric knowledge" of the Theme System now...