Title: User Photo
Author: Weston Ruter
Published: <strong>Декабрь 17, 2007-ж.</strong>
Last modified: Май 31, 2017-ж.

---

Плагиндерди издөө

This plugin **hasn’t been tested with the latest 3 major releases of WordPress**.
It may no longer be maintained or supported and may have compatibility issues when
used with more recent versions of WordPress.

![](https://s.w.org/plugins/geopattern-icon/user-photo.svg)

# User Photo

 Автору [Weston Ruter](https://profiles.wordpress.org/westonruter/)

[Жүктөө](https://downloads.wordpress.org/plugin/user-photo.0.9.10.zip)

 * [Кенен маалымат](https://ky.wordpress.org/plugins/user-photo/#description)
 * [Сын-пикирлер](https://ky.wordpress.org/plugins/user-photo/#reviews)
 * [Development](https://ky.wordpress.org/plugins/user-photo/#developers)

 [Колдоо](https://wordpress.org/support/plugin/user-photo/)

## Сүрөттөө

Allows a user to associate a profile photo with their account through their “Your
Profile” page. Admins may
 add a user profile photo by accessing the “Edit User”
page. Uploaded images are resized to fit the dimensions specified on the options
page; a thumbnail image correspondingly is also generated. User photos may be displayed
within a post or a comment to help identify the author. New template tags introduced
are:

 * `userphoto_the_author_photo()`
 * `userphoto_the_author_thumbnail()`
 * `userphoto_comment_author_photo()`
 * `userphoto_comment_author_thumbnail()`

_Important: all of these “template tags” must appear inside of PHP script blocks(
see examples below)._
 The first two should be placed in the posts loop near `the_author()`,
and the second two in the comments loop near `comment_author()` (or their respective
equivalents). Furthermore, `userphoto_the_author_photo()` and `userphoto_the_author_thumbnail()`
may be called anywhere (i.e. sidebar) if `$authordata` is set.

The output of these template tags may be modified by passing four parameters: `$
before`, `$after`, `$attributes`, and `$default_src`,
 as in: `userphoto_the_author_photo(
$before, $after, $attributes, $default_src)`. If the user photo exists (or `$default_src`
is supplied), then the text provided in the `$before` and `$after` parameters is
respectively prefixed and suffixed to the generated `img` tag (a common pattern 
in WordPress). If attributes are provided in the `$attributes` parameter, then they
are returned as attributes of the generated `img` element. For example: `userphoto_the_author_photo('','',
array(style => 'border:0'))` Just added in 0.8.1 release are these two new template
tags:

 * `userphoto($user, $before = '', $after = '', $attributes = array(), $default_src
   = '')`
 * `userphoto_thumbnail($user, $before = '', $after = '', $attributes = array(),
   $default_src = '')`

By using these, it is uneccessary to set the global `$authordata` to display a photo.
Just pass `$authordata`, `$curauth` or
 whatever variable you have which contains
the user object, or (as of version 0.9), pass in a user ID or a user login name.

Here’s an example that shows a few ways of inserting a user’s photo into the post
loop:
 //this will display the user’s avatar if they don’t have a user photo,

    ```
    <?php while (have_posts()) : the_post(); ?>
        <div class="post" id="post-<?php the_ID(); ?>">
            <h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
            <div class="meta">
                <?php the_time('F jS, Y') ?>
                by <?php the_author() ?>

                <!-- displays the user's photo and then thumbnail -->
                <?php userphoto_the_author_photo() ?>
                <?php userphoto_the_author_thumbnail() ?>

                <!-- the following two do the same since $authordata populated -->
                <?php userphoto($authordata) ?>
                <?php userphoto_thumbnail($authordata) ?>

                <!-- and this is how to customize the output -->
                <?php userphoto_the_author_photo(
                    '<b>Photo of me: ',
                    '</b>',
                    array('class' => 'photo'),
                    get_template_directory_uri() . '/nophoto.jpg'
                ) ?>
            </div>
            <?php the_content('Read the rest of this entry &raquo;'); ?>
        </div>
    <?php endwhile; ?>
    ```

If you want to display the user’s photo in the sidebar, just get the user ID or 
object and pass it into `userphoto()` or `userphoto_thumbnail()` like this:

    ```
    <?php userphoto($posts[0]->post_author); ?>
    ```

If you want to display a user’s photo their author page, you may do this:

    ```
    <?php userphoto($wp_query->get_queried_object()) ?>
    ```

In version 0.9 the boolean function `userphoto_exists($user)` has been introduced
which returns true if the user has a photo and false if they do not.
 Argument `
$user` may be user object, ID, or login name. This function can be used along with
avatars:

    ```
    <?php
    if(userphoto_exists($user))
        userphoto($user);
    else
        echo get_avatar($user->ID, 96);
    ?>
    ```

Or if the new “Serve Avatar as Fallback” option is turned on, then the avatar will
be served by any of the regular calls to display the user photo:

    ```
    <?php
    //this will display the user's avatar if they don't have a user photo,
    //  and if "Serve Avatar as Fallback" is turned on
    userphoto($user);
    ?>
    ```

Additionally, all of the regular function calls to display the user photo may be
done away with alltogether if the new “Override Avatar with User Photo”
 option 
is enabled:

    ```
    <?php
    //both will display the user photo if it exists
    //  and if "Override Avatar with User Photo" is turned on
    echo get_avatar($user_id);
    echo get_avatar($user->user_email);
    ?>
    ```

Both options “Serve Avatar as Fallback” and “Override Avatar with User Photo” require
that the ‘Avatar Display’ setting under Discussion be set to “Show”.

Uploaded images may be moderated by administrators via the “Edit User” page.

Localizations included for Spanish, German, Dutch, Polish, Russian, French, Hungarian,
Brazilian Portuguese, Italian, and Catalan.

If you value this plugin, _please donate_ to ensure that it may continue to be maintained
and improved.

## Скриншоттор

 * [[
 * Admin section in User Profile page

## Сын-пикирлер

![](https://secure.gravatar.com/avatar/87eba41341692e5c06e37db20973440558c809f3fe0faf6ead0851bc0d7b74af?
s=60&d=retro&r=g)

### 󠀁[Shortecodes](https://wordpress.org/support/topic/shortecodes/)󠁿

 [mahdiasadi77](https://profiles.wordpress.org/mahdiasadi77/) Декабрь 6, 2020-ж.

does it have any shortecode for displaying in pages?

![](https://secure.gravatar.com/avatar/10001bd487a0a3cae79c1d20f0c2c73d1d38a27d726f421823c162c8f7f5168c?
s=60&d=retro&r=g)

### 󠀁[Works with 4.7.6](https://wordpress.org/support/topic/works-with-4-7-6/)󠁿

 [noticierodigital3](https://profiles.wordpress.org/noticierodigital3/) Октябрь 
3, 2017-ж.

Works with 4.7.6

![](https://secure.gravatar.com/avatar/4295a5a4074eb61278a808430aebb43acf529368de3f6311b15f049c0579a7b9?
s=60&d=retro&r=g)

### 󠀁[Perfect](https://wordpress.org/support/topic/perfect-2451/)󠁿

 [markusthayer](https://profiles.wordpress.org/markusthayer/) Сентябрь 3, 2016-ж.

Works fine!

![](https://secure.gravatar.com/avatar/32da987831b95791b03be4b445cebd74335e95ed94e648c6ad20aa00b6346060?
s=60&d=retro&r=g)

### 󠀁[works fine for me](https://wordpress.org/support/topic/works-fine-for-me-38/)󠁿

 [daneshva](https://profiles.wordpress.org/daneshva/) Февраль 8, 2017-ж.

Thank you!

 [ Read all 20 reviews ](https://wordpress.org/support/plugin/user-photo/reviews/)

## Contributors & Developers

“User Photo” is open source software. The following people have contributed to this
plugin.

Мүчөлөрү

 *   [ Weston Ruter ](https://profiles.wordpress.org/westonruter/)
 *   [ Ryan Hellyer ](https://profiles.wordpress.org/ryanhellyer/)
 *   [ Glen Scott ](https://profiles.wordpress.org/glen_scott/)

“User Photo” has been translated into 1 locale. Thank you to [the translators](https://translate.wordpress.org/projects/wp-plugins/user-photo/contributors)
for their contributions.

[Translate “User Photo” into your language.](https://translate.wordpress.org/projects/wp-plugins/user-photo)

### Interested in development?

[Browse the code](https://plugins.trac.wordpress.org/browser/user-photo/), check
out the [SVN repository](https://plugins.svn.wordpress.org/user-photo/), or subscribe
to the [development log](https://plugins.trac.wordpress.org/log/user-photo/) by 
[RSS](https://plugins.trac.wordpress.org/log/user-photo/?limit=100&mode=stop_on_copy&format=rss).

## Өзгөртүүлөр

#### 0.9.10

 * Added recommendation to upgrade in wp-admin/plugins.php
 * Provided option to never see the upgrade notice again

#### 0.9.9

 * Removed deprecated mysql_ function

#### 0.9.8

 * Optimised retrieval of administrators for settings page

#### 0.9.7

 * Fixed WordPress deprecated notices

#### 0.9.6

 * Fixed PHP notice about deprecated argument
 * Use semantic versioning for plugin files

#### 2012-05-08: 0.9.5.2

 * Security issue (credit Ryan Hellyer).

#### 2011-02-17: 0.9.5

 * Fixing major security issue (credit ADVtools SARL).

#### 2009-7-28

 * Fixed a small bug relating to line 453 changing “home” to “siteurl”. Thanks Piotr!

#### 2009-02-13

 * Added Catalan localization. Thanks Robert!
 * 2009-02-28 =
 * Added Italian localization. Thanks Federico!

#### 2009-02-17

 * Added Brazilian Portuguese localization. Thanks gui!

#### 2009-01-07

 * Added Hungarian localization. Thanks Csaba!

#### 2008-12-11

 * Added French localization. Thanks Jean-Pierre!

#### 2008-11-14: 0.9.4

 * Now displaying error message if `wp_upload_dir()` fails when trying to display
   a user photo.

#### 2008-11-14: 0.9.3

 * Forcing the uploaded filename to lower-case

#### 2008-11-03: 0.9.2

 * Updated error message to include results for `wp_upload_dir()`

#### 2008-09-22: 0.9.1

 * Updated error messages to be more helpful (includes the paths in question). This
   will help debug some of the issues that have been raised on the forums lately.

#### 2008-09-22: 0.9

 * First argument to `userphoto()` and `userphoto_thumbnail()` may now just be a
   user ID or user login name in addition to a user object.
 * New “Serve Avatar as Fallback” option; this is disabled by default.
 * New boolean function `userphoto_exists($user)` which returns true if the user
   has a photo and false if they do not. Argument `$user` may be user object, ID,
   or login name.
 * New option “Override Avatar with User Photo”; disabled by default.
 * Adding `class="photo"` by default if no class attribute is supplied
 * Fixed issue where thumbnail (and associated usermeta) wasn’t being deleted along
   with the full-size photo (thanks Oliver).
 * Now using `wp_upload_dir()` to get the basedir for where the userphoto directory
   will be located.

#### 2008-08-01: 0.8.2

 * Verified that works in WP 2.6; added note explaining what the error message regarding
   what “image resizing not available” means… namely that the GD module is not installed.

#### 2008-05-29: 0.8.1

 * Added localization for Russian (thanks Kyr!)

#### 2008-05-17: 0.8.1

 * Finally updated the plugin for WP 2.5. Note that it still worked for 2.5, it’s
   just the admin interfaces needed to be updated. Also added `userphoto()` and `
   userphoto_thumbnail()` template tags.

#### 2008-04-23: 0.8.0.5

 * Added localization for Polish (thanks Maciej!)

#### 2008-04-04: 0.8.0.4

 * Fixed issue where incorrect path was being generated for default photo.

#### 2008-04-04: 0.8.0.3

 * Using `wp_mail` instead of `mail` (Thanks again, Kyle.)

#### 2008-03-28: 0.8.0.2b

 * Ensured that “unapproved” photos are not displayed. (Thanks Kyle.)

#### 2008-02-24: 0.8.0.2

 * Made minor improvement to security.

#### 2008-02-13: 0.8.0.1

 * Removed `print_r()` from being called when using `$default_src` (thanks David!)

#### 2008-02-04: 0.8

 * Allow before and after text to be outputted when there is a user photo.
 * Allow attributes to be passed into template tags, including a default SRC value
   to be used when there is no user photo.
 * Added Dutch localization translated by Joep Stender (thanks!)

#### 2008-01-07: 0.7.4b

 * Added German localization translated by Robert Harm (thanks!)

#### 2008-01-06: 0.7.4

 * Added support for localization and added Spanish localization translated by Pakus(
   thanks!)

#### 2008-01-02: 0.7.3

 * Fixed issue where the post author photo was inadvertently used for non-registered
   comment author photos.

#### 2007-12-28: 0.7.2

 * Improved error message raised when unable to create ‘userphoto’ directory under/
   wp-content/uploads/. It now asks about whether write-permissions are set for 
   the directory.
 * Improved the plugin activation handler.
 * All uploaded images are now explicitly set to chmod 666.

#### 2007-12-22: 0.7.1

 * All functions (and template tags) now are prefixed with “userphoto_”

#### 2007-12-18: 0.7.0.1

 * Now using `siteurl` option instead of `home` option
 * Fixed the inclusion of the stylesheet for the options page

#### Todo

 1. When changing the authorization level, all previous users’ photos should be automatically
    approved if they meet the minimum user level
 2. Include a get_userphoto() and get_userphoto_thumbnail() ?
 3. Add a management page to allow admins to quickly approve/reject user photos.
 4. Add option so that when a photo is rejected, the user is notified.
 5. Restrict image types acceptable?
 6. Add an option to indicate a default photo to be used when none supplied.

## Мета

 *  Нуска **0.9.10**
 *  Акыркы жаңыртуу **8 жыл мурун**
 *  Активдүү орнотуулар **3,000+**
 *  WordPress нускасы ** 3.0.5 же андан жогору **
 *  Tested up to **4.6.30**
 *  Тилдер
 * [English (US)](https://wordpress.org/plugins/user-photo/) жана .[French (France)](https://fr.wordpress.org/plugins/user-photo/).
 *  [Translate into your language](https://translate.wordpress.org/projects/wp-plugins/user-photo)
 * Тег:
 * [images](https://ky.wordpress.org/plugins/tags/images/)[photos](https://ky.wordpress.org/plugins/tags/photos/)
   [users](https://ky.wordpress.org/plugins/tags/users/)
 *  [Advanced View](https://ky.wordpress.org/plugins/user-photo/advanced/)

## Рейтинг

 4.3 out of 5 stars.

 *  [  13 5-star reviews     ](https://wordpress.org/support/plugin/user-photo/reviews/?filter=5)
 *  [  3 4-star reviews     ](https://wordpress.org/support/plugin/user-photo/reviews/?filter=4)
 *  [  2 3-star reviews     ](https://wordpress.org/support/plugin/user-photo/reviews/?filter=3)
 *  [  0 2-star reviews     ](https://wordpress.org/support/plugin/user-photo/reviews/?filter=2)
 *  [  2 1-star reviews     ](https://wordpress.org/support/plugin/user-photo/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/user-photo/reviews/#new-post)

[See all reviews](https://wordpress.org/support/plugin/user-photo/reviews/)

## Мүчөлөрү

 *   [ Weston Ruter ](https://profiles.wordpress.org/westonruter/)
 *   [ Ryan Hellyer ](https://profiles.wordpress.org/ryanhellyer/)
 *   [ Glen Scott ](https://profiles.wordpress.org/glen_scott/)

## Колдоо

Комментарийлер барбы? Жардам керекпи?

 [Колдоо форумун көрүү](https://wordpress.org/support/plugin/user-photo/)