geekgrl.net

home of hannah gray, bookworm, geek, cat-lover

Profile Pics Plugin Release

This plugin has IE 7 issues - I’m insanely busy right now but I’ll fix and update the plugin ASAP. Until then, consider yourself warned :)

What It Does:
Profile Pics is a WordPress plugin which adds a photo upload utility to the user profile editing pane, and 4 template tags to place the picture in an author page or elsewhere — even as a comment avatar. Settings are highly configurable via GUI config page within WordPress. I designed this plugin for WordPress 2.x - it has not been tested on previous versions.

Example:
http://geekgrl.net/author/admin/

Download Link:


Dowload Count: 5804
Last Updated: 01/14/2007

Screen Shots:

Profilepic Screen1
Picture on Profile Page

Profilepic Screen2
Picture Upload Tool

Profilepic Screen3
Plugin Options

Directions: (mirrored in readme)
Install Instructions:

  1. Upload profile-picture.php to wp-content/plugins/
  2. Upload folder “authors” to wp-content/uploads/
  3. Set folder wp-content/uploads/authors to chmod 777
  4. Activate Profile Pictures plugin from the plugins page in the WP admin area
  5. Change settings if desired, from within the OPTIONS: page in the WP admin area
  6. Add the following code to your theme’s author.php file, or use the included themes/my-theme/author.php as a template for creating your own author page template (more details below)

Author Template Code Example

<!– This sets the $curauth & $authid variables –>
<?php
if (isset($_GET['author_name'])){
$curauth = get_userdatabylogin($author_name);
$authid = $author_name;
} else {
$curauth = get_userdata(intval($author));
$authid = intval($author);
}
?>
<div id=”profilebox” style=”min-height: <?php author_image_dimensions(author_image_path($authid, false, ‘absolute’), ‘height’, true); ?>px;”>
<?php author_image_tag($authid, ‘align=right’); ?>
<h2><?php _e($curauth->first_name); ?> <?php _e($curauth->last_name); ?></h2>
<p><b>E-Mail: </b> <?php _e($curauth->user_email); ?>
<p><b>Yahoo IM: </b><?php _e($curauth->yim); ?>
<p><b>AIM: </b><?php _e($curauth->aim); ?>
<p><b>Jabber: </b><?php _e($curauth->jabber); ?>
<p><b>Web Page: </b><a href=”<?php _e($curauth->user_url); ?>”><?php _e($curauth->user_url); ?></a>
<p><b>Registered Since: </b><?php _e($curauth->user_registered); ?>
<p><b>Profile: </b><?php _e($curauth->description); ?>
</div>

Comments Avatar Code Example (add the following lines to wp-content/themes/my-themes/comments.php where you want the avatar to appear. set width in plugin options.)

<?php
if (function_exists(’author_gravatar_tag’)) {
$author_gravatar = author_gravatar_tag($comment->user_id,”class=’gravatar’”);
} else {
$author_gravatar = false;
}
if ($author_gravatar != false) {
echo ‘<a href=”‘.get_bloginfo(’url’).’/?author=’.$comment->user_id.’”>’.$author_gravatar.’</a>’;
}
?>

Implementation:
This plugin adds three template functions to display the author’s profile picture. These functions are designed to be used from within the Author Template. Theoretically, they can easily work from anywhere inside The Loop as well, although when used in the author template they can be placed outside The Loop. A sample author template is included with this plugin (see sample_template/author.php) — this needs to be placed in wp-content/themes/your-theme/ . To learn more about the author template, see: http://codex.wordpress.org/Author_Templates

Template Tag 1: Get Author Image Tag - makes a pretty <img> tag for author’s picture.
USAGE: author_image_tag(’authorID’, ‘tags’, ‘display’)

