Hello again all,

I want to allow user pictures in posts and comments, but only in the forums. Is there a code snippet I can use in node.tpl.php that will only show user pictures if the Vocabulary = "forum"?

Thanks!

Comments

johnnoc’s picture

Copy your node.tpl.php and rename the copied file to node-forum.tpl.php.

in the original node.tpl.php find the line:
if ($picture) print $picture;
and delete that code.
but the node-forum.tpl.php should have it.
It may not be accurately the same code as given above, depending on your theme.

On garland, the code to find is:
print $picture

so you'll end up with

  1. node.tpl.php - without the print $picture code
  2. node-forum.tpl.php - with the print $picture code.

And configure your theme: admin » build » themes » settings
to show user pictures on nodes and comments.

Good luck!

John
---------------------------------
http://www.drupalnorge.no
hvor oversettere, utviklere og brukere av Drupal i Norge er som en stor familie!

Steel Rat’s picture

Thanks!

Unfortunately I won't know if it works until I can get another problem worked out, which is why $picture is always false.

Steel Rat
Drupal Site: RPGMapShare.com

brenda003’s picture

In admin > themes > configure, make sure having user pictures show up in posts is checked.

vm’s picture

There are two places to insure user pictures work.

user pictures must first be enabled in administer -> user settings -> Pictures
Then they can be enabled at the them layer in administer -> themes -> configure

Steel Rat’s picture

I had done both of those (have setup and am running several Drupal 4.7 sites), and it just wasn't working. After I stopped messing with it and went on to other things it suddenly started working. So perhaps it was a cacheing issue.

Anyway, the node-forum.tpl.php fix worked perfectly for what I wanted to do.

Thanks!

Steel Rat
Drupal Site: RPGMapShare.com

litelus’s picture

thx brenda this is exactly what worked for me

gurukripa’s picture

hi..
wld like to have a user profile..that looks good..a large image there..
and a thumbnail image in posts and comments..and maybe forums..the way u describe it..

can u pls advise how this can be done on 5.1
which modules to use..and how to do it..

also if u can teach how to make a good user profile..that wld be great..since the Drupal default profile leaves a lot to be desired...but its rugged nevertheless...wld be nice if things can be achieved without hacking on code..but as a module..pls guide me.

gurukripa’s picture

hi..
wld like to have a user profile..that looks good..a large image there..
and a thumbnail image in posts and comments..and maybe forums..the way u describe it..

can u pls advise how this can be done on 5.1
which modules to use..and how to do it..

also if u can teach how to make a good user profile..that wld be great..since the Drupal default profile leaves a lot to be desired...but its rugged nevertheless...wld be nice if things can be achieved without hacking on code..but as a module..pls guide me.

vm’s picture

investigate the advanced profile module

beyond that: get your site updated to 5.12 to remain as secure and bug free as possible.