Version Description
- Released 2019-07-14
- Added top level navigation menu in anticipation for User Profile Picture Enhanced.
- Adding more filters for third-party plugin integration.
Download this release
Release Info
| Developer | ronalfy |
| Plugin | |
| Version | 2.3.2 |
| Comparing to | |
| See all releases | |
Code changes from version 2.3.0 to 2.3.2
- metronet-profile-picture.php +30 -13
- readme.txt +9 -1
metronet-profile-picture.php
CHANGED
|
@@ -4,7 +4,7 @@ Plugin Name: User 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: Ronald Huereca
|
| 7 |
-
Version: 2.3.
|
| 8 |
Requires at least: 3.5
|
| 9 |
Author URI: https://www.mediaron.com
|
| 10 |
Contributors: ronalfy
|
|
@@ -12,7 +12,7 @@ Text Domain: metronet-profile-picture
|
|
| 12 |
Domain Path: /languages
|
| 13 |
*/
|
| 14 |
|
| 15 |
-
define( 'METRONET_PROFILE_PICTURE_VERSION', '2.3.
|
| 16 |
define( 'METRONET_PROFILE_PICTURE_PLUGIN_NAME', 'User Profile Picture' );
|
| 17 |
define( 'METRONET_PROFILE_PICTURE_DIR', plugin_dir_path( __FILE__ ) );
|
| 18 |
define( 'METRONET_PROFILE_PICTURE_URL', plugins_url( '/', __FILE__ ) );
|
|
@@ -128,13 +128,14 @@ class Metronet_Profile_Picture {
|
|
| 128 |
*
|
| 129 |
*/
|
| 130 |
public function register_settings_menu() {
|
| 131 |
-
$hook =
|
| 132 |
-
'options-general.php',
|
| 133 |
__( 'User Profile Picture', 'metronet-profile-picture' ),
|
| 134 |
__( 'User Profile Picture', 'metronet-profile-picture' ),
|
| 135 |
'manage_options',
|
| 136 |
'mpp',
|
| 137 |
-
array( $this, 'admin_page' )
|
|
|
|
|
|
|
| 138 |
);
|
| 139 |
}
|
| 140 |
|
|
@@ -181,8 +182,10 @@ class Metronet_Profile_Picture {
|
|
| 181 |
*
|
| 182 |
* @since 2.3.0
|
| 183 |
*
|
|
|
|
|
|
|
| 184 |
*/
|
| 185 |
-
do_action( 'mpp_user_profile_admin_settings_after_row' );
|
| 186 |
?>
|
| 187 |
</tbody>
|
| 188 |
</table>
|
|
@@ -192,8 +195,10 @@ class Metronet_Profile_Picture {
|
|
| 192 |
*
|
| 193 |
* @since 2.3.0
|
| 194 |
*
|
|
|
|
|
|
|
| 195 |
*/
|
| 196 |
-
do_action( 'mpp_user_profile_admin_settings_after_table' );
|
| 197 |
?>
|
| 198 |
<?php submit_button( __( 'Save Options', 'metronet-profile-picture' ) ); ?>
|
| 199 |
</form>
|
|
@@ -227,7 +232,7 @@ class Metronet_Profile_Picture {
|
|
| 227 |
* @param array $options array of options to save
|
| 228 |
* @return void
|
| 229 |
*/
|
| 230 |
-
|
| 231 |
$options = wp_unslash( $options );
|
| 232 |
foreach ( $options as $key => &$option ) {
|
| 233 |
switch ( $key ) {
|
|
@@ -260,6 +265,16 @@ class Metronet_Profile_Picture {
|
|
| 260 |
$defaults = array(
|
| 261 |
'load_gutenberg' => 'on',
|
| 262 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 263 |
return $defaults;
|
| 264 |
}
|
| 265 |
|
|
@@ -652,9 +667,9 @@ class Metronet_Profile_Picture {
|
|
| 652 |
*@return int user_id
|
| 653 |
*
|
| 654 |
*/
|
| 655 |
-
|
| 656 |
//Get user ID
|
| 657 |
-
$user_id = isset( $_GET['user_id'] ) ? absint( $_GET['user_id'] ) : 0;
|
| 658 |
if ( 0 === $user_id && IS_PROFILE_PAGE ) {
|
| 659 |
$current_user = wp_get_current_user();
|
| 660 |
$user_id = $current_user->ID;
|
|
@@ -726,7 +741,7 @@ class Metronet_Profile_Picture {
|
|
| 726 |
public function plugin_settings_link( $settings ) {
|
| 727 |
$admin_anchor = sprintf(
|
| 728 |
'<a href="%s">%s</a>',
|
| 729 |
-
esc_url( admin_url( '
|
| 730 |
esc_html__( 'Settings', 'metronet-profile-picture' )
|
| 731 |
);
|
| 732 |
if ( ! defined( 'USER_PROFILE_PICTURE_ENHANCED' ) ) {
|
|
@@ -822,7 +837,7 @@ class Metronet_Profile_Picture {
|
|
| 822 |
* @since 2.3.0
|
| 823 |
*
|
| 824 |
*/
|
| 825 |
-
do_action( 'mpp_user_profile_form' );
|
| 826 |
} //end insert_upload_form
|
| 827 |
|
| 828 |
/**
|
|
@@ -1277,6 +1292,8 @@ class Metronet_Profile_Picture {
|
|
| 1277 |
}
|
| 1278 |
check_admin_referer( 'update-user_' . $user_id );
|
| 1279 |
|
|
|
|
|
|
|
| 1280 |
$user_avatar = $_POST['metronet-user-avatar'];
|
| 1281 |
if ( 'on' === $user_avatar ) {
|
| 1282 |
update_user_option( $user_id, 'metronet_avatar_override', 'on' );
|
|
@@ -1290,7 +1307,7 @@ class Metronet_Profile_Picture {
|
|
| 1290 |
global $mt_pp;
|
| 1291 |
if ( class_exists( 'Metronet_Profile_Picture' ) ) {
|
| 1292 |
if ( get_bloginfo( 'version' ) >= '3.5' ) {
|
| 1293 |
-
add_action( 'plugins_loaded', 'mt_mpp_instantiate' );
|
| 1294 |
}
|
| 1295 |
}
|
| 1296 |
function mt_mpp_instantiate() {
|
| 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: Ronald Huereca
|
| 7 |
+
Version: 2.3.2
|
| 8 |
Requires at least: 3.5
|
| 9 |
Author URI: https://www.mediaron.com
|
| 10 |
Contributors: ronalfy
|
| 12 |
Domain Path: /languages
|
| 13 |
*/
|
| 14 |
|
| 15 |
+
define( 'METRONET_PROFILE_PICTURE_VERSION', '2.3.2' );
|
| 16 |
define( 'METRONET_PROFILE_PICTURE_PLUGIN_NAME', 'User Profile Picture' );
|
| 17 |
define( 'METRONET_PROFILE_PICTURE_DIR', plugin_dir_path( __FILE__ ) );
|
| 18 |
define( 'METRONET_PROFILE_PICTURE_URL', plugins_url( '/', __FILE__ ) );
|
| 128 |
*
|
| 129 |
*/
|
| 130 |
public function register_settings_menu() {
|
| 131 |
+
$hook = add_menu_page(
|
|
|
|
| 132 |
__( 'User Profile Picture', 'metronet-profile-picture' ),
|
| 133 |
__( 'User Profile Picture', 'metronet-profile-picture' ),
|
| 134 |
'manage_options',
|
| 135 |
'mpp',
|
| 136 |
+
array( $this, 'admin_page' ),
|
| 137 |
+
'dashicons-groups',
|
| 138 |
+
100
|
| 139 |
);
|
| 140 |
}
|
| 141 |
|
| 182 |
*
|
| 183 |
* @since 2.3.0
|
| 184 |
*
|
| 185 |
+
* @param array $options Array of options.
|
| 186 |
+
*
|
| 187 |
*/
|
| 188 |
+
do_action( 'mpp_user_profile_admin_settings_after_row', $options );
|
| 189 |
?>
|
| 190 |
</tbody>
|
| 191 |
</table>
|
| 195 |
*
|
| 196 |
* @since 2.3.0
|
| 197 |
*
|
| 198 |
+
* @param array $options Array of options.
|
| 199 |
+
*
|
| 200 |
*/
|
| 201 |
+
do_action( 'mpp_user_profile_admin_settings_after_table', $options );
|
| 202 |
?>
|
| 203 |
<?php submit_button( __( 'Save Options', 'metronet-profile-picture' ) ); ?>
|
| 204 |
</form>
|
| 232 |
* @param array $options array of options to save
|
| 233 |
* @return void
|
| 234 |
*/
|
| 235 |
+
public function update_options( $options ) {
|
| 236 |
$options = wp_unslash( $options );
|
| 237 |
foreach ( $options as $key => &$option ) {
|
| 238 |
switch ( $key ) {
|
| 265 |
$defaults = array(
|
| 266 |
'load_gutenberg' => 'on',
|
| 267 |
);
|
| 268 |
+
|
| 269 |
+
/**
|
| 270 |
+
* Allow other plugins to add to the defaults.
|
| 271 |
+
*
|
| 272 |
+
* @since 2.3.1
|
| 273 |
+
*
|
| 274 |
+
* @param array $defaults An array of option defaults.
|
| 275 |
+
*
|
| 276 |
+
*/
|
| 277 |
+
$defaults = apply_filters( 'mpp_options_defaults', $defaults );
|
| 278 |
return $defaults;
|
| 279 |
}
|
| 280 |
|
| 667 |
*@return int user_id
|
| 668 |
*
|
| 669 |
*/
|
| 670 |
+
public function get_user_id() {
|
| 671 |
//Get user ID
|
| 672 |
+
$user_id = isset( $_GET['user_id'] ) ? absint( $_GET['user_id'] ) : 0; // phpcs:ignore
|
| 673 |
if ( 0 === $user_id && IS_PROFILE_PAGE ) {
|
| 674 |
$current_user = wp_get_current_user();
|
| 675 |
$user_id = $current_user->ID;
|
| 741 |
public function plugin_settings_link( $settings ) {
|
| 742 |
$admin_anchor = sprintf(
|
| 743 |
'<a href="%s">%s</a>',
|
| 744 |
+
esc_url( admin_url( 'admin.php?page=mpp' ) ),
|
| 745 |
esc_html__( 'Settings', 'metronet-profile-picture' )
|
| 746 |
);
|
| 747 |
if ( ! defined( 'USER_PROFILE_PICTURE_ENHANCED' ) ) {
|
| 837 |
* @since 2.3.0
|
| 838 |
*
|
| 839 |
*/
|
| 840 |
+
do_action( 'mpp_user_profile_form', $user_id );
|
| 841 |
} //end insert_upload_form
|
| 842 |
|
| 843 |
/**
|
| 1292 |
}
|
| 1293 |
check_admin_referer( 'update-user_' . $user_id );
|
| 1294 |
|
| 1295 |
+
flush_rewrite_rules( true );
|
| 1296 |
+
|
| 1297 |
$user_avatar = $_POST['metronet-user-avatar'];
|
| 1298 |
if ( 'on' === $user_avatar ) {
|
| 1299 |
update_user_option( $user_id, 'metronet_avatar_override', 'on' );
|
| 1307 |
global $mt_pp;
|
| 1308 |
if ( class_exists( 'Metronet_Profile_Picture' ) ) {
|
| 1309 |
if ( get_bloginfo( 'version' ) >= '3.5' ) {
|
| 1310 |
+
add_action( 'plugins_loaded', 'mt_mpp_instantiate', 10 );
|
| 1311 |
}
|
| 1312 |
}
|
| 1313 |
function mt_mpp_instantiate() {
|
readme.txt
CHANGED
|
@@ -3,7 +3,7 @@ Contributors: ronalfy, Alaadiaa
|
|
| 3 |
Tags: users, user profile, gravatar, avatar, blocks, block
|
| 4 |
Requires at least: 3.5
|
| 5 |
Tested up to: 5.2
|
| 6 |
-
Stable tag: 2.3.
|
| 7 |
Requires PHP: 5.6
|
| 8 |
License: GPLv2 or later
|
| 9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
|
@@ -126,6 +126,11 @@ Yes, but you'll have to set a new profile image per site. This is currently a l
|
|
| 126 |
|
| 127 |
== Changelog ==
|
| 128 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 129 |
= 2.3.0 =
|
| 130 |
* Released 2019-07-06
|
| 131 |
* Gutenberg blocks are now in the User Profile Picture category.
|
|
@@ -321,6 +326,9 @@ Yes, but you'll have to set a new profile image per site. This is currently a l
|
|
| 321 |
|
| 322 |
== Upgrade Notice ==
|
| 323 |
|
|
|
|
|
|
|
|
|
|
| 324 |
= 2.3.0 =
|
| 325 |
Gutenberg blocks are now in the User Profile Picture category. New filters for add-on extensibility. Added Options page so you can disable the Gutenberg blocks if you so desire. Bug fix: Adding user display name to post title when User Profile Picture creates the user page.
|
| 326 |
|
| 3 |
Tags: users, user profile, gravatar, avatar, blocks, block
|
| 4 |
Requires at least: 3.5
|
| 5 |
Tested up to: 5.2
|
| 6 |
+
Stable tag: 2.3.2
|
| 7 |
Requires PHP: 5.6
|
| 8 |
License: GPLv2 or later
|
| 9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 126 |
|
| 127 |
== Changelog ==
|
| 128 |
|
| 129 |
+
= 2.3.2 =
|
| 130 |
+
* Released 2019-07-14
|
| 131 |
+
* Added top level navigation menu in anticipation for User Profile Picture Enhanced.
|
| 132 |
+
* Adding more filters for third-party plugin integration.
|
| 133 |
+
|
| 134 |
= 2.3.0 =
|
| 135 |
* Released 2019-07-06
|
| 136 |
* Gutenberg blocks are now in the User Profile Picture category.
|
| 326 |
|
| 327 |
== Upgrade Notice ==
|
| 328 |
|
| 329 |
+
= 2.3.2 =
|
| 330 |
+
Added top level navigation menu in anticipation for User Profile Picture Enhanced. Adding more filters for third-party plugin integration.
|
| 331 |
+
|
| 332 |
= 2.3.0 =
|
| 333 |
Gutenberg blocks are now in the User Profile Picture category. New filters for add-on extensibility. Added Options page so you can disable the Gutenberg blocks if you so desire. Bug fix: Adding user display name to post title when User Profile Picture creates the user page.
|
| 334 |
|
