{"id":617,"date":"2007-12-17T00:43:36","date_gmt":"2007-12-17T00:43:36","guid":{"rendered":"https:\/\/wordpress.org\/plugins-wp\/user-photo\/"},"modified":"2017-05-31T20:39:34","modified_gmt":"2017-05-31T20:39:34","slug":"user-photo","status":"publish","type":"plugin","link":"https:\/\/kir.wordpress.org\/plugins\/user-photo\/","author":186678,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","version":"0.9.10","stable_tag":"0.9.10","tested":"4.6.30","requires":"3.0.5","requires_php":"","requires_plugins":"","header_name":"User Photo","header_author":"<a href=\"http:\/\/weston.ruter.net\/\">Weston Ruter<\/a>","header_description":"","assets_banners_color":"","last_updated":"2017-11-28 09:18:06","external_support_url":"","external_repository_url":"","donate_link":"","header_plugin_uri":"http:\/\/wordpress.org\/extend\/plugins\/user-photo\/","header_author_uri":"","rating":4.3,"author_block_rating":0,"active_installs":3000,"downloads":487748,"num_ratings":20,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","changelog"],"tags":[],"upgrade_notice":[],"ratings":{"1":"2","2":0,"3":"2","4":"3","5":"13"},"assets_icons":[],"assets_banners":[],"assets_blueprints":{},"all_blocks":[],"tagged_versions":["0.7","0.9.10","0.9.4","0.9.5","0.9.5.1","0.9.5.2","0.9.6","0.9.7","0.9.8","0.9.9"],"block_files":[],"assets_screenshots":{"screenshot-1.jpg":{"filename":"screenshot-1.jpg","revision":"1776705","resolution":"1","location":"plugin"}},"screenshots":{"1":"Admin section in User Profile page"},"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[163,205,1917],"plugin_category":[50],"plugin_contributors":[78440,78439,78438],"plugin_business_model":[],"class_list":["post-617","plugin","type-plugin","status-publish","hentry","plugin_tags-images","plugin_tags-photos","plugin_tags-users","plugin_category-media","plugin_contributors-glen_scott","plugin_contributors-ryanhellyer","plugin_contributors-westonruter","plugin_committers-glen_scott","plugin_committers-ryanhellyer","plugin_committers-westonruter"],"banners":[],"icons":{"svg":false,"icon":"https:\/\/s.w.org\/plugins\/geopattern-icon\/user-photo.svg","icon_2x":false,"generated":true},"screenshots":[{"src":"https:\/\/ps.w.org\/user-photo\/trunk\/screenshot-1.jpg?rev=1776705","caption":"Admin section in User Profile page"}],"raw_content":"<!--section=description-->\n<p>Allows a user to associate a profile photo with their account through their \"Your Profile\" page. Admins may \nadd a user profile photo by accessing the \"Edit User\" page. Uploaded images are resized to fit the dimensions specified \non the options page; a thumbnail image correspondingly is also generated. \nUser photos may be displayed within a post or a comment to \nhelp identify the author. New template tags introduced are:<\/p>\n\n<ul>\n<li><code>userphoto_the_author_photo()<\/code><\/li>\n<li><code>userphoto_the_author_thumbnail()<\/code><\/li>\n<li><code>userphoto_comment_author_photo()<\/code><\/li>\n<li><code>userphoto_comment_author_thumbnail()<\/code><\/li>\n<\/ul>\n\n<p><em>Important: all of these \"template tags\" must appear inside of PHP script blocks (see examples below).<\/em>\nThe first two should be placed in the posts loop near <code>the_author()<\/code>, and the second two in the comments\nloop near <code>comment_author()<\/code> (or their respective equivalents). Furthermore, <code>userphoto_the_author_photo()<\/code>\nand <code>userphoto_the_author_thumbnail()<\/code> may be called anywhere (i.e. sidebar) if <code>$authordata<\/code> is set.<\/p>\n\n<p>The output of these template tags may be modified by passing four parameters: <code>$before<\/code>, <code>$after<\/code>, <code>$attributes<\/code>, and <code>$default_src<\/code>,\nas in: <code>userphoto_the_author_photo($before, $after, $attributes, $default_src)<\/code>.\nIf the user photo exists (or <code>$default_src<\/code> is supplied), then the text provided in the <code>$before<\/code> and <code>$after<\/code> parameters is respectively\nprefixed and suffixed to the generated <code>img<\/code> tag (a common pattern in WordPress). If attributes are provided in the <code>$attributes<\/code>\nparameter, then they are returned as attributes of the generated <code>img<\/code> element. For example: <code>userphoto_the_author_photo('', '', array(style =&gt; 'border:0'))<\/code>\nJust added in 0.8.1 release are these two new template tags:<\/p>\n\n<ul>\n<li><code>userphoto($user, $before = '', $after = '', $attributes = array(), $default_src = '')<\/code><\/li>\n<li><code>userphoto_thumbnail($user, $before = '', $after = '', $attributes = array(), $default_src = '')<\/code><\/li>\n<\/ul>\n\n<p>By using these, it is uneccessary to set the global <code>$authordata<\/code> to display a photo. Just pass <code>$authordata<\/code>, <code>$curauth<\/code> or\nwhatever variable you have which contains the user object, or (as of version 0.9), pass in a user ID or a user login name.<\/p>\n\n<p>Here's an example that shows a few ways of inserting a user's photo into the post loop:\n    \/\/this will display the user's avatar if they don't have a user photo,<\/p>\n\n<pre><code>&lt;?php while (have_posts()) : the_post(); ?&gt;\n    &lt;div class=\"post\" id=\"post-&lt;?php the_ID(); ?&gt;\"&gt;\n        &lt;h2&gt;&lt;a href=\"&lt;?php the_permalink() ?&gt;\"&gt;&lt;?php the_title(); ?&gt;&lt;\/a&gt;&lt;\/h2&gt;\n        &lt;div class=\"meta\"&gt;\n            &lt;?php the_time('F jS, Y') ?&gt;\n            by &lt;?php the_author() ?&gt;\n\n            &lt;!-- displays the user's photo and then thumbnail --&gt;\n            &lt;?php userphoto_the_author_photo() ?&gt;\n            &lt;?php userphoto_the_author_thumbnail() ?&gt;\n\n            &lt;!-- the following two do the same since $authordata populated --&gt;\n            &lt;?php userphoto($authordata) ?&gt;\n            &lt;?php userphoto_thumbnail($authordata) ?&gt;\n\n            &lt;!-- and this is how to customize the output --&gt;\n            &lt;?php userphoto_the_author_photo(\n                '&lt;b&gt;Photo of me: ',\n                '&lt;\/b&gt;',\n                array('class' =&gt; 'photo'),\n                get_template_directory_uri() . '\/nophoto.jpg'\n            ) ?&gt;\n        &lt;\/div&gt;\n        &lt;?php the_content('Read the rest of this entry &amp;raquo;'); ?&gt;\n    &lt;\/div&gt;\n&lt;?php endwhile; ?&gt;\n<\/code><\/pre>\n\n<p>If you want to display the user's photo in the sidebar, just get the user ID or object and pass it into <code>userphoto()<\/code> or <code>userphoto_thumbnail()<\/code> like this:<\/p>\n\n<pre><code>&lt;?php userphoto($posts[0]-&gt;post_author); ?&gt;\n<\/code><\/pre>\n\n<p>If you want to display a user's photo their author page, you may do this:<\/p>\n\n<pre><code>&lt;?php userphoto($wp_query-&gt;get_queried_object()) ?&gt;\n<\/code><\/pre>\n\n<p>In version 0.9 the boolean function <code>userphoto_exists($user)<\/code> has been introduced which returns true if the user has a photo and false if they do not.\nArgument <code>$user<\/code> may be user object, ID, or login name. This function can be used along with avatars:<\/p>\n\n<pre><code>&lt;?php\nif(userphoto_exists($user))\n    userphoto($user);\nelse\n    echo get_avatar($user-&gt;ID, 96);\n?&gt;\n<\/code><\/pre>\n\n<p>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:<\/p>\n\n<pre><code>&lt;?php\n\/\/this will display the user's avatar if they don't have a user photo,\n\/\/  and if \"Serve Avatar as Fallback\" is turned on\nuserphoto($user);\n?&gt;\n<\/code><\/pre>\n\n<p>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\"\noption is enabled:<\/p>\n\n<pre><code>&lt;?php\n\/\/both will display the user photo if it exists\n\/\/  and if \"Override Avatar with User Photo\" is turned on\necho get_avatar($user_id);\necho get_avatar($user-&gt;user_email);\n?&gt;\n<\/code><\/pre>\n\n<p>Both options \"Serve Avatar as Fallback\" and \"Override Avatar with User Photo\" require that the 'Avatar Display' setting under Discussion be set to \"Show\".<\/p>\n\n<p>Uploaded images may be moderated by administrators via the \"Edit User\" page.<\/p>\n\n<p>Localizations included for Spanish, German, Dutch, Polish, Russian, French, Hungarian, Brazilian Portuguese, Italian, and Catalan.<\/p>\n\n<p>If you value this plugin, <em>please donate<\/em> to ensure that it may continue to be maintained and improved.<\/p>\n\n<!--section=changelog-->\n<h4>0.9.10<\/h4>\n\n<ul>\n<li>Added recommendation to upgrade in wp-admin\/plugins.php<\/li>\n<li>Provided option to never see the upgrade notice again<\/li>\n<\/ul>\n\n<h4>0.9.9<\/h4>\n\n<ul>\n<li>Removed deprecated mysql_ function<\/li>\n<\/ul>\n\n<h4>0.9.8<\/h4>\n\n<ul>\n<li>Optimised retrieval of administrators for settings page<\/li>\n<\/ul>\n\n<h4>0.9.7<\/h4>\n\n<ul>\n<li>Fixed WordPress deprecated notices<\/li>\n<\/ul>\n\n<h4>0.9.6<\/h4>\n\n<ul>\n<li>Fixed PHP notice about deprecated argument<\/li>\n<li>Use semantic versioning for plugin files<\/li>\n<\/ul>\n\n<h4>2012-05-08: 0.9.5.2<\/h4>\n\n<ul>\n<li>Security issue (credit Ryan Hellyer).<\/li>\n<\/ul>\n\n<h4>2011-02-17: 0.9.5<\/h4>\n\n<ul>\n<li>Fixing major security issue (credit ADVtools SARL).<\/li>\n<\/ul>\n\n<h4>2009-7-28<\/h4>\n\n<ul>\n<li>Fixed a small bug relating to line 453 changing \"home\" to \"siteurl\". Thanks Piotr!<\/li>\n<\/ul>\n\n<h4>2009-02-13<\/h4>\n\n<ul>\n<li><p>Added Catalan localization. Thanks Robert!<\/p><\/li>\n<li><p>2009-02-28 =<\/p><\/li>\n<li><p>Added Italian localization. Thanks Federico!<\/p><\/li>\n<\/ul>\n\n<h4>2009-02-17<\/h4>\n\n<ul>\n<li>Added Brazilian Portuguese localization. Thanks gui!<\/li>\n<\/ul>\n\n<h4>2009-01-07<\/h4>\n\n<ul>\n<li>Added Hungarian localization. Thanks Csaba!<\/li>\n<\/ul>\n\n<h4>2008-12-11<\/h4>\n\n<ul>\n<li>Added French localization. Thanks Jean-Pierre!<\/li>\n<\/ul>\n\n<h4>2008-11-14: 0.9.4<\/h4>\n\n<ul>\n<li>Now displaying error message if <code>wp_upload_dir()<\/code> fails when trying to display a user photo.<\/li>\n<\/ul>\n\n<h4>2008-11-14: 0.9.3<\/h4>\n\n<ul>\n<li>Forcing the uploaded filename to lower-case<\/li>\n<\/ul>\n\n<h4>2008-11-03: 0.9.2<\/h4>\n\n<ul>\n<li>Updated error message to include results for <code>wp_upload_dir()<\/code><\/li>\n<\/ul>\n\n<h4>2008-09-22: 0.9.1<\/h4>\n\n<ul>\n<li>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.<\/li>\n<\/ul>\n\n<h4>2008-09-22: 0.9<\/h4>\n\n<ul>\n<li>First argument to <code>userphoto()<\/code> and <code>userphoto_thumbnail()<\/code> may now just be a user ID or user login name in addition to a user object.<\/li>\n<li>New \"Serve Avatar as Fallback\" option; this is disabled by default.<\/li>\n<li>New boolean function <code>userphoto_exists($user)<\/code> which returns true if the user has a photo and false if they do not. Argument <code>$user<\/code> may be user object, ID, or login name.<\/li>\n<li>New option \"Override Avatar with User Photo\"; disabled by default.<\/li>\n<li>Adding <code>class=\"photo\"<\/code> by default if no class attribute is supplied<\/li>\n<li>Fixed issue where thumbnail (and associated usermeta) wasn't being deleted along with the full-size photo (thanks Oliver).<\/li>\n<li>Now using <code>wp_upload_dir()<\/code> to get the basedir for where the userphoto directory will be located. <\/li>\n<\/ul>\n\n<h4>2008-08-01: 0.8.2<\/h4>\n\n<ul>\n<li>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.<\/li>\n<\/ul>\n\n<h4>2008-05-29: 0.8.1<\/h4>\n\n<ul>\n<li>Added localization for Russian (thanks Kyr!)<\/li>\n<\/ul>\n\n<h4>2008-05-17: 0.8.1<\/h4>\n\n<ul>\n<li>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 <code>userphoto()<\/code> and <code>userphoto_thumbnail()<\/code> template tags.<\/li>\n<\/ul>\n\n<h4>2008-04-23: 0.8.0.5<\/h4>\n\n<ul>\n<li>Added localization for Polish (thanks Maciej!)<\/li>\n<\/ul>\n\n<h4>2008-04-04: 0.8.0.4<\/h4>\n\n<ul>\n<li>Fixed issue where incorrect path was being generated for default photo.<\/li>\n<\/ul>\n\n<h4>2008-04-04: 0.8.0.3<\/h4>\n\n<ul>\n<li>Using <code>wp_mail<\/code> instead of <code>mail<\/code> (Thanks again, Kyle.)<\/li>\n<\/ul>\n\n<h4>2008-03-28: 0.8.0.2b<\/h4>\n\n<ul>\n<li>Ensured that \"unapproved\" photos are not displayed. (Thanks Kyle.)<\/li>\n<\/ul>\n\n<h4>2008-02-24: 0.8.0.2<\/h4>\n\n<ul>\n<li>Made minor improvement to security.<\/li>\n<\/ul>\n\n<h4>2008-02-13: 0.8.0.1<\/h4>\n\n<ul>\n<li>Removed <code>print_r()<\/code> from being called when using <code>$default_src<\/code> (thanks David!)<\/li>\n<\/ul>\n\n<h4>2008-02-04: 0.8<\/h4>\n\n<ul>\n<li>Allow before and after text to be outputted when there is a user photo.<\/li>\n<li>Allow attributes to be passed into template tags, including a default SRC value to be used when there is no user photo.<\/li>\n<li>Added Dutch localization translated by Joep Stender (thanks!)<\/li>\n<\/ul>\n\n<h4>2008-01-07: 0.7.4b<\/h4>\n\n<ul>\n<li>Added German localization translated by Robert Harm (thanks!)<\/li>\n<\/ul>\n\n<h4>2008-01-06: 0.7.4<\/h4>\n\n<ul>\n<li>Added support for localization and added Spanish localization translated by Pakus (thanks!)<\/li>\n<\/ul>\n\n<h4>2008-01-02: 0.7.3<\/h4>\n\n<ul>\n<li>Fixed issue where the post author photo was inadvertently used for non-registered comment author photos.<\/li>\n<\/ul>\n\n<h4>2007-12-28: 0.7.2<\/h4>\n\n<ul>\n<li>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.<\/li>\n<li>Improved the plugin activation handler.<\/li>\n<li>All uploaded images are now explicitly set to chmod 666.<\/li>\n<\/ul>\n\n<h4>2007-12-22: 0.7.1<\/h4>\n\n<ul>\n<li>All functions (and template tags) now are prefixed with \"userphoto_\"<\/li>\n<\/ul>\n\n<h4>2007-12-18: 0.7.0.1<\/h4>\n\n<ul>\n<li>Now using <code>siteurl<\/code> option instead of <code>home<\/code> option<\/li>\n<li>Fixed the inclusion of the stylesheet for the options page<\/li>\n<\/ul>\n\n<h4>Todo<\/h4>\n\n<ol>\n<li>When changing the authorization level, all previous users' photos should be automatically approved if they meet the minimum user level<\/li>\n<li>Include a get_userphoto() and get_userphoto_thumbnail() ?<\/li>\n<li>Add a management page to allow admins to quickly approve\/reject user photos.<\/li>\n<li>Add option so that when a photo is rejected, the user is notified.<\/li>\n<li>Restrict image types acceptable?<\/li>\n<li>Add an option to indicate a default photo to be used when none supplied.<\/li>\n<\/ol>","raw_excerpt":"Allows a user to associate a photo with their account and for this photo to be displayed in their posts and comments.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/kir.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/617","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kir.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/kir.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/kir.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=617"}],"author":[{"embeddable":true,"href":"https:\/\/kir.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/westonruter"}],"wp:attachment":[{"href":"https:\/\/kir.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=617"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/kir.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=617"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/kir.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=617"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/kir.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=617"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/kir.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=617"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/kir.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=617"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}