FUNCTION: returns image for author wrapped in image tag, style accessable via id=”authorpic”
OPTIONS:
authorID: id number of author
tags: attributes to include in img tag (optional, defaults to no tags)
display: display results in html (ie. echo) or reuse in php? true or false (optional, defaults to true)
EXAMPLE:
Code: <?php author_image_tag($authid, ‘align=left’); ?>
Result (ex.): <img src=”http://blog.com/wp-content/uploads/authors/default.jpg” width=200 height=199 align=left id=”authorpic” />

Template Tag 2: Get Author Image Path - useful if you need to do something else with the path or url (link to it, stuff it into another function, make your own image tag, etc)

USAGE: author_image_path(’authorID’, ‘display’, ‘type’)
FUNCTION: returns url or absolute path to author’s picture
OPTIONS:
authorID: id number of author
display: display results in html (ie. echo) or reuse in php? (optional, defaults to false)
type: specify what kind of path requested: ‘url’ or ‘absolute’ (optional, defaults to url)
EXAMPLE:
code: <?php author_image_path($authid, true, ‘absolute’); ?>
result: /home/jdoe/public_html/blog/wp-content/uploads/authors/1.jpg

Template Tag 3: Get Author’s Image’s Dimension - useful if you are making your own <img> tag, or a div container for the img

USAGE: author_image_dimensions(’path’, ‘dimension’, ‘display’)
FUNCTION: returns requested dimension of author’s picture
OPTIONS:
path: absolute path to author’s picture from server root’,
dimension: the dimension you want, can be either ‘height’ or width’
display: display results in html (ie. echo) or reuse in php? true or false
EXAMPLES: to get picture width… (using author_image_path to get path to picture)
Code: <?php author_image_dimensions(author_image_path($authid, false, ‘absolute’), ‘width’, true); ?>
Result (Ex.): 200
to get picture height… (using author_image_path to get path to picture)
Code: <?php author_image_dimensions(author_image_path($authid, false, ‘absolute’), ‘height’, true); ?>
Result (Ex.): 199

Template Tag 4: Get Author’s Avatar - intended for use in the comments loop

USAGE: author_gravatar_tag($authorID, $tags = ”)
FUNCTION: returns image tag if authorID is a registered user of your blog, false if author is not
OPTIONS:
authorID: id number of author
tags: attributes to include in img tag (optional, defaults to no tags)
EXAMPLES:
Code: <?php
if (function_exists(’author_gravatar_tag’)) {
$author_gravatar = author_gravatar_tag($comment->user_id,”class=’gravatar’”);
} else {
$author_gravatar = false;
}
if ($author_gravatar != false) {
echo $author_gravatar;
}
?>
Result (Ex.): <img src=”http://blog.com/wp-content/uploads/authors/default.jpg” width=80 height=80 class=’gravatar’ />

44 Comments so far

at 2:07 am on January 4th, 2007 suleiman wrote:

would love to test out this plugin but I get the following error on my blog:

Parse error: syntax error, unexpected T_VARIABLE in /home/…../public_html/wp-content/plugins/profile-picture.php on line 14


 
at 3:12 am on January 4th, 2007 hannah wrote:

Suleiman: I made a small adjustment and reuploaded the plugin - try downloading/installing it now. I’ve got the older version running on two sites now, so this must be a pretty minor error. I’m hoping I squashed it. Let me know!


 
at 9:44 pm on January 6th, 2007 Marjorie wrote:

Hannah, thank you for giving the details about your plugin. I haven’t done php for years so the details help orient me.


 
at 11:24 pm on January 6th, 2007 hannah wrote:

Marjorie: I’m glad the instructions were helpful. :) I tried to provide as much detail as possible… its not a one click install plugin, easy to get a bit lost. Let me know if you run into any problems.


 
at 11:27 am on January 14th, 2007 Markus wrote:

Hei! This is a perfekt plugin! Thank you! But i have one question: Can i use the Profil-pic like a gravater i comments? If yes, what is the code.

Thank you a lot!

Markus


 
at 12:11 pm on January 14th, 2007 hannah wrote:

