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
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

mfer - July 27, 2007 - 19:23

@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:

<?php
function 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

drupalina - July 27, 2007 - 21:07

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 <?php

I tried deleting "?>" at the end, but it's all the same

BTW: my basetheme is based on Zen theme

#3

drupalina - July 27, 2007 - 21:26

I've deleted "

<?php
" and also the "
?>
" at the end of your code. The site was back up again.

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

mfer - July 28, 2007 - 17:16

Do you get the error without any modifications to the template.php file?

In your template.php file put everything between the

<?php
and
?>
but not the
<?php
and
?>
.

#5

drupalina - July 29, 2007 - 11:42

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

Prodigy - August 14, 2007 - 22:42

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

drupalina - August 16, 2007 - 11:47

yes, I am using the Private Mesage module, but it is the stable 1.8 version and these errors still show

#8

po8 - December 2, 2007 - 21:00

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

yettyn - October 15, 2008 - 20:58
Version:5.x-2.4» 6.x-1.x-dev

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

wuf31 - March 24, 2009 - 07:59

subs

#11

tsi - April 20, 2009 - 14:08

Maybe the Author pane module can help you with that by adding a block with the author details like name, picture and more.

 
 

Drupal is a registered trademark of Dries Buytaert.