Last updated March 19, 2009. Created on January 1, 2007.
Edited by -Shaman-, joachim, iandickson. Log in to edit this page.

Altering the node.tpl file can be used to control where user pictures appear (provided that you have turned them on in User Settings and Theme of course).

For example I had a site which comprised formal pages where avatars were NOT wanted, and a Forum where they were.

In English this means "if the user has a Picture AND the page content TYPE is a FORUM POST - print the picture" (and if it's any other part of the site, then don't print the picture...).

   
<?php if ($picture && $type == 'forum') {
      print
$picture;
    }
?>

Looking for support? Visit the Drupal.org forums, or join #drupal-support in IRC.

Comments

ckuert’s picture

As I tried the code from above I received a Parse Error.

What worked for me:
(Displays the picture everywhere but in events.)

<?php
 
if ($picture && $type != 'event'):
?>
<?php
 
print $picture
?>
<?php
 
endif;
?>
jessmagz’s picture

Can I use OR here to give more options in displaying the picture? For instance, in my case, I want to OR your given statement since I want to display user pictures in FORUM and SOLUTION content types but no pictures for the rest of the content types.

Jess

midlake’s picture

Worked great -- make sure you enable "User picture in posts" on your theme, or else there's no function.