I am sure that someone has done this, but I can't find it in the Drupal forums:

I just installed the Flatforum module, and it comes closer to making Drupal's forum look like one, so that's good. The problem is that the forum user's avatars show up all over the site, rather than just staying in the forums. So I have avatars on the front page of my site:

http://www.ubuntuwebservers.com (the orange circle "Ubuntu" logo next to each front page post are actually avatar images that I'd rather not have there)

When I really just want them in the forum:

http://www.ubuntuwebservers.com/forum

How can I make the avatars exist only in the forums? Or, better yet, avatar pics in the forums, then users have the option to use that same avatar in their posts on the rest of the site?

Vince

Comments

andre75’s picture

For the forum you should have a template
(if I recall correctly : node-forum.tpl.php)
In that file you have some line that prints $picture
I don't remember the exact variable name, but I can look this up once I get home if you can't find it.
Anyways, all other nodes are either controlled by
node.tpl.php (the default) or node-nodetype.tpl.php (nodetype is the type of the node like story,page ...).
You have to delete the code that puts out the picture in these template files.
If that was not enough info, I can look it up when I get home.
Andre

-------------------------------------------------
http://www.opentravelinfo.com
http://www.aguntherphotography.com

pacheco’s picture

function _is_forum($arg = NULL) {
  static $is_forum = FALSE;
  if ($arg) {
    $is_forum = $arg;
  }
  return $is_forum;
}
function _phptemplate_variables($hook, $vars) {
  static $is_forum;
  if (!isset($is_forum)) {
    $is_forum = (arg(2) == 'forum');
    _is_forum($is_forum);
  }
  switch ($hook) {
    case 'page':
      break;
    case 'comment' :
      if ($is_forum) $variables['template_file'] = 'comment_forum';
      break;
    case 'node' :
      if ($is_forum) $variables['template_file'] = 'node_forum';
      break;
  }
  return $variables;
}

1. create a new template file "comment_forum.tpl.php", show the avatar
2. modify comment.tpl.php (or create one), hide the user picture
3. Do the same with "node.tpl.php"

i was posting this code just onde topic before that and thought it would be usefull to you either.

VinceDee’s picture

I was having a hard time figuring out what you wanted me to do here (I'm hardly a programmer), but I did manage to make my way through it. If you don't mind, I'll put it into simpler terms for other newbies like myself:

1. Create a text file called comment_forum.tpl.php and paste ppacheco's code into it. Save it.

2. Modify the comment.tpl.php file from your current theme directory by removing the following code from it (this assumes that you have Flatforum installed, which has a comment.tpl.php file). Then save the file:

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

3. Modify your node.tpl.php file in the same way.

4. Upload all 3 files back into your current theme directory.

5. Your avatars should now only appear in your forum.

Thanks for the snippet, ppacheco (if I screwed up explaining these directions, let me know and I'll correct them)

Vince

---------
The hottest Linux distribution? Ubuntu
Talk about Ubuntu Web Servers at:
http://www.ubuntuwebservers.com

pacheco’s picture

i've gone trought that problem before and was helped by an similar snipet on handbook

you are more than welcome making it clear to others, good work!

With the right code, drupal forum module, is as good as any other projects (like phpBB), it just comes in parts so you can have more fun ;)

cheers