diff --git a/README.md b/README.md index cb06e481..98b5b271 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Ultimate Member is the #1 user profile & membership plugin for WordPress. The pl | Latest Version |Requires at least|Stable Tag| | :------------: |:------------:|:------------:| -| 2.0.18 | WordPress 4.9 or higher| 2.0.18 | +| 2.0.20 | WordPress 4.9 or higher| 2.0.20 | Features of the plugin include: @@ -48,7 +48,7 @@ GNU Version 2 or Any Later Version Releases ==================== -[Official Release Version: 2.0.18](https://github.com/ultimatemember/ultimatemember/releases/tag/2.0.18). +[Official Release Version: 2.0.20](https://github.com/ultimatemember/ultimatemember/releases/tag/2.0.20). [Official Release Version: 1.3.88](https://github.com/ultimatemember/ultimatemember/releases). diff --git a/includes/admin/assets/css/um-admin-global.css b/includes/admin/assets/css/um-admin-global.css index d11c3289..61855a69 100644 --- a/includes/admin/assets/css/um-admin-global.css +++ b/includes/admin/assets/css/um-admin-global.css @@ -197,4 +197,8 @@ a.um-delete{ color: #a00; } .wp-admin p.um-nav-roles label { margin-top: 2px !important; margin-bottom: 2px !important; +} + +.um_hidden_notice { + display: none; } \ No newline at end of file diff --git a/includes/admin/assets/css/um-admin-misc.css b/includes/admin/assets/css/um-admin-misc.css index eeb376ee..7cb87ec8 100644 --- a/includes/admin/assets/css/um-admin-misc.css +++ b/includes/admin/assets/css/um-admin-misc.css @@ -262,3 +262,5 @@ p.disabled-on-off .um-admin-yesno *{ .um-admin-cur-condition-template { display: none; } + + diff --git a/includes/admin/assets/js/um-admin-field.js b/includes/admin/assets/js/um-admin-field.js index 2bb0c7f9..6fd9c415 100644 --- a/includes/admin/assets/js/um-admin-field.js +++ b/includes/admin/assets/js/um-admin-field.js @@ -29,9 +29,33 @@ jQuery(document).ready(function() { /* Add a Field */ jQuery(document).on('submit', 'form.um_add_field', function(e){ - + e.preventDefault(); - + var conditions = jQuery('.um-admin-cur-condition'); + //need fields refactor + jQuery(conditions).each( function ( i ) { + + if ( jQuery( this ).find('[id^="_conditional_action"]').val() === '' || + jQuery( this ).find('[id^="_conditional_field"]').val() === '' || + jQuery( this ).find('[id^="_conditional_operator"]').val() ==='' ) + { + jQuery(conditions[i]).find('.um-admin-remove-condition').click(); + } + } ); + conditions = jQuery('.um-admin-cur-condition'); + jQuery(conditions).each( function ( i ) { + var id = i === 0 ? '' : i; + + jQuery( this ).find('[id^="_conditional_action"]').attr('name', '_conditional_action' + id); + jQuery( this ).find('[id^="_conditional_action"]').attr('id', '_conditional_action' + id); + jQuery( this ).find('[id^="_conditional_field"]').attr('name', '_conditional_field' + id); + jQuery( this ).find('[id^="_conditional_field"]').attr('id', '_conditional_field' + id); + jQuery( this ).find('[id^="_conditional_operator"]').attr('name', '_conditional_operator' + id); + jQuery( this ).find('[id^="_conditional_operator"]').attr('id', '_conditional_operator' + id); + jQuery( this ).find('[id^="_conditional_value"]').attr('name', '_conditional_value' + id); + jQuery( this ).find('[id^="_conditional_value"]').attr('id', '_conditional_value' + id); + + } ); var form = jQuery(this); jQuery.ajax({ @@ -76,7 +100,7 @@ jQuery(document).ready(function() { }, error: function(data){ - + console.log(data); } }); diff --git a/includes/admin/assets/js/um-admin-global.js b/includes/admin/assets/js/um-admin-global.js new file mode 100644 index 00000000..a7b28e39 --- /dev/null +++ b/includes/admin/assets/js/um-admin-global.js @@ -0,0 +1,70 @@ +jQuery(document).ready(function() { + + + jQuery(document).on('click', '#um_add_review_love', function (e) { + jQuery(this).parents('#um_start_review_notice').hide(); + jQuery('.um_hidden_notice[data-key="love"]').show(); + }); + + + jQuery(document).on('click', '#um_add_review_good', function (e) { + jQuery(this).parents('#um_start_review_notice').hide(); + jQuery('.um_hidden_notice[data-key="good"]').show(); + }); + + + jQuery(document).on('click', '#um_add_review_bad', function (e) { + jQuery(this).parents('#um_start_review_notice').hide(); + jQuery('.um_hidden_notice[data-key="bad"]').show(); + }); + + + jQuery(document).on('click', '.um_review_link', function (e) { + jQuery(this).parents('.um-admin-notice').find( '.notice-dismiss' ).trigger('click'); + }); + + + jQuery(document).on('click', '.um_opt_in_link', function (e) { + jQuery(this).parents('.um-admin-notice').find( '.notice-dismiss' ).trigger('click'); + }); + + + jQuery(document).on('click', '#um_opt_in_start', function (e) { + var dismiss = jQuery(this).parents('.um-admin-notice').find( '.notice-dismiss' ); + jQuery(this).prop('disabled', true).attr('disabled', 'disabled'); + + wp.ajax.send( 'um_opt_in_notice', { + data: { + nonce: um_admin_scripts.nonce + }, + success: function( data ) { + dismiss.trigger('click'); + jQuery(this).prop('disabled', false); + }, + error: function( data ) { + jQuery(this).prop('disabled', false); + return false; + } + }); + }); + + + jQuery(document).on( 'click', '.um-admin-notice.is-dismissible .notice-dismiss', function(e) { + var notice_key = jQuery(this).parents('.um-admin-notice').data('key'); + + wp.ajax.send( 'um_dismiss_notice', { + data: { + key: notice_key, + nonce: um_admin_scripts.nonce + }, + success: function( data ) { + return true; + }, + error: function( data ) { + return false; + } + }); + }); + + +}); \ No newline at end of file diff --git a/includes/admin/assets/js/um-admin-modal.js b/includes/admin/assets/js/um-admin-modal.js index e66995ac..b67d520e 100644 --- a/includes/admin/assets/js/um-admin-modal.js +++ b/includes/admin/assets/js/um-admin-modal.js @@ -190,11 +190,14 @@ jQuery(document).ready(function() { } um_admin_modal_responsive(); }); - + + + /** clone a condition **/ - jQuery(document).on('click', '.um-admin-new-condition', function(){ + jQuery(document).on('click', '.um-admin-new-condition', function() { + if ( jQuery(this).hasClass('disabled') ) return false; @@ -205,18 +208,12 @@ jQuery(document).ready(function() { //content.find('select').select2('destroy'); var template = jQuery('.um-admin-btn-content').find('.um-admin-cur-condition-template').clone(); + template.find('input[type=text]').val(''); + template.find('select').val(''); - template.find('input[type=text],select').each(function(){ - jQuery(this).attr('id', jQuery(this).attr('id') + length ); - jQuery(this).attr('name', jQuery(this).attr('name') + length ); - }); - - template.find('input[type=text]').val(''); - template.find('select').val(''); - - template.appendTo( content ); - jQuery(template).removeClass("um-admin-cur-condition-template"); - jQuery(template).addClass("um-admin-cur-condition"); + template.appendTo( content ); + jQuery(template).removeClass("um-admin-cur-condition-template"); + jQuery(template).addClass("um-admin-cur-condition"); um_admin_live_update_scripts(); um_admin_modal_responsive(); @@ -224,6 +221,20 @@ jQuery(document).ready(function() { jQuery(this).addClass('disabled'); alert( 'You already have 5 rules' ); } + //need fields refactor + var conditions = jQuery('.um-admin-cur-condition'); + jQuery(conditions).each( function ( i ) { + id = i === 0 ? '' : i; + jQuery( this ).find('[id^="_conditional_action"]').attr('name', '_conditional_action' + id); + jQuery( this ).find('[id^="_conditional_action"]').attr('id', '_conditional_action' + id); + jQuery( this ).find('[id^="_conditional_field"]').attr('name', '_conditional_field' + id); + jQuery( this ).find('[id^="_conditional_field"]').attr('id', '_conditional_field' + id); + jQuery( this ).find('[id^="_conditional_operator"]').attr('name', '_conditional_operator' + id); + jQuery( this ).find('[id^="_conditional_operator"]').attr('id', '_conditional_operator' + id); + jQuery( this ).find('[id^="_conditional_value"]').attr('name', '_conditional_value' + id); + jQuery( this ).find('[id^="_conditional_value"]').attr('id', '_conditional_value' + id); + } ); + }); /** @@ -247,6 +258,19 @@ jQuery(document).ready(function() { jQuery('.um-admin-new-condition').removeClass('disabled'); jQuery('.tipsy').remove(); condition.remove(); + //need fields refactor + var conditions = jQuery('.um-admin-cur-condition'); + jQuery(conditions).each( function ( i ) { + id = i === 0 ? '' : i; + jQuery( this ).find('[id^="_conditional_action"]').attr('name', '_conditional_action' + id); + jQuery( this ).find('[id^="_conditional_action"]').attr('id', '_conditional_action' + id); + jQuery( this ).find('[id^="_conditional_field"]').attr('name', '_conditional_field' + id); + jQuery( this ).find('[id^="_conditional_field"]').attr('id', '_conditional_field' + id); + jQuery( this ).find('[id^="_conditional_operator"]').attr('name', '_conditional_operator' + id); + jQuery( this ).find('[id^="_conditional_operator"]').attr('id', '_conditional_operator' + id); + jQuery( this ).find('[id^="_conditional_value"]').attr('name', '_conditional_value' + id); + jQuery( this ).find('[id^="_conditional_value"]').attr('id', '_conditional_value' + id); + } ); um_admin_live_update_scripts(); um_admin_modal_responsive(); }); diff --git a/includes/admin/assets/js/um-admin-scripts.js b/includes/admin/assets/js/um-admin-scripts.js index fc20bbe2..25dd12e7 100644 --- a/includes/admin/assets/js/um-admin-scripts.js +++ b/includes/admin/assets/js/um-admin-scripts.js @@ -12,6 +12,31 @@ function um_init_tooltips() { jQuery(document).ready(function() { + /** + clone a field dropdown + **/ + jQuery(document).on( 'click', '#um_add_review_love', function(e){ + jQuery(this).parents('#um_start_review_notice').hide(); + jQuery('.um_hidden_notice[data-key="love"]').show(); + }); + + /** + clone a field dropdown + **/ + jQuery(document).on( 'click', '#um_add_review_good', function(e){ + jQuery(this).parents('#um_start_review_notice').hide(); + jQuery('.um_hidden_notice[data-key="good"]').show(); + }); + + /** + clone a field dropdown + **/ + jQuery(document).on( 'click', '#um_add_review_bad', function(e){ + jQuery(this).parents('#um_start_review_notice').hide(); + jQuery('.um_hidden_notice[data-key="bad"]').show(); + }); + + /** clone a field dropdown **/ @@ -215,23 +240,4 @@ jQuery(document).ready(function() { jQuery(this).parents('.um-nav-edit').find('.um-nav-roles').hide(); } }); - - - jQuery(document).on( 'click', '.um-admin-notice.is-dismissible .notice-dismiss', function(e) { - var notice_key = jQuery(this).parents('.um-admin-notice').data('key'); - - wp.ajax.send( 'um_dimiss_notice', { - data: { - key: notice_key, - nonce: um_admin_scripts.nonce - }, - success: function( data ) { - return true; - }, - error: function( data ) { - return false; - } - }); - }); - }); \ No newline at end of file diff --git a/includes/admin/core/class-admin-builder.php b/includes/admin/core/class-admin-builder.php index 3f61932c..c89d025d 100644 --- a/includes/admin/core/class-admin-builder.php +++ b/includes/admin/core/class-admin-builder.php @@ -230,7 +230,17 @@ if ( ! class_exists( 'um\admin\core\Admin_Builder' ) ) {
+
+ field_input( '_conditional_action', $form_id ); ?> + field_input( '_conditional_field', $form_id ); ?> + field_input( '_conditional_operator', $form_id ); ?> + field_input( '_conditional_value', $form_id ); ?> + +

