Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Avatar Upload in WordPress


KICKERMAN360
Member

@kickerman360

Hey thanks _ck_

I found this snippet of code

<?php global $user_identity;

get_currentuserinfo();

if ($user_identity == ”) {

echo(‘Welcome Guest’);

} else {

echo(‘<img src=”/forum/avatars/’ . strtolower($user_identity) . ‘” alt=”avatar” />’);

}

?>

Which doesn’t cause an error but doesn’t display an image. I don’t think a file type is being declared which results in a 404 and then the alt text is displayed.

I did however come up with this, which is a modded version (to be used on a homepage)

<?php echo(‘<img src=”/forums/avatars/’ . $current_user->user_login . ‘.jpg” />’); ?>

<?php echo(‘<img src=”/forums/avatars/’ . $current_user->user_login . ‘.png” />’); ?>

<?php echo(‘<img src=”/forums/avatars/’ . $current_user->user_login . ‘.gif” />’); ?>

<?php echo(‘<img src=”/forums/avatars/’ . $current_user->user_login . ‘.jpeg” />’); ?>

I’m not sure how to find out the file extension via php so I just created 3 extra lines of code for the 4 types of files the form should accept.

If anyone wants to clean up my code I’d greatly appreciate it, I’m only just learning php (noob :D ) after playing with CSS and (x)HTML for a while. I know, the code will not be valid.

Thanks again, _ck_ ( I didn’t realize there was 2 help forums for that plugin)

Skip to toolbar