- Fixed "get_profile_photo_size" function (avoid PHP notice with array_combine )

- Fixed password reset/change form when other forms are initialized at the same page
  - Fixed getting extension updates on multisites
  - Deprecated JS event 'um_before_modal_removed', use wp.hooks action 'um_before_modal_removed' instead
This commit is contained in:
nikitasinelnikov
2020-07-06 14:20:29 +03:00
parent af4a53a9fb
commit 2dad3d2704
11 changed files with 73 additions and 31 deletions
+1 -1
View File
@@ -698,7 +698,7 @@ function prepare_Modal() {
function remove_Modal() {
if ( jQuery('.um-popup-overlay').length ) {
jQuery( document ).trigger( 'um_before_modal_removed' );
wp.hooks.doAction( 'um_before_modal_removed', jQuery('.um-popup') );
jQuery('.tipsy').remove();
jQuery('.um-popup').empty().remove();
+1 -1
View File
File diff suppressed because one or more lines are too long
+24 -6
View File
@@ -211,6 +211,10 @@ if ( ! class_exists( 'UM' ) ) {
//run activation
register_activation_hook( um_plugin, array( &$this, 'activation' ) );
if ( is_multisite() && ! defined( 'DOING_AJAX' ) ) {
add_action( 'wp_loaded', array( $this, 'maybe_network_activation' ) );
}
// init widgets
add_action( 'widgets_init', array( &$this, 'widgets_init' ) );
@@ -441,11 +445,27 @@ if ( ! class_exists( 'UM' ) ) {
* @since 2.0
*/
function activation() {
$this->single_site_activation();
if ( is_multisite() ) {
if ( ! is_plugin_active_for_network( um_plugin ) ) {
$this->single_site_activation();
} else {
//get all blogs
update_network_option( get_current_network_id(), 'um_maybe_network_wide_activation', 1 );
}
}
/**
* Maybe need multisite activation process
*
* @since 2.1.7
*/
function maybe_network_activation() {
$maybe_activation = get_network_option( get_current_network_id(), 'um_maybe_network_wide_activation' );
if ( $maybe_activation ) {
delete_network_option( get_current_network_id(), 'um_maybe_network_wide_activation' );
if ( is_plugin_active_for_network( um_plugin ) ) {
// get all blogs
$blogs = get_sites();
if ( ! empty( $blogs ) ) {
foreach( $blogs as $blog ) {
@@ -456,8 +476,6 @@ if ( ! class_exists( 'UM' ) ) {
}
}
}
} else {
$this->single_site_activation();
}
}
+12 -2
View File
@@ -2332,7 +2332,12 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
}
$output .= '<input class="' . $this->get_class( $key, $data ) . '" type="' . esc_attr( $input ) . '" name="' . esc_attr( $key . UM()->form()->form_suffix ) . '" id="' . esc_attr( $key . UM()->form()->form_suffix ) . '" value="' . $this->field_value( $key, $default, $data ) . '" placeholder="' . esc_attr( $placeholder ) . '" data-validate="' . esc_attr( $validate ) . '" data-key="' . esc_attr( $key ) . '" />
$name = $key . UM()->form()->form_suffix;
if ( $this->set_mode == 'password' && um_is_core_page( 'password-reset' ) ) {
$name = $key;
}
$output .= '<input class="' . $this->get_class( $key, $data ) . '" type="' . esc_attr( $input ) . '" name="' . esc_attr( $name ) . '" id="' . esc_attr( $key . UM()->form()->form_suffix ) . '" value="' . $this->field_value( $key, $default, $data ) . '" placeholder="' . esc_attr( $placeholder ) . '" data-validate="' . esc_attr( $validate ) . '" data-key="' . esc_attr( $key ) . '" />
</div>';
@@ -2361,7 +2366,12 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
}
$output .= '<input class="' . $this->get_class( $key, $data ) . '" type="' . esc_attr( $input ) . '" name="' . esc_attr( $key . UM()->form()->form_suffix ) . '" id="' . esc_attr( $key . UM()->form()->form_suffix ) . '" value="' . $this->field_value( $key, $default, $data ) . '" placeholder="' . esc_attr( $placeholder ) . '" data-validate="' . esc_attr( $validate ) . '" data-key="' . esc_attr( $key ) . '" />
$name = $key . UM()->form()->form_suffix;
if ( $this->set_mode == 'password' && um_is_core_page( 'password-reset' ) ) {
$name = $key;
}
$output .= '<input class="' . $this->get_class( $key, $data ) . '" type="' . esc_attr( $input ) . '" name="' . esc_attr( $name ) . '" id="' . esc_attr( $key . UM()->form()->form_suffix ) . '" value="' . $this->field_value( $key, $default, $data ) . '" placeholder="' . esc_attr( $placeholder ) . '" data-validate="' . esc_attr( $validate ) . '" data-key="' . esc_attr( $key ) . '" />
</div>';
+13 -9
View File
@@ -1274,19 +1274,23 @@ if ( ! class_exists( 'um\core\Files' ) ) {
function get_profile_photo_size( $type ) {
$sizes = UM()->options()->get( $type );
$sizes = array_combine( $sizes, $sizes );
if ( ! empty( $sizes ) && is_array( $sizes ) ) {
$sizes = array_combine( $sizes, $sizes );
if ( $type == 'cover_thumb_sizes' ) {
foreach ( $sizes as $key => $value ) {
$sizes[ $key ] = $value . 'px';
}
} elseif ( $type == 'photo_thumb_sizes' ) {
foreach ( $sizes as $key => $value ) {
$sizes[ $key ] = $value . 'x' . $value . 'px';
if ( $type == 'cover_thumb_sizes' ) {
foreach ( $sizes as $key => $value ) {
$sizes[ $key ] = $value . 'px';
}
} elseif ( $type == 'photo_thumb_sizes' ) {
foreach ( $sizes as $key => $value ) {
$sizes[ $key ] = $value . 'x' . $value . 'px';
}
}
} else {
$sizes = array();
$sizes['original'] = __( 'Original size', 'ultimate-member' );
}
$sizes['original'] = __( 'Original size', 'ultimate-member' );
return $sizes;
}
-6
View File
@@ -355,16 +355,10 @@ if ( ! class_exists( 'um\core\Plugin_Updater' ) ) {
* @return \stdClass modified plugin update array.
*/
function check_update( $_transient_data ) {
global $pagenow;
if ( ! is_object( $_transient_data ) ) {
$_transient_data = new \stdClass;
}
if ( 'plugins.php' == $pagenow && is_multisite() ) {
return $_transient_data;
}
$exts = $this->get_active_plugins();
foreach ( $exts as $slug => $data ) {
+1 -1
View File
@@ -19,7 +19,7 @@ if ( ! class_exists( 'um\core\Rewrite' ) ) {
*/
function __construct() {
if ( ! defined( 'DOING_AJAX' ) ) {
add_filter( 'wp_loaded', array( $this, 'maybe_flush_rewrite_rules' ) );
add_action( 'wp_loaded', array( $this, 'maybe_flush_rewrite_rules' ) );
}
//add rewrite rules
+11 -4
View File
@@ -722,16 +722,23 @@ function um_profile_field_filter_xss_validation( $value, $data, $type = '' ) {
*/
$option_pairs = apply_filters( 'um_select_options_pair', null, $data );
$arr = empty( $data['options'] ) ? array() : $data['options'];
$array = empty( $data['options'] ) ? array() : $data['options'];
if ( $data['metakey'] == 'country' && empty( $array ) ) {
$array = UM()->builtin()->get( 'countries' );
}
if ( $option_pairs ) {
$arr = array_keys( $arr );
$arr = array_keys( $array );
} else {
$arr = $array;
}
if ( ! empty( $arr ) && ! in_array( $value, array_map( 'trim', $arr ) ) && empty( $data['custom_dropdown_options_source'] ) ) {
$value = '';
} else {
if ( $option_pairs && isset( $data['options'] ) && is_array( $data['options'] ) && isset( $data['options'][ $value ] ) ) {
$value = $data['options'][ $value ];
if ( $option_pairs && is_array( $array ) && isset( $array[ $value ] ) ) {
$value = $array[ $value ];
}
}
}
+7
View File
@@ -145,6 +145,13 @@ The plugin works with popular caching plugins by automatically excluding Ultimat
* To learn more about version 2.1 please see this [docs](https://docs.ultimatemember.com/article/1512-upgrade-2-1-0)
* UM2.1+ is a significant update to the Member Directories' code base from 2.0.x. Please make sure you take a full-site backup with restore point before updating the plugin
= 2.1.7: July xx, 2020 =
- Fixed "get_profile_photo_size" function (avoid PHP notice with array_combine )
- Fixed password reset/change form when other forms are initialized at the same page
- Fixed getting extension updates on multisites
- Deprecated JS event 'um_before_modal_removed', use wp.hooks action 'um_before_modal_removed' instead
= 2.1.6: June 1, 2020 =
* Enhancements:
+2
View File
@@ -33,6 +33,8 @@
$fields = UM()->builtin()->get_specific_fields( 'user_password' );
UM()->fields()->set_mode = 'password';
$output = null;
foreach ( $fields as $key => $data ) {
$output .= UM()->fields()->edit_field( $key, $data );
+1 -1
View File
@@ -3,7 +3,7 @@
Plugin Name: Ultimate Member
Plugin URI: http://ultimatemember.com/
Description: The easiest way to create powerful online communities and beautiful user profiles with WordPress
Version: 2.1.6
Version: 2.1.7
Author: Ultimate Member
Author URI: http://ultimatemember.com/
Text Domain: ultimate-member