that’s a good idea. I’ll work on it today. :)


 
at 5:41 pm on January 14th, 2007 hannah wrote:

okay, avatar option has been added. go ahead and redownload the plugin, replace the old profile-picture.php with the new, and then edit your theme’s comments.php useing the example code above to add avatars to comments (code already is use on these comments, in conjunction with the standard gravitars plugin)


 
at 6:12 pm on January 14th, 2007 Markus wrote:

Hei Hannah,

that´s so nice! Thank you very very much. After a wordpress-day have jeg with your help en sucess. Thank you! It works and i´m happy. Now can i sleep :)

Tusen takk (that´s norwegian) and Tausend Dank (that´s german)
Markus


 
at 7:58 pm on January 14th, 2007 shane wrote:

I am trying to get this working with an older (1.5.x) version of wordpress and so far everything is showing up in the backend except for the upload picture part. Do you know what i would have to change in order to hack it in?

Thanks in advance.


 
at 8:53 pm on January 14th, 2007 hannah wrote:

Shane: my plugin uses the profile_update hook to add the upload form to the user profile editing page. to my knowlege, there is no 1.5 equiv. hook. You could hack the form code into the profile editing core page without too much pain, but that kinda goes against WP principles.


 
at 10:05 pm on January 14th, 2007 shane wrote:

Its true it would be ugly, but could you maybe email me what section of code I would have to paste and maybe what file to paste it into? I would be very grateful :)


 
at 1:42 pm on January 16th, 2007 The Sietch Blog » Author Profile Pic Plugin wrote:

[...] Hannah over at geekgrl has helped me integrate a wonderful author picture plugin for wordpress author profiles check it out. As some of you might have noticed, you can on access author profiles by clicking on there names under the permalink to each post. [...]


 
at 10:25 am on January 17th, 2007 genau wrote:

I also would like to know where exactly i need merge that code.


 
at 10:56 am on January 17th, 2007 hannah wrote:

Genau: I’m talking with Shane to publish a 1.5 package. We’ll keep you posted…


 
at 12:05 pm on January 17th, 2007 Stan wrote:

Hannah -

FYI we had to add a section of file-permission code (snipped from from wp-includes/post.php) to work around an issue on our server and ensure that the upload isn’t executable. We placed this right after your move_uploaded_file call and worked like a charm:

// Set correct file permissions
$stat = @ stat(dirname($file_path));
$perms = $stat['mode'] & 0007777;
$perms = $perms & 0000666;
@ chmod($file_path, $perms);

Cheers –

– Stan


 
at 2:30 am on January 19th, 2007 Sean wrote:

Hi Hannah,

I’m unclear if I’m able to set the dimensions of the profile photos. It looks like it in your template tag 1, but I just can’t seem to work it out.

Beautiful plugin in any case.

-former banana slug (’03)


 
at 10:56 am on January 19th, 2007 hannah wrote:

Stan: Thanks for the code. this issue came up with another user and we resolved it with a similar bit of modification. I’ll go ahead and include it with the next release.

Sean: Template tag 1 is fingering width and height based on the size of the uploaded image. The script does not resize the pic (this functionality may be added later). (go slugs!)


 
at 8:16 am on January 28th, 2007 LaimuH wrote:

Hi,

I’m trying to use your plugin.
In fact I’m not a PHP master ^^

I past the code in comment.php (from default theme) but I get an error at this step :
$author_gravatar = author_gravatar_tag($comment->user_id,”class=’gravatar’”);

wherever I put it.

I guess I don’t choose the best place to put your code in comment.php.

Could you give me a clue ??

Regards.


 
at 1:58 pm on January 28th, 2007 Markus wrote:

Hei hannah,

i have en new question: I use the Plugin Get Recent Comments and i will use “your” Profil pics (like in the comments). How can i do this? Have you any idea?

