An option to display User's avatar
drupalina - July 27, 2007 - 14:50
| Project: | Blog Information |
| Version: | 6.x-1.x-dev |
| Component: | User interface |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
hello,
would it be possible to have a radio-button "Include my Picture in Blog Information block"???
if checked it would result in user's Avatar appear inside the BlogInfo block, above the text.
I thank you in advance

#1
@matrixfighter - While there isn't an easy to select checkbox it can be done fairly easily. I don't really have the time to write the code to do this anytime soon. Though, if someone else wants to roll a patch they can.
To get the picture to work add this to the template.php file for your theme:
<?phpfunction phptemplate_bloginfo_block($description, $format, $author) {
if (!empty($author)) { $user = user_load($author); }
$output = "";
if (!empty($user->picture)) {
$output .= '<img src="/'.$user->picture.'" alt="" />';
}
$output .= check_markup($description, $format, FALSE);
return $output;
}
?>
#2
thanks... but...
I've pasted this code into my template.php (which for some reason does not end with "?>" - but anyway)
and it came back with this error:
Parse error: syntax error, unexpected '<' in C:\wamp\www\dev\sites\all\themes\basetheme\template.php on line 280
line 280 is the line which displays the first line of your code -- ie
<?phpI tried deleting "?>" at the end, but it's all the same
BTW: my basetheme is based on Zen theme
#3
I've deleted "
<?php" and also the "
?>
But when I've started testing the BlogInfo module it also gave me the following:
* warning: Invalid argument supplied for foreach() in C:\wamp\www\dev\modules\user\user.module on line 53.
* user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 query: SELECT * FROM users u WHERE in C:\wamp\www\dev\includes\database.mysql.inc on line 172.
The BlogInfo text is displaying no problems, but there is still no avatar inside the BlogInfo block.
#4
Do you get the error without any modifications to the template.php file?
In your template.php file put everything between the
<?phpand
?>
<?phpand
?>
#5
I ran the script to display user's avatar as you gave me originally -- that didn't work.
Then I modified few minor things -- that didn't work either.
It now gives me the following error
* warning: Invalid argument supplied for foreach() in C:\wamp\www\dev\modules\user\user.module on line 53.
* user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 query: SELECT * FROM users u WHERE in C:\wamp\www\dev\includes\database.mysql.inc on line 172.
I never changed anything in user.module
Should I just wait untill you release a newer version of this module that would incorporate this feature of displaying user's avatar by default?
#6
I would be willing to bet you are also using " Private Message" module. Use the latest stable version to fix this, not the Dev :)
#7
yes, I am using the Private Mesage module, but it is the stable 1.8 version and these errors still show
#8
Perhaps a better way to do this is by setting a block on the page? I'm not sure whether this would require any custom code in current Drupal at all? I think it might be sufficient to just set up the block with the content being a pointer to the user's avatar?
#9
Pushing this forwards as there wont be any new features in D5 version, however no promises this will be in D6 either but I will look at it when I got time.
#10
subs
#11
Maybe the Author pane module can help you with that by adding a block with the author details like name, picture and more.