+ +
+

@@ -265,25 +275,13 @@ if ( ! class_exists( 'um\admin\core\Admin_Builder' ) ) { field_input( '_conditional_operator', $form_id ); ?> field_input( '_conditional_value', $form_id ); ?> -

+

-
- - field_input( '_conditional_action', $form_id ); ?> - field_input( '_conditional_field', $form_id ); ?> - field_input( '_conditional_operator', $form_id ); ?> - field_input( '_conditional_value', $form_id ); ?> - -

- -
-
- js_url . 'um-admin-global.js', array('jquery'), ultimatemember_version, true ); + wp_enqueue_script( 'um_admin_global' ); + wp_register_style( 'um_admin_global', $this->css_url . 'um-admin-global.css' ); wp_enqueue_style( 'um_admin_global' ); } @@ -390,7 +393,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) { }*/ $this->load_functions(); - $this->load_global_css(); + $this->load_global_scripts(); $this->load_form(); $this->load_forms(); $this->load_modal(); @@ -423,7 +426,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) { } else { - $this->load_global_css(); + $this->load_global_scripts(); } diff --git a/includes/admin/core/class-admin-notices.php b/includes/admin/core/class-admin-notices.php index 4bed1295..d26ef853 100644 --- a/includes/admin/core/class-admin-notices.php +++ b/includes/admin/core/class-admin-notices.php @@ -30,7 +30,8 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) { add_action( 'admin_init', array( &$this, 'create_list' ), 10 ); add_action( 'admin_notices', array( &$this, 'render_notices' ), 1 ); - //add_action( 'wp_ajax_um_dimiss_notice', array( &$this, 'dimiss_notice' ) ); + add_action( 'wp_ajax_um_dismiss_notice', array( &$this, 'dismiss_notice' ) ); + add_action( 'wp_ajax_um_opt_in_notice', array( &$this, 'opt_in_notice' ) ); } @@ -40,10 +41,12 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) { $this->localize_note(); $this->show_update_messages(); $this->check_wrong_install_folder(); - $this->admin_notice_tracking(); + $this->admin_notice_opt_in(); $this->need_upgrade(); $this->check_wrong_licenses(); + $this->reviews_notice(); + //$this->future_changed(); @@ -140,8 +143,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) { $admin_notices = $this->get_admin_notices(); - $hidden = get_user_meta( get_current_user_id(), 'um_hidden_admin_notices', true ); - $hidden = empty( $hidden ) ? array() : $hidden; + $hidden = get_option( 'um_hidden_admin_notices', array() ); uasort( $admin_notices, array( &$this, 'notice_priority_sort' ) ); @@ -191,11 +193,11 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) { $class = ! empty( $notice_data['class'] ) ? $notice_data['class'] : 'updated'; - $dimissible = ! empty( $admin_notices[ $key ]['dimissible'] ); + $dismissible = ! empty( $admin_notices[ $key ]['dismissible'] ); ob_start(); ?> -
+
@@ -499,42 +501,43 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) { /** * Show admin notices */ - public function admin_notice_tracking() { + public function admin_notice_opt_in() { if ( ! current_user_can( 'manage_options' ) ) { return; } + //backward compatibility $hide_notice = get_option( 'um_tracking_notice' ); if ( $hide_notice ) { return; } - $optin_url = esc_url( add_query_arg( 'um_adm_action', 'opt_into_tracking' ) ); - $optout_url = esc_url( add_query_arg( 'um_adm_action', 'opt_out_of_tracking' ) ); + $optin_url = esc_url( add_query_arg( 'um_adm_action', 'opt_in' ) ); ob_start(); ?>

- %s! We hope you like the plugin. To fund full-time development and support of the plugin we also sell extensions for %s via our website. If you subscribe to our mailing list we will immediately email you a 20%% discount code for our extensions bundle (you\'ll need to confirm your subscription via email).', 'ultimate-member' ), ultimatemember_plugin_name, ultimatemember_plugin_name, 'https://ultimatemember.com/core-extensions-bundle/' ); ?> + %s! We hope you like the plugin. To fund full-time development and support of the plugin we also sell extensions for %s via our website. If you subscribe to our mailing list we will email you a 20%% discount code for our extensions bundle (you\'ll need to confirm your opt-in via email before the discount code can be sent).', 'ultimate-member' ), ultimatemember_plugin_name, ultimatemember_plugin_name, 'https://ultimatemember.com/core-extensions-bundle/' ); ?>

- +   - +

- privacy policy', 'ultimate-member' ), 'https://ultimatemember.com/support/policy/' ); ?> + privacy policy', 'ultimate-member' ), 'https://ultimatemember.com/privacy-policy/' ); ?>

add_notice( 'tracking_notice', array( + $this->add_notice( 'opt_in_notice', array( 'class' => 'updated', 'message' => $message, + 'dismissible' => true ), 2 ); } @@ -609,6 +612,71 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) { } + /** + * + */ + function reviews_notice() { + + $first_activation_date = get_option( 'um_first_activation_date', false ); + + if ( empty( $first_activation_date ) ) { + return; + } + + if ( $first_activation_date + MONTH_IN_SECONDS > time() ) { + return; + } + + ob_start(); ?> + +
+

+ +

+

+  |  +  |  + +

+
+
+

+ +

+ +

+ +

+
+
+

+ +

+ +

+ +

+
+
+

+ support forum and we will try and help you out with the issue. Alternatively if you have an idea on how we can make the plugin better or want to tell us what you don\'t like about the plugin you can tell us know by giving us feedback.' ), 'https://wordpress.org/support/plugin/ultimate-member' ); ?> +

