...and avatars are enabled, then I have a path to user picture displayed. Here is what I see:

<div class="node">
  files/pictures/picture-1.gif      <h1 class="title"><a href="/index.php?q=node/2">This is a test</a></h1>
      <span class="submitted"></span>
    <span class="taxonomy"></span>
    <div class="content"><p>Such a beatiful test!</p>
</div>

Do anybody have the same problem?

CommentFileSizeAuthor
#4 phptemplate.engine_4.patch961 bytesSteve Simms

Comments

agentrickard’s picture

Component: node system » theme system

Yes. Clean install of 4.7 beta 3 using Bluemarine theme under MySQL 5.1.2.

Let me restate / clarify the issue.

Under THEME > SETTINGS

If "Display post information" is OFF

and

"User pictures in posts" is OFF or ON

Then the string is inserted incorrectly as "files/pictures/picture-1.gif " instead as an IMG tag.

Problem also occurs with Pushbutton theme (the other PHPTemplate theme), but not with Chameleon or Marvin, so I am refiling this under the theme system, as I suspect this is a PHPTemplate bug.

agentrickard’s picture

OK. Drupal experts, help me out. I know why this problem is occuring, but I'm not sure where to apply the fix.

At the THEME level, the code simply says:

    <?php if ($picture) {
      print $picture;
    }?>

The $picture variable is set in user.module, based on whether or not the user has loaded a profile photo. When presenting the variable in the context of a node view rather than a profile view, the $picture needs to check the Theme settings for the site variable "toggle_node_user_picture".

Where should this check occur? I can think of three locations:

- In node.module
- In user.module
- In node.tpl.php for a theme
- In node.tpl.php for a theme engine.

What's best practice here?

agentrickard’s picture

ok, four locations.

Steve Simms’s picture

Status: Active » Needs review
StatusFileSize
new961 bytes

Another way of solving this would be in phptemplate.engine. Here's what's happening:

  1. "picture" is an element of the node array as soon as it's loaded (see node.module line 369 and 372).
  2. In phptemplate.engine, all of the elements of the node object/array are merged with the variables that can be used in the .tpl.php files (see phptemplate.engine line 247)
  3. The very next command is to set $variables['submitted'] and either set $variables['picture'] to be theme('user_picture', $node) or clear it, but only if theme_get_setting('toggle_node_info_' . $node->type) is true.

Therefore, if the "Display node information on [node type]" box from admin/themes/settings is unchecked, $variables['pictures'] doesn't get cleared.

I solved the problem on my installation by adding $variables['picture'] = ''; between steps #2 and #3 above (see patch), but I'm not sure that it's the neatest way of fixing it.

Egon Bianchet’s picture

Version: 4.7.0-beta3 » 4.7.0

In 4.7.0 there's no path shown, but no picture either.

drumm’s picture

Status: Needs review » Needs work

Lets always set the picture variable in phptemple.engine (take it out of that if statement) and then in each PHPtemplate theme in core re-add the logic to not show the picure if we aren't showing the post information.

Then the core themes behave the same, and we always have the picture availiable in case it is needed for a non-core theme.

beginner’s picture

Version: 4.7.0 » 4.7.2
Status: Needs work » Fixed

I cannot reproduce with 4.7.2 with either bluemarine or pushbutton.
The picture shows where it should, and doesn't where it shouldn't.
Reopen if you can tell me how to reproduce.

Anonymous’s picture

Status: Fixed » Closed (fixed)