Version Description
- Bug fix: Not able to "uncheck" Override Avatar.
- Bug fix: Deleting profile image and not reverting to normal avatar.
Download this release
Release Info
| Developer | ronalfy |
| Plugin | |
| Version | 1.0.1 |
| Comparing to | |
| See all releases | |
Code changes from version 1.0.0 to 1.0.1
- metronet-profile-picture.php +14 -4
- readme.txt +19 -1
metronet-profile-picture.php
CHANGED
|
@@ -4,7 +4,7 @@ Plugin Name: Metronet Profile Picture
|
|
| 4 |
Plugin URI: http://wordpress.org/extend/plugins/metronet-profile-picture/
|
| 5 |
Description: Use the native WP uploader on your user profile page.
|
| 6 |
Author: Metronet
|
| 7 |
-
Version: 1.0.
|
| 8 |
Requires at least: 3.3
|
| 9 |
Author URI: http://www.metronet.no
|
| 10 |
Contributors: ronalfy, metronet
|
|
@@ -123,12 +123,15 @@ class Metronet_Profile_Picture {
|
|
| 123 |
$avatar_override = get_user_meta( $user_id, 'metronet_avatar_override', true );
|
| 124 |
if ( !$avatar_override || $avatar_override != 'on' ) return $avatar;
|
| 125 |
|
| 126 |
-
|
|
|
|
|
|
|
| 127 |
'size' => array( $size, $size ),
|
| 128 |
'attr' => array( 'alt' => $alt ),
|
| 129 |
'echo' => false )
|
| 130 |
);
|
| 131 |
-
return $avatar;
|
|
|
|
| 132 |
} //end avatar_override
|
| 133 |
|
| 134 |
/**
|
|
@@ -320,8 +323,9 @@ class Metronet_Profile_Picture {
|
|
| 320 |
}
|
| 321 |
?>
|
| 322 |
</div><!-- #metronet-profile-image -->
|
| 323 |
-
<div id="metronet-upload-link"><?php echo $upload_link; ?></div><!-- #metronet-upload-link -->
|
| 324 |
<div id="metronet-override-avatar">
|
|
|
|
| 325 |
<input type="checkbox" name="metronet-user-avatar" id="metronet-user-avatar" value="on" <?php checked( "on", get_user_meta( $user_id, 'metronet_avatar_override', true ) ); ?> /><label for="metronet-user-avatar"> <?php esc_html_e( "Override Avatar?", "metronet_profile_picture" ); ?></label>
|
| 326 |
</div><!-- #metronet-override-avatar -->
|
| 327 |
</td>
|
|
@@ -424,6 +428,12 @@ function mt_profile_img( $user_id, $args = array() ) {
|
|
| 424 |
);
|
| 425 |
$args = wp_parse_args( $args, $defaults );
|
| 426 |
extract( $args );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 427 |
$post_thumbnail = get_the_post_thumbnail( $profile_post_id, $size, $attr );
|
| 428 |
if ( $echo ) {
|
| 429 |
echo $post_thumbnail;
|
| 4 |
Plugin URI: http://wordpress.org/extend/plugins/metronet-profile-picture/
|
| 5 |
Description: Use the native WP uploader on your user profile page.
|
| 6 |
Author: Metronet
|
| 7 |
+
Version: 1.0.1
|
| 8 |
Requires at least: 3.3
|
| 9 |
Author URI: http://www.metronet.no
|
| 10 |
Contributors: ronalfy, metronet
|
| 123 |
$avatar_override = get_user_meta( $user_id, 'metronet_avatar_override', true );
|
| 124 |
if ( !$avatar_override || $avatar_override != 'on' ) return $avatar;
|
| 125 |
|
| 126 |
+
//Determine if the user has a profile image
|
| 127 |
+
|
| 128 |
+
$custom_avatar = mt_profile_img( $user_id, array(
|
| 129 |
'size' => array( $size, $size ),
|
| 130 |
'attr' => array( 'alt' => $alt ),
|
| 131 |
'echo' => false )
|
| 132 |
);
|
| 133 |
+
if ( !$custom_avatar ) return $avatar;
|
| 134 |
+
return $custom_avatar;
|
| 135 |
} //end avatar_override
|
| 136 |
|
| 137 |
/**
|
| 323 |
}
|
| 324 |
?>
|
| 325 |
</div><!-- #metronet-profile-image -->
|
| 326 |
+
<div id="metronet-upload-link"><?php echo $upload_link; ?> - <span class="description"><?php esc_html_e( 'Select "Use as featured image" after uploading to choose the profile image', 'metronet_profile_picture' ); ?></span></div><!-- #metronet-upload-link -->
|
| 327 |
<div id="metronet-override-avatar">
|
| 328 |
+
<input type="hidden" name="metronet-user-avatar" value="off" />
|
| 329 |
<input type="checkbox" name="metronet-user-avatar" id="metronet-user-avatar" value="on" <?php checked( "on", get_user_meta( $user_id, 'metronet_avatar_override', true ) ); ?> /><label for="metronet-user-avatar"> <?php esc_html_e( "Override Avatar?", "metronet_profile_picture" ); ?></label>
|
| 330 |
</div><!-- #metronet-override-avatar -->
|
| 331 |
</td>
|
| 428 |
);
|
| 429 |
$args = wp_parse_args( $args, $defaults );
|
| 430 |
extract( $args );
|
| 431 |
+
//Return false or echo nothing if there is no post thumbnail
|
| 432 |
+
if( !has_post_thumbnail( $profile_post_id ) ) {
|
| 433 |
+
if ( $echo ) echo '';
|
| 434 |
+
else return false;
|
| 435 |
+
return;
|
| 436 |
+
}
|
| 437 |
$post_thumbnail = get_the_post_thumbnail( $profile_post_id, $size, $attr );
|
| 438 |
if ( $echo ) {
|
| 439 |
echo $post_thumbnail;
|
readme.txt
CHANGED
|
@@ -3,7 +3,7 @@ Contributors: metronet, ronalfy
|
|
| 3 |
Tags: users, user, user profile
|
| 4 |
Requires at least: 3.3
|
| 5 |
Tested up to: 3.4
|
| 6 |
-
Stable tag: 1.0.
|
| 7 |
License: GPLv2 or later
|
| 8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 9 |
|
|
@@ -18,6 +18,8 @@ Set a custom profile image for a user using the standard WordPress media upload
|
|
| 18 |
2. Activate the plugin through the 'Plugins' menu in WordPress
|
| 19 |
3. Place `<?php mt_profile_img() ?>` in your templates (arguments and usage are below)
|
| 20 |
|
|
|
|
|
|
|
| 21 |
`/**
|
| 22 |
* mt_profile_img
|
| 23 |
*
|
|
@@ -31,6 +33,15 @@ Set a custom profile image for a user using the standard WordPress media upload
|
|
| 31 |
*/
|
| 32 |
`
|
| 33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
== Frequently Asked Questions ==
|
| 35 |
|
| 36 |
= How do you set a user profile image? =
|
|
@@ -56,10 +67,17 @@ We highly recommend the <a href='http://wordpress.org/extend/plugins/post-thumbn
|
|
| 56 |
|
| 57 |
== Changelog ==
|
| 58 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
= 1.0.0 =
|
| 60 |
* Initial release.
|
| 61 |
|
| 62 |
== Upgrade Notice ==
|
| 63 |
|
|
|
|
|
|
|
|
|
|
| 64 |
= 1.0.0 =
|
| 65 |
Initial release.
|
| 3 |
Tags: users, user, user profile
|
| 4 |
Requires at least: 3.3
|
| 5 |
Tested up to: 3.4
|
| 6 |
+
Stable tag: 1.0.1
|
| 7 |
License: GPLv2 or later
|
| 8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 9 |
|
| 18 |
2. Activate the plugin through the 'Plugins' menu in WordPress
|
| 19 |
3. Place `<?php mt_profile_img() ?>` in your templates (arguments and usage are below)
|
| 20 |
|
| 21 |
+
Arguments:
|
| 22 |
+
|
| 23 |
`/**
|
| 24 |
* mt_profile_img
|
| 25 |
*
|
| 33 |
*/
|
| 34 |
`
|
| 35 |
|
| 36 |
+
Example Usage:
|
| 37 |
+
`
|
| 38 |
+
$avatar = mt_profile_img( $user_id, array(
|
| 39 |
+
'size' => 'thumbnail'),
|
| 40 |
+
'attr' => array( 'alt' => 'Alternative Text' ),
|
| 41 |
+
'echo' => false )
|
| 42 |
+
);
|
| 43 |
+
`
|
| 44 |
+
|
| 45 |
== Frequently Asked Questions ==
|
| 46 |
|
| 47 |
= How do you set a user profile image? =
|
| 67 |
|
| 68 |
== Changelog ==
|
| 69 |
|
| 70 |
+
= 1.0.1 =
|
| 71 |
+
* Bug fix: Not able to "uncheck" Override Avatar.
|
| 72 |
+
* Bug fix: Deleting profile image and not reverting to normal avatar.
|
| 73 |
+
|
| 74 |
= 1.0.0 =
|
| 75 |
* Initial release.
|
| 76 |
|
| 77 |
== Upgrade Notice ==
|
| 78 |
|
| 79 |
+
= 1.0.1 =
|
| 80 |
+
Several important bug fixes including the ability to uncheck the avatar override, and the behavior when someone deletes their profile picture.
|
| 81 |
+
|
| 82 |
= 1.0.0 =
|
| 83 |
Initial release.
|
