How do I turn on user pictures in posts, and comments?
Passionate_Lass - June 14, 2009 - 16:14
Drupal 6.x
Using Contrast theme
I have configured the site in:
/admin/user/settings
/admin/build/themes/settings
/admin/build/themes/settings/contrast
and user pictures still are not showing up. An icon like:
http://thegreatcrusade.com/sites/default/themes/contrast/images/PostAuth...
shows up, but, no user pictures.
Any thoughts on what the problem could be?

=-=
check the theme files, does the theme itself support user pictures?
Their project page says it
Their project page says it does.
When in the theme config it gives you the check box for "post user pictures on comments" or something but none for nodes. I posted an issue on the theme issue queue because their project page says they support user pictures.
If you want it to show for
If you want it to show for nodes, you'll need to edit node.tpl.php. Look at it: there is nothing in the file that would print a picture. Look at comments.tpl.php. There is.
You'll need to add the picture to the template if you want comments to show for nodes.\
BTW you did not mention if pictures work for comments. Do they?
Hi. I found the "chunk" of
Hi.
I found the "chunk" of code that makes the built in image they have for user pictures appear.
It's in a file named: common_methods.php
function art_submitted_worker($submitted, $date, $name) {$output = '';
ob_start();?><img class="metadata-icon" src="<?php echo get_full_path_to_theme(); ?>/images/PostDateIcon.png" width="18" height="18" alt="PostDateIcon"/> <?php
$output .= ob_get_clean();
$output .= $date;
$output .= ' | ';
ob_start();?><img class="metadata-icon" src="<?php echo get_full_path_to_theme(); ?>/images/PostAuthorIcon.png" width="18" height="18" alt="PostAuthorIcon"/> <?php
$output .= ob_get_clean();
$output .= $name;
return $output;
}
I came up with this which doesn't work yet. Maybe you'll have some thoughts on how to make this work.
function art_submitted_worker($submitted, $date, $name) {$output = '';
ob_start();?><img class="metadata-icon" src="<?php echo get_full_path_to_theme(); ?>/images/PostDateIcon.png" width="18" height="18" alt="PostDateIcon"/> <?php
$output .= ob_get_clean();
$output .= $date;
$output .= ' | ';
ob_start();if ($picture): print "$picture"; else: ?><img class="metadata-icon" src="<?php echo get_full_path_to_theme(); ?>/images/PostAuthorIcon.png" width="18" height="18" alt="PostAuthorIcon"/> <?php endif;
$output .= ob_get_clean();
$output .= $name;
return $output;
}
The code above still prints the default pic though and not the actual user pictures. Any thoughts on why that could be?
function
function art_submitted_worker($submitted, $date, $name){
$output = '';
ob_start();
?>
<img class="metadata-icon" src="<?php echo get_full_path_to_theme(); ?>/images/PostDateIcon.png" width="18" height="18" alt="PostDateIcon"/>
<?php
$output .= ob_get_clean();
$output .= $date;
$output .= ' | ';
ob_start();
if ($picture):
print $picture;
endif;
$output .= ob_get_clean();
$output .= $name;
return $output;
}
Prints no image at all. :/
The $picture variable is not
The $picture variable is not set, so it's doing exactly what you tell it to do.
If I print "my picture is
If I print "my picture is $picture" it prints the user picture just fine if I put it in page.tpl.php.
How do I set $picture to get the user picture information, and basically post the html for the image.
odds are good you just need
odds are good you just need to print the picture in node.tpl.php. use comment.tpl.php as a model.
The way this theme is coded I
The way this theme is coded I can't. The image I want to replace with the use picture is in the file I explained, and in the function posted above. :/
Comment.tpl.php for contrast prints the picture by
<?php if ($picture) {echo $picture; } ?>Ahh, got you. If you don't
Ahh, got you.
If you don't want that icon, just remove the code (the call to that function) to prints it.
What you can do is this.... change that function to add a $picture variable, then what you were trying to do should work:
function art_submitted_worker($submitted, $date, $name, $picture) {
And then in the node.tpl.php have it pass along the $picture variable
art_submitted_worker($submitted, $date, $name, $picture);
What they are doing is a little odd. They should let you theme that to how you like.
So basically this would be
So basically this would be the function?
function art_submitted_worker($submitted, $date, $name, $picture){
$output = '';
ob_start();
?>
<img class="metadata-icon" src="<?php echo get_full_path_to_theme(); ?>/images/PostDateIcon.png" width="18" height="18" alt="PostDateIcon"/>
<?php
$output .= ob_get_clean();
$output .= $date;
$output .= ' | ';
$output .= $picture;
$output .= ob_get_clean();
$output .= $name;
return $output;
}
Oops. That actually broke the
Oops.
That actually broke the site :/
But
function art_submitted_worker($submitted, $date, $name, $picture){
$output = '';
ob_start();
?>
<img class="metadata-icon" src="<?php echo get_full_path_to_theme(); ?>/images/PostDateIcon.png" width="18" height="18" alt="PostDateIcon"/>
<?php
$output .= ob_get_clean();
$output .= $date;
$output .= ' | ';
$output .= $name;
$output .= $picture;
return $output;
}
does this:
http://thegreatcrusade.com/
HOw would I get everything back on the same line? :S
Also look into imagecache +
Also look into imagecache + "imagecache profiles" modules if you want small, consistent icons for your users.