็Symptoms:
- $picture and $submitted variables in node template of a forum are not set.

Cause:
- $node->type in phptemplate_node(phptemplate.engine) and $type in theme_get_settings(theme.inc) are different.

Fix:
- change 'name' in forum_node_info function from 'forum topic' to 'forum'. (forum.module)

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

webchick’s picture

Status: Needs review » Needs work

Please roll a proper patch. Details at HOWTO: Create patches.

xtony’s picture

Status: Needs work » Needs review
FileSize
362 bytes

This is a follow up patch..

Dries’s picture

I think 'forum topic' is more accurate than 'forum'. The latter is a collection of forum topics. Can't we fix the template system instead?

beginner’s picture

Version: 4.7.2 » x.y.z
Priority: Critical » Normal
Status: Needs review » Needs work

First, this is hardly critical.

Then, what is broken exactly?
Here is an example of a forum node with the user picture:
http://www.reuniting.info/node/386

I recently set this very similar issue as fixed:
http://drupal.org/node/45070

What am I missing?

If something is really broken, cvs should be patched first and the fix backported.

xtony’s picture

Priority: Normal » Critical
Status: Needs work » Needs review
FileSize
1.01 KB

The problem is due to the $op arguement of _node_names function (node.module) is not well defined and there is conflict in 'name' and 'list' operation. In the follow up patch, I added the operation 'base_list' which lists 'base' variable of all nodes instead of 'name'.

In the patch, I use node's 'base' for its 'type' variable instead of 'name'.

beginner’s picture

Priority: Critical » Normal

setting 'critical' only for a missing picture will not get your patch committed faster ;)

Again, how to reproduce the error? I don't see any problems in my sites.

webchick’s picture

Also, if this is an API change, it'll only get into CVS, not 4.7 -- 4.7 is stable and will take no API changes unless they are critical security fixes.

I second beginner's comments. Please provide details (with source code if possible) of how you feel this is a bug, and stop marking issues critical that are not.

Dries’s picture

The problem is due to the $op arguement of _node_names function (node.module) is not well defined and there is conflict in 'name' and 'list' operation.

xtony, can you be more verbose about this? I'd like to understand the problem. Thanks, Tony!.

drumm’s picture

Title: ์Node does not show user picture » Node does not show user picture
Status: Needs review » Needs work

This seems like a fairly deep change for just user pictures. I'm wary of side effects.

Toggling post information is a similar mechanism. Does that work?

xtony’s picture

Status: Needs work » Needs review
FileSize
659 bytes

Sorry, i'm new to drupal development. Please be patient with me :).

I think i found the real problem. It's in phptemplate.engine, line 246:

if (theme_get_setting('toggle_node_info_' . $node->type)) {

the function "theme_get_settings" should be called instead of "theme_get_setting".

I also attached the patch with this post too.

Please review the patch again and sorry for my misunderstanding.

xtony’s picture

FileSize
30.53 KB

This is a picture of the problem. perhaps, this could help reviewer.

Thank you.

drumm’s picture

Status: Needs review » Needs work

theme_get_settings() returns an associative array of settings. I don't think thats what we would want to use as the condition for an if statement.

The documentation for theme_get_setting() makes it seem like the right thing. Maybe the problem is that it seems that the post information ("Submitted by ...") needs to be showing for the picture to show?

xtony’s picture

'theme_get_setting' does nothing to 'toggle_node_info_' variable but 'theme_get_settings' does. I've checked these two functions's code in theme.inc.

xtony’s picture

Ok. I checked the code again. in the 'theme_get_setting' function, the 'toggle_node_info_forum topic' is set. but '$node->type' in "if (theme_get_setting('toggle_node_info_' . $node->type))" is "forum" instead of "forum topic".

The souce of problem is the function which calls "phptemplate_node" in phptemplate.engine.

This is my problem :(... I dont know how drupal's theme engine works...

Can someone tell me how "phptemplate_node" is called?

Any suggestion please.

Heine’s picture

From this code in phptemplate.engine

  if (theme_get_setting('toggle_node_info_' . $node->type)) {
    $variables['submitted'] =  t('Submitted by %a on %b.', array('%a' => theme('username', $node), '%b' => format_date($node->created)));
    $variables['picture'] = theme_get_setting('toggle_node_user_picture') ? theme('user_picture', $node) : '';
  }

it is clear that the current settings needed to get user pictures in forum nodes is to enable

1) Display post information on forum topic
2) User pictures in posts

If you want user pictures in posts to be sufficient take the $variables['picture'] = ... out of the if (theme_get_setting('toggle_node_info_' . $node->type)) clause.

xtony’s picture

Yes, that's an easy fix. But should this be considered as a bug? should it be patched?

I digged into deep and found that $node variable is loaded from database but "theme_get_setting" uses the name of a node. for example, in the database $node->type of forum is "forum" but the "theme_get_setting" uses "module_invoke_all('node_info')" function to load node's type variable which is "forum topic". I have to take more time for this. But so sleepy now. The problem must be how a forum's node is saved to the database.

Any idea?

Heine’s picture

Assigned: xtony » Heine

Oke, I see what you mean (though the setting toggles 'toggle_node_info_forum'). Since I was already mucking with the theme_settings code, I'll look into it further.

Heine’s picture

Status: Needs work » Needs review
FileSize
518 bytes

The reason why everything works is because of system_theme_settings (system.module: 1043)

foreach ($node_types as $type => $name) {
        $form['node_info']["toggle_node_info_$type"] = array('#type' => 'checkbox', '#title' => $name, '#default_value' => $settings["toggle_node_info_$type"]);
      }

where toggle_node_info_forum is defined in the theme settings form and saved upon submit.

This is of course inconsistent. Attached patch modifies theme_get_settings to use the node $key as node type.

Heine’s picture

Title: Node does not show user picture » Use basename not pretty name in theme_get_settings
FileSize
529 bytes

And a patch against a fresh checkout of the 4.7 branch. The original title doesn't reflect the issue accurately; user pictures display fine in (forum) nodes.

xtony’s picture

sorry about the title :).

And thank you for the patch.

Dries’s picture

Last patch looks good to me. Will commit unless someone objects.

Great collaboration folks! And xtony, welcome on board. ;)

drumm’s picture

Status: Needs review » Fixed

Committed to HEAD.

killes@www.drop.org’s picture

also to 4.7.

Anonymous’s picture

Status: Fixed » Closed (fixed)