Thank´s for your work!
Markus


 
at 8:36 pm on January 31st, 2007 » WordPress Plugin: Recent Comments wrote:

[...] Supports Hannah Gray’s Profile Pics Plugin [...]


 
at 8:59 pm on January 31st, 2007 Krischan wrote:

Hello Markus and Hannah, the get_recent_comments plugin now has a %profile_picture macro to support Profile Pics. :)


 
at 1:52 am on February 1st, 2007 Paul wrote:

Hi Hannah,

bit of a noob question here for you.
Where exactly would I place the tag:

to get an avatar next to a post or comment ?

thank you !
Paul - dazed and confused.


 
at 2:35 am on February 1st, 2007 Markus wrote:

Hei Hannah, now support the plugin recent comments (http://blog.jodies.de/archiv/2004/11/13/recent-comments/) your plugin. Now can vi use the autor pic i author profile, comments and sidebar wiht recent comments. i´m happy!

Markus


 
at 4:03 pm on February 5th, 2007 Casey wrote:

Just wanted to test this out…


 
at 12:44 am on February 6th, 2007 Paul wrote:

Hi Hannah,

I have the plugin working now with the default image,
but when I try to upload a new image from:

Your Profile page
Profile Picture

I can Browse and locate the file, then click Update Profile button, but the file is not uploaded, the default picture remains as Current:

I have the permissions of Authors folder set to 777.

Can you suggest anything please ?

Thank you.

P.


 
at 11:06 am on February 7th, 2007 suleiman wrote:

Hannah,

I’m trying to use your plugin in an installation of WPMU, the same software that powers Wordpress.com.

I thought the plugin would hiccup at uploading files to the directory /uploads/authors/ but it does not in fact have any diffculty doing so–which is great news!

The problem comes when trying to display the images associated with an author.

For example, on the blog farah.hadithuna.com, I was able to upload a profile picture for farah, who has a WPMU blog_id of “9.”

Your plugin saved her picture as “9.jpg” in the wp-content/uploads/authors/ directory, however if you go to her author page, the default image is displayed: http://farah.hadithuna.com/authors/

Do you have any idea what might be causing this kind of hiccup?


 
at 11:16 am on February 8th, 2007 Ola wrote:

What about including an imageResize function in the plug-in?
So when you make a call for the picture you can also specify a max-width or height, or both.

Like integrating this script:

$maxheight){
$div = $maxheight/$newheight;
$newwidth = $newwidth * $div;
$newheight = $newheight * $div;
}
}else if (isset($maxwidth)){
// Get new sizes
if ($width


 
at 5:30 am on February 12th, 2007 Dan wrote:

I’m using the author_image_tag to display the image on the front page next to the user’s posts but I cannot seem to get those pictures to update when the user chooses a new avatar. It updates fine when I use the author_gravatar_tag in the comments, just not when I put it for the posts. I am using Wordpress 2.1 and any help would be really appreciated!


 
at 3:32 pm on February 12th, 2007 Mark wrote:

I can’t see the picture I keep trying to upload in my profile. I even tried using ftp to move my picture in the suggested “authors” folder and it doesn’t show

Help appreciated


 
at 5:03 am on February 13th, 2007 Dadi wrote:

Hi Hannah

Looks like a great plugin and a wonderful idea.

I cant for the life of my figure out on the other hand why it is not working for me. I have 777 the author directory, and when I look at my postst with comments it displays only the default picture. I have looked at the folder through FTP and it does have two other pictures, 1.jpg and 4.jpg.

When I use the Get Recent Comments plugin then the pictures are displayd without any problems so I assume that author.php was correctly uploaded.

img src=?php author_image_path($authid,true,url);? width=”80″ align=”left”

That is the code that I use to display the pictures but I always get the same picture in the posts.

Any ideas?


 
at 3:36 am on February 14th, 2007 Corey Campbell wrote:

The upload function does not work in Internet Explorer.


 
at 6:09 am on February 15th, 2007 Loige wrote:

Very Cool! I’m going to try it! ;)


 
at 3:47 pm on February 17th, 2007 matt wrote:

yeah, I second Paul… there doesn’t appear to be a way to actually upload pictures.


 
at 5:22 am on February 19th, 2007 lego wrote:

Parse error: parse error, unexpected ‘=’ in /var/www/vhosts/hosternaut.com/httpdocs/wp-content/themes/My_tabs/comments.php on line 107

why does it do this?


 
at 12:28 pm on February 27th, 2007 Filip wrote:

Hi Hannah,
thanx for the great plugin… It’s just what i needed…
But, i found some flaws, at least i think so…
You did the extension check in java script, but you didn’t do it in php, so the file gets uploaded anyway… It’s just not shown as image in the blog…
Image on author profile page wasn’t resized, so i added defualt image width. Also I added file size check.
Both of them you can set in the admin area…
If you want I can send altered plugin, so you can look at it, maybe change it, and then release ver0.2… :D


 
at 12:57 pm on February 28th, 2007 patrick wrote:

suleiman, Author Template Code should add after , this should be work. :)


 
at 12:59 pm on February 28th, 2007 patrick wrote:

suleiman, Author Template Code should add after the_post() in author template, this should be work. :)


 
at 5:11 pm on February 28th, 2007 Ben wrote:

I don’t know if it’s exclusive to IE7, but the upload does not work with IE7 due to the fact that the form on the profile page does not have the parameter “enctype=multipart-form/data”. Obviously, this can be fixed by editing the profile.php file but that involes a WP core edit. Anyone know of another workaround?


 
at 3:35 pm on March 1st, 2007 Jason wrote:

Hi Hannah.

I am having the same issue as the previous user. I am inserting the picture within the loop on single.php (WP v2.0.4). I tried uploading the author’s pic through wp-admin but it does not place the image in the authors directory (permissions are set 777), but the page returns with “profile updated” message. So then I put the picture there manually…in this case I called it 7.jpg since the author_id=7.

No matter whether the author of the post is 7 or not, it is showing default.jpg. I set it up as follows:

AUTHOR.PHP CONTAINS:

px;”>

SINGLE.PHP CONTAINS:

NOTE: The call to this template is placed within the loop right before

It’s a very cool plug-in…hope to get it working. Thanks for any assistance.


 
at 3:40 pm on March 1st, 2007 Jason wrote:

Sorry to add a second comment…code I pasted in got removed…hope this works.

AUTHOR.PHP CONTAINS:

px;”>

Read the rest of this entry »’); ?>


 
at 3:56 pm on March 1st, 2007 Chris wrote:

I’m excited about this plugin but am unfortunately having the same problem as Paul, i.e. I can browse to a pic but it doesn’t appear to upload. I’ll look into the code and see if there is an obvious problem I’m missing…but I just thought I would let you know that someone else is having the same problem!

Thank you so much,
Chris


 
at 12:05 am on March 5th, 2007 lego wrote:

Yeah I fixed the problem I wasn’t able to show pics in the comments loop but i installed a gravatar plugin and it just decided to work all of a sudden. Im guessing it was a missing database table of some sort.


 
at 11:12 pm on March 8th, 2007 skarld wrote:

Hello Hannah,

I have tried and tried to make this work but I can not get anything but the default pic on the the single page. I know your wonderful plugin works because I see the photos on the supplied author page. I have tried turning off all the plugin and using the default them but I still get the default pic for every author on the single page. What could I be missing? I have upgraded to WordPress 2.1.2.

Thank you for any suggestions.


 
at 6:48 pm on December 1st, 2007 loige wrote:

It seems really really cool! ;)


 

Leave a reply


Fatal error: Call to undefined function akst_share_form() in /home/.fucilli/hgray/geekgrl.net/wp-content/themes/geekgrl/footer.php on line 15