+ +

+ +

+
+ + add_notice( 'reviews_notice', array( + 'class' => 'updated', + 'message' => $message, + 'dismissible' => true + ), 1 ); + } + + /** * Check Future Changes notice */ @@ -625,21 +693,62 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) { $this->add_notice( 'future_changes', array( 'class' => 'updated', 'message' => $message, - //'dimissible' => true, ), 2 ); } - function dimiss_notice() { + function dismiss_notice() { if ( empty( $_POST['key'] ) ) { wp_send_json_error( __( 'Wrong Data', 'ultimate-member' ) ); } - $hidden_notices = get_user_meta( get_current_user_id(), 'um_hidden_admin_notices', true ); - $hidden_notices = empty( $hidden_notices ) ? array() : $hidden_notices; + $hidden_notices = get_option( 'um_hidden_admin_notices', array() ); $hidden_notices[] = $_POST['key']; - update_user_meta( get_current_user_id(), 'um_hidden_admin_notices', $hidden_notices ); + update_option( 'um_hidden_admin_notices', $hidden_notices ); + + wp_send_json_success(); + } + + + function opt_in_notice() { + // Send a maximum of once per period + $last_send = get_option( 'um_opt_in_last_send', false ); + if ( $last_send && $last_send > strtotime( '-1 day' ) ) { + return; + } + + $data = array(); + + UM()->setup()->install_basics(); + + $data['email'] = get_option( 'admin_email' ); + $data['send_discount'] = ! get_option( '__ultimatemember_coupon_sent' ) ? 1 : 0; + $data['unique_sitekey'] = get_option( '__ultimatemember_sitekey' ); + + $request = wp_remote_post( 'https://ultimatemember.com/?um_action=checkin', array( + 'method' => 'POST', + 'timeout' => 45, + 'redirection' => 5, + 'httpversion' => '1.0', + 'blocking' => true, + 'body' => $data, + 'user-agent' => 'UM/' . ultimatemember_version . '; ' . get_bloginfo( 'url' ), + ) ); + + if ( ! is_wp_error( $request ) ) { + $request = json_decode( wp_remote_retrieve_body( $request ), true ); + } + + $request = ( $request ) ? maybe_unserialize( $request ) : false; + + if ( ! empty( $request['id'] ) && ! empty( $request['list_id'] ) ) { + update_option( 'um_opt_in_last_send', time() ); + + if ( $request['discount_ready'] ) { + update_option( '__ultimatemember_coupon_sent', 1 ); + } + } wp_send_json_success(); } diff --git a/includes/admin/core/class-admin-settings.php b/includes/admin/core/class-admin-settings.php index 0a0828f3..f64c315d 100644 --- a/includes/admin/core/class-admin-settings.php +++ b/includes/admin/core/class-admin-settings.php @@ -1033,11 +1033,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) { 'textarea_rows' => 6 ) ), - array( - 'id' => 'um_allow_tracking', - 'type' => 'checkbox', - 'label' => __( 'Allow Tracking','ultimate-member' ), - ), array( 'id' => 'uninstall_on_delete', 'type' => 'checkbox', diff --git a/includes/class-config.php b/includes/class-config.php index 7d92c771..e05eb15b 100644 --- a/includes/class-config.php +++ b/includes/class-config.php @@ -519,7 +519,6 @@ if ( ! class_exists( 'um\Config' ) ) { 'form_asterisk' => 0, 'profile_title' => '{display_name} | {site_name}', 'profile_desc' => '{display_name} is on {site_name}. Join {site_name} to view {display_name}\'s profile', - 'allow_tracking' => 0, 'admin_email' => get_bloginfo('admin_email'), 'mail_from' => get_bloginfo('name'), 'mail_from_addr' => get_bloginfo('admin_email'), diff --git a/includes/class-init.php b/includes/class-init.php index 5aaa9227..b62ed050 100644 --- a/includes/class-init.php +++ b/includes/class-init.php @@ -462,6 +462,8 @@ if ( ! class_exists( 'UM' ) ) { if ( ! $version ) { update_option( 'um_last_version_upgrade', ultimatemember_version ); + add_option( 'um_first_activation_date', time() ); + //show avatars on first install if ( ! get_option( 'show_avatars' ) ) { update_option( 'show_avatars', 1 ); @@ -496,6 +498,7 @@ if ( ! class_exists( 'UM' ) ) { $this->admin_upgrade()->init_packages_ajax_handlers(); $this->admin_gdpr(); $this->columns(); + $this->notices(); } elseif ( $this->is_request( 'admin' ) ) { $this->admin(); $this->admin_menu(); @@ -534,7 +537,6 @@ if ( ! class_exists( 'UM' ) ) { $this->permalinks(); $this->modal(); $this->cron(); - $this->tracking(); $this->mobile(); $this->external_integrations(); $this->gdpr(); @@ -1250,20 +1252,6 @@ if ( ! class_exists( 'UM' ) ) { } - /** - * @since 2.0 - * - * @return um\core\Tracking - */ - function tracking() { - if ( empty( $this->classes['tracking'] ) ) { - $this->classes['tracking'] = new um\core\Tracking(); - } - - return $this->classes['tracking']; - } - - /** * @since 2.0 * diff --git a/includes/core/class-plugin-updater.php b/includes/core/class-plugin-updater.php index 04a01c3b..e8dc4c51 100644 --- a/includes/core/class-plugin-updater.php +++ b/includes/core/class-plugin-updater.php @@ -115,6 +115,14 @@ if ( ! class_exists( 'um\core\Plugin_Updater' ) ) { 'key' => 'woocommerce', 'title' => 'Woocommerce', ), + 'um-user-photos/um-user-photos.php' => array( + 'key' => 'user_photos', + 'title' => 'User Photos', + ), + 'um-private-content/um-private-content.php' => array( + 'key' => 'private_content', + 'title' => 'Private Content', + ), ); $the_plugs = get_option( 'active_plugins' ); @@ -163,7 +171,7 @@ if ( ! class_exists( 'um\core\Plugin_Updater' ) ) { $api_params['active_extensions'] = array(); foreach ( $exts as $slug => $data ) { - $plugin_data = get_plugin_data( ABSPATH . "wp-content/plugins/{$slug}" ); + $plugin_data = get_plugin_data( WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . $slug ); $api_params['active_extensions'][$slug] = array( 'slug' => $slug, @@ -176,7 +184,7 @@ if ( ! class_exists( 'um\core\Plugin_Updater' ) ) { $request = wp_remote_post( 'https://ultimatemember.com/', array( - 'timeout' => 15, + 'timeout' => 45, 'sslverify' => false, 'body' => $api_params ) @@ -244,7 +252,7 @@ if ( ! class_exists( 'um\core\Plugin_Updater' ) ) { $exts = $this->um_get_active_plugins(); foreach ( $exts as $slug => $data ) { - $plugin_data = get_plugin_data( ABSPATH . "wp-content/plugins/{$slug}" ); + $plugin_data = get_plugin_data( WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . $slug ); //if response for current product isn't empty check for override if ( ! empty( $_transient_data->response ) && ! empty( $_transient_data->response[ $slug ] ) ) @@ -331,7 +339,7 @@ if ( ! class_exists( 'um\core\Plugin_Updater' ) ) { $url = get_site_url( get_current_blog_id() ); $domain = strtolower( urlencode( rtrim( $url, '/' ) ) ); - $plugin_data = get_plugin_data( ABSPATH . "wp-content/plugins/{$slug}" ); + $plugin_data = get_plugin_data( WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . $slug ); $api_params = array( 'action' => 'get_last_version', diff --git a/includes/core/class-setup.php b/includes/core/class-setup.php index cd58f4e5..8d4aa6be 100644 --- a/includes/core/class-setup.php +++ b/includes/core/class-setup.php @@ -220,8 +220,8 @@ if ( ! class_exists( 'um\core\Setup' ) ) { foreach ( UM()->config()->settings_defaults as $key => $value ) { //set new options to default - if ( ! isset( $options[$key] ) ) - $options[$key] = $value; + if ( ! isset( $options[ $key ] ) ) + $options[ $key ] = $value; } update_option( 'um_options', $options ); @@ -236,7 +236,7 @@ if ( ! class_exists( 'um\core\Setup' ) ) { UM()->query()->count_users_by_status( 'unassigned' ); foreach ( UM()->config()->default_roles_metadata as $role => $meta ) { - update_option( "um_role_{$role}_meta", $meta ); + add_option( "um_role_{$role}_meta", $meta ); } } } diff --git a/includes/core/class-tracking.php b/includes/core/class-tracking.php deleted file mode 100644 index 17ecc503..00000000 --- a/includes/core/class-tracking.php +++ /dev/null @@ -1,185 +0,0 @@ -schedule_send(); - - add_action( 'um_admin_do_action__opt_into_tracking', array( $this, 'um_admin_do_action__opt_into_tracking' ) ); - add_action( 'um_admin_do_action__opt_out_of_tracking', array( $this, 'um_admin_do_action__opt_out_of_tracking' ) ); - } - - - /** - * Opt-in tracking - * - * @param $action - */ - function um_admin_do_action__opt_into_tracking( $action ) { - UM()->options()->update( 'um_allow_tracking', 1 ); - update_option( 'um_tracking_notice', 1 ); - - $this->send_checkin(true); - - exit( wp_redirect( remove_query_arg('um_adm_action') ) ); - } - - - /** - * Opt-out of tracking - * - * @param $action - */ - function um_admin_do_action__opt_out_of_tracking( $action ) { - UM()->options()->update( 'um_allow_tracking', 0 ); - update_option('um_tracking_notice', 1 ); - - exit( wp_redirect( remove_query_arg('um_adm_action') ) ); - } - - - /** - * Setup info array - * - */ - private function setup_data() { - $data = array(); - - // Retrieve current theme info - if ( get_bloginfo( 'version' ) < '3.4' ) { - $theme_data = get_theme_data( get_stylesheet_directory() . '/style.css' ); - $theme = $theme_data['Name']; - $theme_ver = $theme_data['Version']; - } else { - $theme_data = wp_get_theme(); - $theme = $theme_data->Name; - $theme_ver = $theme_data->Version; - } - - $data['url'] = home_url(); - $data['theme'] = $theme; - $data['theme_version'] = $theme_ver; - $data['wp_version'] = get_bloginfo( 'version' ); - $data['version'] = ultimatemember_version; - - // Retrieve current plugin information - if( ! function_exists( 'get_plugins' ) ) { - include ABSPATH . '/wp-admin/includes/plugin.php'; - } - - $plugins = array_keys( get_plugins() ); - $active_plugins = get_option( 'active_plugins', array() ); - - foreach ( $plugins as $key => $plugin ) { - if ( in_array( $plugin, $active_plugins ) ) { - // Remove active plugins from list so we can show active and inactive separately - unset( $plugins[ $key ] ); - } - } - - $data['active_plugins'] = $active_plugins; - $data['inactive_plugins'] = $plugins; - $data['language'] = get_bloginfo('language'); - $data['multisite'] = ( is_multisite() ) ? 1 : 0; - - UM()->setup()->install_basics(); - - $data['email'] = get_option( 'admin_email' ); - $data['unique_sitekey'] = get_option( '__ultimatemember_sitekey' ); - - $this->data = $data; - - } - - - /** - * Check if tracking is allowed - * - * @return int - */ - private function tracking_allowed() { - if ( ! UM()->options()->get( 'allow_tracking' ) ) - return 0; - return 1; - } - - - /** - * Get last send time - * - * @return mixed|void - */ - private function get_last_send() { - return get_option( 'um_tracking_last_send' ); - } - - - /** - * Send a report - * - * @param bool $override - */ - public function send_checkin( $override = false ) { - - if( ! $this->tracking_allowed() && ! $override ) - return; - - // Send a maximum of once per period - $last_send = $this->get_last_send(); - if( $last_send && $last_send > strtotime( '-1 day' ) ) - return; - - $this->setup_data(); - - if ( !get_option('__ultimatemember_coupon_sent') ) { - $this->data['send_discount'] = 1; - } else { - $this->data['send_discount'] = 0; - } - - $request = wp_remote_post( 'https://ultimatemember.com/?um_action=checkin', array( - 'method' => 'POST', - 'timeout' => 45, - 'redirection' => 5, - 'httpversion' => '1.0', - 'blocking' => true, - 'body' => $this->data, - 'user-agent' => 'UM/' . ultimatemember_version . '; ' . get_bloginfo( 'url' ), - ) ); - - update_option( 'um_tracking_last_send', time() ); - update_option( '__ultimatemember_coupon_sent', 1 ); - } - - - /** - * Run a scheduled report - */ - private function schedule_send() { - add_action( 'um_daily_scheduled_events', array( $this, 'send_checkin' ) ); - } - - } -} \ No newline at end of file diff --git a/includes/core/um-filters-members.php b/includes/core/um-filters-members.php index 1ec1e149..1f2235f5 100644 --- a/includes/core/um-filters-members.php +++ b/includes/core/um-filters-members.php @@ -124,7 +124,7 @@ function um_add_search_to_query( $query_args, $args ){ if ( in_array( $field, array( 'members_page' ) ) ) continue; $serialize_value = serialize( strval( $value ) ); - + if ( $value && $field != 'um_search' && $field != 'page_id' ) { if ( strstr( $field, 'role_' ) ) @@ -135,18 +135,40 @@ function um_add_search_to_query( $query_args, $args ){ if ( 'role' == $field ) { $query_args['role__in'] = trim( $value ); } else { - $field_query = array( - array( - 'key' => $field, - 'value' => trim( $value ), - 'compare' => '=', - ), - 'relation' => 'OR', - ); - $filter_data = UM()->members()->prepare_filter( $field ); - if( $filter_data['type'] != 'select' ) { - $field_query = array_merge( $field_query, array( + if ( $filter_data['type'] == 'select' ) { + $field_query = array( + array( + 'key' => $field, + 'value' => trim( $value ), + 'compare' => '=', + ), + 'relation' => 'OR', + ); + + + $types = apply_filters( 'um_search_field_types', array( + 'multiselect', + 'radio', + 'checkbox' + ) ); + + if ( in_array( $filter_data['attrs']['type'], $types ) ) { + $field_query = array_merge( $field_query, array( + array( + 'key' => $field, + 'value' => serialize( strval( trim( $value ) ) ), + 'compare' => 'LIKE', + ), + ) ); + } + } else { + $field_query = array( + array( + 'key' => $field, + 'value' => trim( $value ), + 'compare' => '=', + ), array( 'key' => $field, 'value' => trim( $value ), @@ -158,8 +180,9 @@ function um_add_search_to_query( $query_args, $args ){ 'compare' => 'LIKE', ), 'relation' => 'OR', - ) ); + ); } + /** * UM hook * @@ -478,17 +501,4 @@ function um_search_select_fields( $atts ) { return $atts; } -add_filter( 'um_search_select_fields', 'um_search_select_fields' ); - - -/** - * Filter gender query argument - * - * @param array $field_query - * @return array - */ -function um_query_args_gender__filter( $field_query ) { - unset( $field_query[1] ); - return $field_query; -} -add_filter( 'um_query_args_gender__filter', 'um_query_args_gender__filter' ); \ No newline at end of file +add_filter( 'um_search_select_fields', 'um_search_select_fields' ); \ No newline at end of file diff --git a/readme.txt b/readme.txt index d08e8907..c3a12074 100644 --- a/readme.txt +++ b/readme.txt @@ -6,7 +6,7 @@ Donate link: Tags: community, member, membership, user-profile, user-registration Requires at least: 4.1 Tested up to: 4.9 -Stable tag: 2.0.17 +Stable tag: 2.0.20 License: GNU Version 2 or Any Later Version License URI: http://www.gnu.org/licenses/gpl-3.0.txt @@ -131,12 +131,25 @@ The plugin works with popular caching plugins by automatically excluding Ultimat = Important: UM2.0+ is a significant update to the code base from 1.3.88. Please make sure you take a full-site backup with restore point before updating the plugin = -= 2.0.18: July 2, 2018 = += 2.0.20: July 6, 2018 = + +* Bugfixes: + - Fixed search in members directory by User Tags field + += 2.0.19: July 5, 2018 = + +* Bugfixes: + - Fixed few JS file's full versions + - Fixed search in members directory by multiselect/radio/checkbox field + - Fixed first activation role metadata reset + += 2.0.18: July 4, 2018 = * Enhancements: - Added an ability to create different email templates for each site on multisites installs - Added major version notice - Added an ability to make Profile Form visible for 2 or more roles + - Added ability to dismiss some UM notices - Redesign some parts of field's conditional logic settings * Bugfixes: diff --git a/ultimate-member.php b/ultimate-member.php index 068a707c..a906476f 100644 --- a/ultimate-member.php +++ b/ultimate-member.php @@ -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.0.18 +Version: 2.0.20 Author: Ultimate Member Author URI: http://ultimatemember.com/ Text Domain: ultimate-member