diff --git a/README.md b/README.md
index d4f28e78..2084e86e 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.12 | WordPress 4.9 or higher| 2.0.12 |
+| 2.0.17 | WordPress 4.9 or higher| 2.0.17 |
Features of the plugin include:
@@ -48,7 +48,7 @@ GNU Version 2 or Any Later Version
Releases
====================
-[Official Release Version: 2.0.12](https://github.com/ultimatemember/ultimatemember/releases/tag/2.0.12).
+[Official Release Version: 2.0.17](https://github.com/ultimatemember/ultimatemember/releases/tag/2.0.17).
[Official Release Version: 1.3.88](https://github.com/ultimatemember/ultimatemember/releases).
diff --git a/assets/css/um-profile.css b/assets/css/um-profile.css
index 00a07b6a..e14b2721 100644
--- a/assets/css/um-profile.css
+++ b/assets/css/um-profile.css
@@ -393,13 +393,31 @@ font-weight: normal;
border-bottom: 0 !important;
}
-.um-profile-nav-item.without-icon a {padding-left: 10px}
-.um-profile-nav-item.without-icon span.title {padding-left: 0}
-.um-profile-nav-item.without-icon i {display: none}
+.um-profile-nav-item.without-icon a {
+ padding-left: 10px;
+}
+.um-profile-nav-item.without-icon span.title {
+ padding-left: 0;
+}
+.um-profile-nav-item.without-icon i {
+ display: none;
+}
-.um-profile-nav-item a:hover {background: #555}
-.um-profile-nav-item i {font-size: 18px;height: 18px;line-height: 18px;position: absolute;display: block;top: 8px;left: 10px}
-.um-profile-nav-item span.title {padding-left: 5px}
+.um-profile-nav-item a:hover {
+ background: #555;
+}
+.um-profile-nav-item i {
+ font-size: 18px;
+ height: 18px;
+ line-height: 18px;
+ position: absolute;
+ display: block;
+ top: 8px;
+ left: 10px;
+}
+.um-profile-nav-item span.title {
+ padding-left: 5px;
+}
.um-profile-nav-item span.count {
font-size: 12px;
font-weight: 300;
diff --git a/assets/js/um-gdpr.js b/assets/js/um-gdpr.js
new file mode 100644
index 00000000..31c0fde9
--- /dev/null
+++ b/assets/js/um-gdpr.js
@@ -0,0 +1,22 @@
+(function( $ ) {
+ 'use strict';
+
+ $(document).on('click', "a.um-toggle-gdpr" ,function() {
+
+ var me = jQuery(this);
+
+ $( ".um-gdpr-content" ).toggle( "fast", function() {
+ if( $( ".um-gdpr-content" ).is(':visible') ){
+ me.text( me.data('toggle-hide') );
+ }
+
+ if( $( ".um-gdpr-content" ).is(':hidden') ){
+ me.text( me.data('toggle-show') );
+ }
+
+ });
+
+ });
+
+
+})( jQuery );
diff --git a/assets/js/um-gdpr.min.js b/assets/js/um-gdpr.min.js
new file mode 100644
index 00000000..b861cc4a
--- /dev/null
+++ b/assets/js/um-gdpr.min.js
@@ -0,0 +1 @@
+!function(t){"use strict";t(document).on("click","a.um-toggle-gdpr",function(){var e=jQuery(this);t(".um-gdpr-content").toggle("fast",function(){t(".um-gdpr-content").is(":visible")&&e.text(e.data("toggle-hide")),t(".um-gdpr-content").is(":hidden")&&e.text(e.data("toggle-show"))})})}(jQuery);
\ No newline at end of file
diff --git a/includes/admin/class-admin.php b/includes/admin/class-admin.php
index 9eed2865..9ec0de53 100644
--- a/includes/admin/class-admin.php
+++ b/includes/admin/class-admin.php
@@ -35,6 +35,7 @@ if ( ! class_exists( 'um\admin\Admin' ) ) {
add_action( 'um_admin_do_action__user_cache', array( &$this, 'user_cache' ) );
add_action( 'um_admin_do_action__purge_temp', array( &$this, 'purge_temp' ) );
+ add_action( 'um_admin_do_action__manual_upgrades_request', array( &$this, 'manual_upgrades_request' ) );
add_action( 'um_admin_do_action__duplicate_form', array( &$this, 'duplicate_form' ) );
add_action( 'um_admin_do_action__um_language_downloader', array( &$this, 'um_language_downloader' ) );
add_action( 'um_admin_do_action__um_hide_locale_notice', array( &$this, 'um_hide_notice' ) );
@@ -48,6 +49,29 @@ if ( ! class_exists( 'um\admin\Admin' ) ) {
}
+ function manual_upgrades_request() {
+ if ( ! is_admin() || ! current_user_can( 'manage_options' ) ) {
+ die();
+ }
+
+ $last_request = get_option( 'um_last_manual_upgrades_request', false );
+
+ if ( empty( $last_request ) || time() > $last_request + DAY_IN_SECONDS ) {
+
+ delete_transient( 'update_plugins' );
+ delete_site_transient( 'update_plugins' );
+
+ UM()->plugin_updater()->um_checklicenses();
+
+ update_option( 'um_last_manual_upgrades_request', time() );
+
+ $url = add_query_arg( array( 'page' => 'ultimatemember', 'update' => 'got_updates' ), admin_url( 'admin.php' ) );
+ } else {
+ $url = add_query_arg( array( 'page' => 'ultimatemember', 'update' => 'often_updates' ), admin_url( 'admin.php' ) );
+ }
+ exit( wp_redirect( $url ) );
+ }
+
/**
* Clear all users cache
diff --git a/includes/admin/core/class-admin-gdpr.php b/includes/admin/core/class-admin-gdpr.php
new file mode 100644
index 00000000..5a69dd2b
--- /dev/null
+++ b/includes/admin/core/class-admin-gdpr.php
@@ -0,0 +1,316 @@
+metabox(), 'load_metabox_form' ),
+ 'um_form',
+ 'side',
+ 'default'
+ );
+ }
+
+
+ /**
+ *
+ */
+ function init_fields() {
+ $this->meta_associations = array(
+
+ 'account_status' => __( 'Account Status', 'ultimate-member' ),
+ 'submitted' => __( 'Submitted data on Registration', 'ultimate-member' ),
+ 'form_id' => __( 'Registration Form ID', 'ultimate-member' ),
+ 'timestamp' => __( 'Registration Timestamp', 'ultimate-member' ),
+ 'request' => __( 'Registration Request', 'ultimate-member' ),
+ '_wpnonce' => __( 'Registration Nonce', 'ultimate-member' ),
+ '_wp_http_referer' => __( 'Registration HTTP referer', 'ultimate-member' ),
+ 'role' => __( 'Community Role', 'ultimate-member' ),
+ 'um_user_profile_url_slug_user_login' => __( 'Profile Slug "Username"', 'ultimate-member' ),
+ 'um_user_profile_url_slug_name' => __( 'Profile Slug "First and Last Name with \'.\'"', 'ultimate-member' ),
+ 'um_user_profile_url_slug_name_dash' => __( 'Profile Slug "First and Last Name with \'-\'"', 'ultimate-member' ),
+ 'um_user_profile_url_slug_name_plus' => __( 'Profile Slug "First and Last Name with \'+\'"', 'ultimate-member' ),
+ 'um_user_profile_url_slug_user_id' => __( 'Profile Slug "User ID"', 'ultimate-member' ),
+ '_um_last_login' => __( 'Last Login Timestamp', 'ultimate-member' ),
+
+ //Private content extension
+ '_um_private_content_post_id' => __( 'Private Content Post ID', 'ultimate-member' ),
+
+ //Verified Users extension
+ '_um_verified' => __( 'Verified Account', 'ultimate-member' ),
+
+ //Terms & Conditions extension
+ 'use_terms_conditions_agreement' => __( 'Terms&Conditions Agreement', 'ultimate-member' ),
+
+ //GDPR extension
+ 'use_gdpr_agreement' => __( 'Privacy Policy Agreement', 'ultimate-member' ),
+
+
+ );
+
+ $all_fields = UM()->builtin()->all_user_fields( null, true );
+ unset( $all_fields[0] );
+
+ $all_fields = array_map( function( $value ) {
+ return $value['title'];
+ }, $all_fields );
+
+ $this->meta_associations = array_merge( $this->meta_associations, $all_fields );
+
+ /**
+ * UM hook
+ *
+ * @type filter
+ * @title um_gdpr_meta_associations
+ * @description Exclude taxonomies for UM
+ * @input_vars
+ * [{"var":"$meta_associations","type":"array","desc":"Meta Keys Titles"}]
+ * @change_log
+ * ["Since: 2.0.14"]
+ * @usage
+ *
+ * @example
+ *
+ */
+ $this->meta_associations = apply_filters( 'um_gdpr_meta_associations', $this->meta_associations );
+ }
+
+
+ /**
+ * Return the default suggested privacy policy content.
+ *
+ * @return string The default policy content.
+ */
+ function plugin_get_default_privacy_content() {
+ ob_start();
+
+ include UM()->admin()->templates_path . 'gdpr.php';
+
+ return ob_get_clean();
+ }
+
+
+ /**
+ * Add the suggested privacy policy text to the policy postbox.
+ */
+ function plugin_add_suggested_privacy_content() {
+ $content = $this->plugin_get_default_privacy_content();
+ wp_add_privacy_policy_content( ultimatemember_plugin_name, $content );
+ }
+
+
+ /**
+ * Register exporter for Plugin user data.
+ *
+ * @see https://github.com/allendav/wp-privacy-requests/blob/master/EXPORT.md
+ *
+ * @param $exporters
+ *
+ * @return array
+ */
+ function plugin_register_exporters( $exporters ) {
+ $exporters[] = array(
+ 'exporter_friendly_name' => ultimatemember_plugin_name,
+ 'callback' => array( &$this, 'data_exporter' )
+ );
+ return $exporters;
+ }
+
+
+ /**
+ * Get user metadata in key => value array
+ *
+ *
+ * @param $user_id
+ *
+ * @return array
+ */
+ function get_metadata( $user_id ) {
+ global $wpdb;
+
+ $metadata = $wpdb->get_results( $wpdb->prepare(
+ "SELECT meta_key, meta_value
+ FROM {$wpdb->usermeta}
+ WHERE user_id = %d",
+ $user_id
+ ), ARRAY_A );
+
+ $filtered = array();
+ foreach ( $metadata as $data ) {
+ if ( in_array( $data['meta_key'], array_keys( $this->meta_associations ) ) ) {
+ $filtered[] = array(
+ 'key' => $data['meta_key'],
+ 'name' => $this->meta_associations[ $data['meta_key'] ],
+ //'value' => maybe_unserialize( $data['meta_value'] ),
+ 'value' => $data['meta_value'],
+ );
+ }
+ }
+
+ return $filtered;
+ }
+
+
+ /**
+ * Exporter for Plugin user data.
+ *
+ * @see https://github.com/allendav/wp-privacy-requests/blob/master/EXPORT.md
+ *
+ * @param $email_address
+ * @param int $page
+ *
+ * @return array
+ */
+ function data_exporter( $email_address, $page = 1 ) {
+ $export_items = array();
+ $user = get_user_by( 'email', $email_address );
+
+ if ( $user && $user->ID ) {
+ // Most item IDs should look like postType-postID
+ // If you don't have a post, comment or other ID to work with,
+ // use a unique value to avoid having this item's export
+ // combined in the final report with other items of the same id
+ $item_id = "ultimate-member-{$user->ID}";
+
+ // Core group IDs include 'comments', 'posts', etc.
+ // But you can add your own group IDs as needed
+ $group_id = 'ultimate-member';
+
+ // Optional group label. Core provides these for core groups.
+ // If you define your own group, the first exporter to
+ // include a label will be used as the group label in the
+ // final exported report
+ $group_label = ultimatemember_plugin_name;
+
+ // Plugins can add as many items in the item data array as they want
+ //$data = array();
+
+ $data = $this->get_metadata( $user->ID );
+
+ if ( ! empty( $data ) ) {
+ // Add this group of items to the exporters data array.
+ $export_items[] = array(
+ 'group_id' => $group_id,
+ 'group_label' => $group_label,
+ 'item_id' => $item_id,
+ 'data' => $data,
+ );
+ }
+ }
+ // Returns an array of exported items for this pass, but also a boolean whether this exporter is finished.
+ //If not it will be called again with $page increased by 1.
+ return array(
+ 'data' => $export_items,
+ 'done' => true,
+ );
+ }
+
+
+ /**
+ * Register eraser for Plugin user data.
+ *
+ * @param array $erasers
+ *
+ * @return array
+ */
+ function plugin_register_erasers( $erasers = array() ) {
+ $erasers[] = array(
+ 'eraser_friendly_name' => ultimatemember_plugin_name,
+ 'callback' => array( &$this, 'data_eraser' )
+ );
+ return $erasers;
+ }
+
+
+ /**
+ * Eraser for Plugin user data.
+ *
+ * @param $email_address
+ * @param int $page
+ *
+ * @return array
+ */
+ function data_eraser( $email_address, $page = 1 ) {
+ if ( empty( $email_address ) ) {
+ return array(
+ 'items_removed' => false,
+ 'items_retained' => false,
+ 'messages' => array(),
+ 'done' => true,
+ );
+ }
+
+ $user = get_user_by( 'email', $email_address );
+ $messages = array();
+ $items_removed = false;
+ $items_retained = false;
+
+ if ( $user && $user->ID ) {
+ $data = $this->get_metadata( $user->ID );
+
+ foreach ( $data as $metadata ) {
+ $deleted = delete_user_meta( $user->ID, $metadata['key'] );
+ if ( $deleted ) {
+ $items_removed = true;
+ } else {
+ $messages[] = sprintf( __( 'Your %s was unable to be removed at this time.', 'ultimate-member' ), $metadata['name'] );
+ $items_retained = true;
+ }
+ }
+ }
+
+ // Returns an array of exported items for this pass, but also a boolean whether this exporter is finished.
+ //If not it will be called again with $page increased by 1.
+ return array(
+ 'items_removed' => $items_removed,
+ 'items_retained' => $items_retained,
+ 'messages' => $messages,
+ 'done' => true,
+ );
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/includes/admin/core/class-admin-menu.php b/includes/admin/core/class-admin-menu.php
index f42ad023..cbb68cfd 100644
--- a/includes/admin/core/class-admin-menu.php
+++ b/includes/admin/core/class-admin-menu.php
@@ -206,6 +206,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Menu' ) ) {
add_meta_box( 'um-metaboxes-mainbox-1', __( 'Latest from our blog', 'ultimate-member' ), array( &$this, 'um_news' ), $this->pagehook, 'normal', 'core' );
add_meta_box( 'um-metaboxes-sidebox-1', __( 'Purge Temp Files', 'ultimate-member' ), array( &$this, 'purge_temp' ), $this->pagehook, 'side', 'core' );
+
add_meta_box( 'um-metaboxes-sidebox-2', __( 'User Cache', 'ultimate-member' ), array( &$this, 'user_cache' ), $this->pagehook, 'side', 'core' );
if ( $this->language_avaialable_not_installed() ) {
@@ -215,6 +216,12 @@ if ( ! class_exists( 'um\admin\core\Admin_Menu' ) ) {
} else if ( $this->language_not_available() ) {
add_meta_box( 'um-metaboxes-sidebox-2', __( 'Language', 'ultimate-member' ), array( &$this, 'ct_language' ), $this->pagehook, 'side', 'core' );
}
+
+ //If there are active and licensed extensions - show metabox for upgrade it
+ $exts = UM()->plugin_updater()->um_get_active_plugins();
+ if ( 0 < count( $exts ) ) {
+ add_meta_box( 'um-metaboxes-sidebox-3', __( 'Upgrade\'s Manual Request', 'ultimate-member' ), array( &$this, 'upgrade_request' ), $this->pagehook, 'side', 'core' );
+ }
}
@@ -269,6 +276,14 @@ if ( ! class_exists( 'um\admin\core\Admin_Menu' ) ) {
}
+ /**
+ *
+ */
+ function upgrade_request() {
+ include_once UM()->admin()->templates_path . 'dashboard/upgrade-request.php';
+ }
+
+
/**
*
*/
diff --git a/includes/admin/core/class-admin-notices.php b/includes/admin/core/class-admin-notices.php
index ce698225..70b82f31 100644
--- a/includes/admin/core/class-admin-notices.php
+++ b/includes/admin/core/class-admin-notices.php
@@ -38,7 +38,7 @@ 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_tracking();
$this->need_upgrade();
$this->check_wrong_licenses();
@@ -225,9 +225,32 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
function old_extensions_notice() {
$show = false;
+ $old_extensions = array(
+ 'bbpress',
+ 'followers',
+ 'friends',
+ 'instagram',
+ 'mailchimp',
+ 'messaging',
+ 'mycred',
+ 'notices',
+ 'notifications',
+ 'online',
+ 'private-content',
+ 'profile-completeness',
+ 'recaptcha',
+ 'reviews',
+ 'social-activity',
+ 'social-login',
+ 'terms-conditions',
+ 'user-tags',
+ 'verified-users',
+ 'woocommerce',
+ );
+
$slugs = array_map( function( $item ) {
return 'um-' . $item . '/um-' . $item . '.php';
- }, array_keys( UM()->dependencies()->ext_required_version ) );
+ }, $old_extensions );
$active_plugins = UM()->dependencies()->get_active_plugins();
foreach ( $slugs as $slug ) {
@@ -397,6 +420,14 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
$messages[0]['content'] = __( 'Your user cache is now removed.', 'ultimate-member' );
break;
+ case 'got_updates':
+ $messages[0]['content'] = __( 'You got the latest upgrades.', 'ultimate-member' );
+ break;
+
+ case 'often_updates':
+ $messages[0]['err_content'] = __( 'Try again later. You can run this action once daily.', 'ultimate-member' );
+ break;
+
case 'form_duplicated':
$messages[0]['content'] = __( 'The form has been duplicated successfully.', 'ultimate-member' );
break;
diff --git a/includes/admin/core/class-admin-settings.php b/includes/admin/core/class-admin-settings.php
index ba23548a..29ff98fc 100644
--- a/includes/admin/core/class-admin-settings.php
+++ b/includes/admin/core/class-admin-settings.php
@@ -1197,12 +1197,14 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
do_action( "um_settings_page_" . $current_tab . "_" . $current_subtab . "_before_section" );
$section_fields = $this->get_section_fields( $current_tab, $current_subtab );
+ $settings_section = $this->render_settings_section( $section_fields, $current_tab, $current_subtab );
/**
* UM hook
*
* @type filter
* @title um_settings_section_{$current_tab}_{$current_subtab}_content
+ *
* @description Render settings section
* @input_vars
* [{"var":"$content","type":"string","desc":"Section content"},
@@ -1220,7 +1222,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
* ?>
*/
echo apply_filters( 'um_settings_section_' . $current_tab . '_' . $current_subtab . '_content',
- $this->render_settings_section( $section_fields, $current_tab, $current_subtab ),
+ $settings_section,
$section_fields
);
@@ -1258,6 +1260,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
do_action( "um_settings_page_" . $current_tab . "_" . $current_subtab . "_before_section" );
$section_fields = $this->get_section_fields( $current_tab, $current_subtab );
+ $settings_section = $this->render_settings_section( $section_fields, $current_tab, $current_subtab );
/**
* UM hook
@@ -1281,7 +1284,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
* ?>
*/
echo apply_filters( 'um_settings_section_' . $current_tab . '_' . $current_subtab . '_content',
- $this->render_settings_section( $section_fields, $current_tab, $current_subtab ),
+ $settings_section,
$section_fields
);
?>
@@ -2181,7 +2184,6 @@ Cache User Profile: options()->get( 'um_profile_object_cache_s
Generate Slugs on Directories: options()->get( 'um_generate_slug_in_directory' ) == 1 ){ echo "No"; }else{ echo "Yes"; } echo "\n"; ?>
Rewrite Rules: options()->get( 'um_flush_stop' ) == 1 ){ echo "No"; }else{ echo "Yes"; } echo "\n"; ?>
Force UTF-8 Encoding: options()->get( 'um_force_utf8_strings' ) == 1 ){ echo "Yes"; }else{ echo "No"; } echo "\n"; ?>
-Time Check Security: options()->get( 'enable_timebot' ) == 1 ){ echo "Yes"; }else{ echo "No"; } echo "\n"; ?>
JS/CSS Compression:
Network Structure: options()->get( 'network_permalink_structure' ). "\n"; ?>
diff --git a/includes/admin/core/class-admin-upgrade.php b/includes/admin/core/class-admin-upgrade.php
index e48cb7c9..406431c8 100644
--- a/includes/admin/core/class-admin-upgrade.php
+++ b/includes/admin/core/class-admin-upgrade.php
@@ -17,6 +17,12 @@ if ( ! class_exists( 'um\admin\core\Admin_Upgrade' ) ) {
class Admin_Upgrade {
+ /**
+ * @var null
+ */
+ protected static $instance = null;
+
+
/**
* @var
*/
@@ -31,6 +37,25 @@ if ( ! class_exists( 'um\admin\core\Admin_Upgrade' ) ) {
var $packages_dir;
+ /**
+ * Main Admin_Upgrade Instance
+ *
+ * Ensures only one instance of UM is loaded or can be loaded.
+ *
+ * @since 1.0
+ * @static
+ * @see UM()
+ * @return Admin_Upgrade - Main instance
+ */
+ static public function instance() {
+ if ( is_null( self::$instance ) ) {
+ self::$instance = new self();
+ }
+
+ return self::$instance;
+ }
+
+
/**
* Admin_Upgrade constructor.
*/
@@ -39,11 +64,14 @@ if ( ! class_exists( 'um\admin\core\Admin_Upgrade' ) ) {
$this->necessary_packages = $this->need_run_upgrades();
if ( ! empty( $this->necessary_packages ) ) {
- $this->init_packages_ajax();
add_action( 'admin_menu', array( $this, 'admin_menu' ), 0 );
- add_action( 'wp_ajax_um_run_package', array( $this, 'ajax_run_package' ) );
- add_action( 'wp_ajax_um_get_packages', array( $this, 'ajax_get_packages' ) );
+ if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
+ $this->init_packages_ajax();
+
+ add_action( 'wp_ajax_um_run_package', array( $this, 'ajax_run_package' ) );
+ add_action( 'wp_ajax_um_get_packages', array( $this, 'ajax_get_packages' ) );
+ }
}
//add_action( 'in_plugin_update_message-' . um_plugin, array( $this, 'in_plugin_update_message' ) );
@@ -143,7 +171,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Upgrade' ) ) {
foreach ( $this->necessary_packages as $package ) {
$hooks_file = $this->packages_dir . DIRECTORY_SEPARATOR . $package . DIRECTORY_SEPARATOR . 'hooks.php';
if ( file_exists( $hooks_file ) ) {
- $pack_ajax_hooks = include $hooks_file;
+ $pack_ajax_hooks = include_once $hooks_file;
foreach ( $pack_ajax_hooks as $action => $function ) {
add_action( 'wp_ajax_um_' . $action, "um_upgrade_$function" );
@@ -160,7 +188,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Upgrade' ) ) {
foreach ( $this->necessary_packages as $package ) {
$handlers_file = $this->packages_dir . DIRECTORY_SEPARATOR . $package . DIRECTORY_SEPARATOR . 'functions.php';
if ( file_exists( $handlers_file ) ) {
- include $handlers_file;
+ include_once $handlers_file;
}
}
}
@@ -290,7 +318,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Upgrade' ) ) {
exit('');
} else {
ob_start();
- include $this->packages_dir . DIRECTORY_SEPARATOR . $_POST['pack'] . DIRECTORY_SEPARATOR . 'init.php';
+ include_once $this->packages_dir . DIRECTORY_SEPARATOR . $_POST['pack'] . DIRECTORY_SEPARATOR . 'init.php';
ob_get_flush();
exit;
}
diff --git a/includes/admin/core/packages/2.0-beta1/email_templates.php b/includes/admin/core/packages/2.0-beta1/email_templates.php
index 264c32dd..d30a3182 100644
--- a/includes/admin/core/packages/2.0-beta1/email_templates.php
+++ b/includes/admin/core/packages/2.0-beta1/email_templates.php
@@ -25,8 +25,8 @@ foreach ( $emails as $email_key => $value ) {
} else {
$setting_value = UM()->options()->get( $email_key );
- $fp = fopen( $theme_template_path, "w" );
- $result = fputs( $fp, $setting_value );
+ $fp = @fopen( $theme_template_path, "w" );
+ $result = @fputs( $fp, $setting_value );
fclose( $fp );
}
} else {
diff --git a/includes/admin/core/packages/2.0-beta1/menus.php b/includes/admin/core/packages/2.0-beta1/menus.php
index a1ecb262..80f0ce2a 100644
--- a/includes/admin/core/packages/2.0-beta1/menus.php
+++ b/includes/admin/core/packages/2.0-beta1/menus.php
@@ -18,9 +18,15 @@ $menus = get_posts( array(
foreach ( $menus as $menu ) {
$menu_roles = get_post_meta( $menu->ID, 'menu-item-um_nav_roles', true );
- foreach ( $menu_roles as $i => $role_k ) {
- $menu_roles[ $i ] = $roles_associations[ $role_k ];
+ if( !is_array( $menu_roles ) ) {
+ $menu_roles = array();
}
+ foreach ( $menu_roles as $i => $role_k ) {
+ if( $role_k != '' && isset( $roles_associations[ $role_k ] ) ) {
+ $menu_roles[ $i ] = $roles_associations[ $role_k ];
+ }
+ }
+
update_post_meta( $menu->ID, 'menu-item-um_nav_roles', $menu_roles );
}
\ No newline at end of file
diff --git a/includes/admin/templates/dashboard/upgrade-request.php b/includes/admin/templates/dashboard/upgrade-request.php
new file mode 100644
index 00000000..b1af5c84
--- /dev/null
+++ b/includes/admin/templates/dashboard/upgrade-request.php
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/includes/admin/templates/form/register_gdpr.php b/includes/admin/templates/form/register_gdpr.php
new file mode 100644
index 00000000..0a226b11
--- /dev/null
+++ b/includes/admin/templates/form/register_gdpr.php
@@ -0,0 +1,71 @@
+
+
+ __( 'Select page', 'ultimate-member' )
+ );
+
+ $pages = get_pages();
+ foreach ( $pages as $page ) {
+ $options[$page->ID] = $page->post_title;
+ }
+
+ UM()->admin_forms( array(
+ 'class' => 'um-form-register-gdpr um-top-label',
+ 'prefix_id' => 'form',
+ 'fields' => array(
+ array(
+ 'id' => '_um_register_use_gdpr',
+ 'type' => 'select',
+ 'label' => __( 'Enable on this form', 'ultimate-member' ),
+ 'value' => UM()->query()->get_meta_value( '_um_register_use_gdpr', null, '' ),
+ 'options' => array(
+ '0' => __( 'No', 'ultimate-member' ),
+ '1' => __( 'Yes', 'ultimate-member' )
+ ),
+ ),
+ array(
+ 'id' => '_um_register_use_gdpr_content_id',
+ 'type' => 'select',
+ 'label' => __( 'Content', 'ultimate-member' ),
+ 'value' => UM()->query()->get_meta_value('_um_register_use_gdpr_content_id', null, '' ),
+ 'options' => $options,
+ 'conditional' => array( '_um_register_use_gdpr', '=', '1' )
+ ),
+ array(
+ 'id' => '_um_register_use_gdpr_toggle_show',
+ 'type' => 'text',
+ 'label' => __( 'Toggle Show text', 'ultimate-member' ),
+ 'placeholder' => __( 'Show privacy policy', 'ultimate-member' ),
+ 'value' => UM()->query()->get_meta_value('_um_register_use_gdpr_toggle_show', null, __( 'Show privacy policy', 'ultimate-member' ) ),
+ 'conditional' => array( '_um_register_use_gdpr', '=', '1' )
+ ),
+ array(
+ 'id' => '_um_register_use_gdpr_toggle_hide',
+ 'type' => 'text',
+ 'label' => __( 'Toggle Hide text', 'ultimate-member' ),
+ 'placeholder' => __( 'Hide privacy policy', 'ultimate-member' ),
+ 'value' => UM()->query()->get_meta_value('_um_register_use_gdpr_toggle_hide', null, __( 'Hide privacy policy', 'ultimate-member' ) ),
+ 'conditional' => array( '_um_register_use_gdpr', '=', '1' )
+ ),
+ array(
+ 'id' => '_um_register_use_gdpr_agreement',
+ 'type' => 'text',
+ 'label' => __( 'Checkbox agreement description', 'ultimate-member' ),
+ 'placeholder' => __( 'Please confirm that you agree to our privacy policy', 'ultimate-member' ),
+ 'value' => UM()->query()->get_meta_value('_um_register_use_gdpr_agreement', null, __( 'Please confirm that you agree to our privacy policy', 'ultimate-member' ) ),
+ 'conditional' => array( '_um_register_use_gdpr', '=', '1' )
+ ),
+ array(
+ 'id' => '_um_register_use_gdpr_error_text',
+ 'type' => 'text',
+ 'label' => __( 'Error Text', 'ultimate-member' ),
+ 'placeholder' => __( 'Please confirm your acceptance of our privacy policy', 'ultimate-member' ),
+ 'value' => UM()->query()->get_meta_value('_um_register_use_gdpr_error_text', null, __( 'Please confirm your acceptance of our privacy policy', 'ultimate-member' ) ),
+ 'conditional' => array( '_um_register_use_gdpr', '=', '1' )
+ )
+ )
+ ) )->render_form(); ?>
+
+
+
\ No newline at end of file
diff --git a/includes/admin/templates/gdpr.php b/includes/admin/templates/gdpr.php
new file mode 100644
index 00000000..da6334ed
--- /dev/null
+++ b/includes/admin/templates/gdpr.php
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/includes/class-dependencies.php b/includes/class-dependencies.php
index d25f1f9a..b0fe53b9 100644
--- a/includes/class-dependencies.php
+++ b/includes/class-dependencies.php
@@ -57,6 +57,7 @@ if ( ! class_exists( 'um\Dependencies' ) ) {
'woocommerce' => '2.0.1',
'restrict-content' => '2.0',
'beaver-builder' => '2.0',
+ 'gdpr' => '1.0.0',
);
diff --git a/includes/class-init.php b/includes/class-init.php
index 249a103e..0cc6f25d 100644
--- a/includes/class-init.php
+++ b/includes/class-init.php
@@ -30,6 +30,7 @@ if ( ! class_exists( 'UM' ) ) {
* @method UM_Terms_Conditions_API Terms_Conditions_API()
* @method UM_Private_Content_API Private_Content_API()
* @method UM_User_Location_API User_Location_API()
+ * @method UM_GDPR_API GDPR_API()
*
*/
final class UM extends UM_Functions {
@@ -385,47 +386,6 @@ if ( ! class_exists( 'UM' ) ) {
}
- /**
- * Show notice for customers with old extension's versions
- */
- /*function old_extensions_notice() {
- if ( ! is_admin() ) {
- return;
- }
-
- if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
- return;
- }
-
- $show = false;
-
- $slugs = array_map( function( $item ) {
- return 'um-' . $item . '/um-' . $item . '.php';
- }, array_keys( $this->dependencies()->ext_required_version ) );
-
- $active_plugins = $this->dependencies()->get_active_plugins();
- foreach ( $slugs as $slug ) {
- if ( in_array( $slug, $active_plugins ) ) {
- $plugin_data = get_plugin_data( um_path . '..' . DIRECTORY_SEPARATOR . $slug );
- if ( version_compare( '2.0', $plugin_data['Version'], '>' ) ) {
- $show = true;
- break;
- }
- }
- }
-
- if ( ! $show ) {
- return;
- }
-
- /*global $um_woocommerce;
- remove_action( 'init', array( $um_woocommerce, 'plugin_check' ), 1 );
- $um_woocommerce->plugin_inactive = true;*
-
- echo '' . sprintf( __( '%s %s requires 2.0 extensions. You have pre 2.0 extensions installed on your site. Please update %s extensions to latest versions. For more info see this doc .', 'ultimate-member' ), ultimatemember_plugin_name, ultimatemember_version, ultimatemember_plugin_name, 'http://docs.ultimatemember.com/article/266-updating-to-2-0-versions-of-extensions' ) . '
';
- }*/
-
-
/**
* Autoload UM classes handler
*
@@ -525,6 +485,7 @@ if ( ! class_exists( 'UM' ) ) {
$this->ajax_init();
$this->metabox();
$this->admin_upgrade()->init_packages_ajax_handlers();
+ $this->admin_gdpr();
} elseif ( $this->is_request( 'admin' ) ) {
$this->admin();
$this->admin_menu();
@@ -537,6 +498,7 @@ if ( ! class_exists( 'UM' ) ) {
$this->users();
$this->dragdrop();
$this->plugin_updater();
+ $this->admin_gdpr();
} elseif ( $this->is_request( 'frontend' ) ) {
$this->enqueue();
$this->account();
@@ -562,9 +524,10 @@ if ( ! class_exists( 'UM' ) ) {
$this->permalinks();
$this->modal();
$this->cron();
- $this->tracking();
+ //$this->tracking();
$this->mobile();
$this->external_integrations();
+ $this->gdpr();
}
@@ -674,12 +637,55 @@ if ( ! class_exists( 'UM' ) ) {
*/
function admin_upgrade() {
if ( empty( $this->classes['admin_upgrade'] ) ) {
- $this->classes['admin_upgrade'] = new um\admin\core\Admin_Upgrade();
+ $this->classes['admin_upgrade'] = um\admin\core\Admin_Upgrade::instance();
+ //$this->classes['admin_upgrade'] = new um\admin\core\Admin_Upgrade();
}
return $this->classes['admin_upgrade'];
}
+ /**
+ * GDPR privacy policy
+ *
+ * @since 2.0.14
+ *
+ * @return bool|um\admin\core\Admin_GDPR()
+ */
+ function admin_gdpr() {
+ global $wp_version;
+
+ if ( version_compare( $wp_version, '4.9.6', '<' ) ) {
+ return false;
+ }
+
+ if ( empty( $this->classes['admin_gdpr'] ) ) {
+ $this->classes['admin_gdpr'] = new um\admin\core\Admin_GDPR();
+ }
+ return $this->classes['admin_gdpr'];
+ }
+
+
+ /**
+ * GDPR privacy policy
+ *
+ * @since 2.0.14
+ *
+ * @return bool|um\core\GDPR()
+ */
+ function gdpr() {
+ global $wp_version;
+
+ if ( version_compare( $wp_version, '4.9.6', '<' ) ) {
+ return false;
+ }
+
+ if ( empty( $this->classes['gdpr'] ) ) {
+ $this->classes['gdpr'] = new um\core\GDPR();
+ }
+ return $this->classes['gdpr'];
+ }
+
+
/**
* @since 2.0
*
diff --git a/includes/core/class-access.php b/includes/core/class-access.php
index c0d601ac..6223c552 100644
--- a/includes/core/class-access.php
+++ b/includes/core/class-access.php
@@ -65,6 +65,10 @@ if ( ! class_exists( 'um\core\Access' ) ) {
add_action( 'template_redirect', array( &$this, 'template_redirect' ), 1000 );
add_action( 'um_access_check_individual_term_settings', array( &$this, 'um_access_check_individual_term_settings' ) );
add_action( 'um_access_check_global_settings', array( &$this, 'um_access_check_global_settings' ) );
+
+ /* Disable comments if user has not permission to access current post */
+ add_filter( 'comments_open', array( $this, 'disable_comments_open' ), 99, 2 );
+ add_filter( 'get_comments_number', array( $this, 'disable_comments_open' ), 99, 2 );
}
@@ -532,7 +536,7 @@ if ( ! class_exists( 'um\core\Access' ) ) {
if ( ! empty( $post->post_type ) && $post->post_type == 'page' ) {
if ( um_is_core_post( $post, 'login' ) || um_is_core_post( $post, 'register' ) ||
um_is_core_post( $post, 'account' ) || um_is_core_post( $post, 'logout' ) ||
- um_is_core_post( $post, 'password-reset' ) )
+ um_is_core_post( $post, 'password-reset' ) || ( is_user_logged_in() && um_is_core_post( $post, 'user' ) ) )
return false;
}
@@ -934,6 +938,63 @@ if ( ! class_exists( 'um\core\Access' ) ) {
}
+ /**
+ * Disable comments if user has not permission to access this post
+ * @param mixed $open
+ * @param int $post_id
+ * @return boolean
+ */
+ public function disable_comments_open( $open, $post_id ) {
+
+ static $cache = array();
+
+ if ( isset( $cache[ $post_id ] ) ) {
+ return $cache[ $post_id ] ? $open : false;
+ }
+
+ $post = get_post( $post_id );
+ $restriction = $this->get_post_privacy_settings( $post );
+
+ if ( ! $restriction ) {
+ $cache[ $post_id ] = $open;
+ return $open;
+ }
+
+ if ( '1' == $restriction['_um_accessible'] ) {
+
+ if ( is_user_logged_in() ) {
+ if ( ! current_user_can( 'administrator' ) ) {
+ $open = false;
+ }
+ }
+
+ } elseif ( '2' == $restriction['_um_accessible'] ) {
+ if ( ! is_user_logged_in() ) {
+ $open = false;
+ } else {
+ if ( ! current_user_can( 'administrator' ) ) {
+ $custom_restrict = $this->um_custom_restriction( $restriction );
+
+ if ( empty( $restriction['_um_access_roles'] ) || false === array_search( '1', $restriction['_um_access_roles'] ) ) {
+ if ( ! $custom_restrict ) {
+ $open = false;
+ }
+ } else {
+ $user_can = $this->user_can( get_current_user_id(), $restriction['_um_access_roles'] );
+
+ if ( ! isset( $user_can ) || ! $user_can || ! $custom_restrict ) {
+ $open = false;
+ }
+ }
+ }
+ }
+ }
+
+ $cache[ $post_id ] = $open;
+ return $open;
+ }
+
+
/**
* Protect Post Types in menu query
* Restrict content new logic
diff --git a/includes/core/class-account.php b/includes/core/class-account.php
index 1b7007af..a6fc0c67 100644
--- a/includes/core/class-account.php
+++ b/includes/core/class-account.php
@@ -55,6 +55,7 @@ if ( ! class_exists( 'um\core\Account' ) ) {
* @param $args
*/
function init_tabs( $args ) {
+
$this->tabs = $this->get_tabs();
ksort( $this->tabs );
@@ -75,7 +76,6 @@ if ( ! class_exists( 'um\core\Account' ) ) {
}
}
-
$this->tabs = $tabs_structed;
}
@@ -527,7 +527,7 @@ if ( ! class_exists( 'um\core\Account' ) ) {
* ?>
*/
$args = apply_filters( 'um_account_tab_privacy_fields', $args, $shortcode_args );
-
+
$fields = UM()->builtin()->get_specific_fields( $args );
$fields = $this->account_secure_fields( $fields, $id );
$fields = $this->filter_fields_by_attrs( $fields, $shortcode_args );
@@ -535,7 +535,6 @@ if ( ! class_exists( 'um\core\Account' ) ) {
foreach ( $fields as $key => $data ){
$output .= UM()->fields()->edit_field( $key, $data );
}
-
break;
case 'delete':
diff --git a/includes/core/class-builtin.php b/includes/core/class-builtin.php
index 2242e55b..c076c7a3 100644
--- a/includes/core/class-builtin.php
+++ b/includes/core/class-builtin.php
@@ -1252,7 +1252,7 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
*/
$fields_without_metakey = apply_filters( 'um_fields_without_metakey', $fields_without_metakey );
- if ( !$show_all ) {
+ if ( ! $show_all ) {
$this->fields_dropdown = array('image','file','password','rating');
$this->fields_dropdown = array_merge( $this->fields_dropdown, $fields_without_metakey );
} else {
diff --git a/includes/core/class-enqueue.php b/includes/core/class-enqueue.php
index 4365b686..b723b213 100644
--- a/includes/core/class-enqueue.php
+++ b/includes/core/class-enqueue.php
@@ -319,6 +319,8 @@ if ( ! class_exists( 'um\core\Enqueue' ) ) {
wp_register_script('um_functions', um_url . 'assets/js/um-functions' . $this->suffix . '.js', array('jquery', 'jquery-masonry') );
wp_enqueue_script('um_functions');
+ wp_enqueue_script( 'um-gdpr', um_url . 'assets/js/um-gdpr' . $this->suffix . '.js', array( 'jquery' ), ultimatemember_version, false );
+
}
diff --git a/includes/core/class-fields.php b/includes/core/class-fields.php
index 9cab1a87..40c2cb9e 100644
--- a/includes/core/class-fields.php
+++ b/includes/core/class-fields.php
@@ -573,7 +573,8 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
} elseif ( um_user( $key ) && $this->editing == true ) {
- if ( strstr( $key, 'user_pass' ) ) {
+ //show empty value for password fields
+ if ( strstr( $key, 'user_pass' ) || $type == 'password' ) {
return '';
}
@@ -798,6 +799,11 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
return true;
}
+ $stripslashed = array_map( 'stripslashes', UM()->form()->post_form[ $key ] );
+ if ( in_array( $value, $stripslashed ) ) {
+ return true;
+ }
+
if ( in_array( html_entity_decode( $value ), UM()->form()->post_form[ $key ] ) ) {
return true;
}
@@ -808,16 +814,21 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
$field_value = um_user( $key );
- if ($key == 'role') {
+ if ( $key == 'role' ) {
$role_keys = get_option( 'um_roles' );
- if (!empty( $role_keys )) {
- if (in_array( $field_value, $role_keys )) {
+ if ( ! empty( $role_keys ) ) {
+ if ( in_array( $field_value, $role_keys ) ) {
$field_value = 'um_' . $field_value;
}
}
-
+ /*elseif( $this->set_mode == 'register' ){
+ $data['default'] = UM()->options()->get( 'register_role' );
+ }
+ else{
+ $data['default'] = get_option( 'default_role' );
+ }*/
}
/**
@@ -930,19 +941,25 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
$um_user_value = um_user( $key );
- if ($key == 'role') {
+ if ( $key == 'role' ) {
$um_user_value = strtolower( $um_user_value );
$role_keys = get_option( 'um_roles' );
- if (!empty( $role_keys )) {
- if (in_array( $um_user_value, $role_keys )) {
+ if ( ! empty( $role_keys ) ) {
+ if ( in_array( $um_user_value, $role_keys ) ) {
$um_user_value = 'um_' . $um_user_value;
}
}
+ /*elseif( $this->set_mode == 'register' ){
+ $data['default'] = UM()->options()->get( 'register_role' );
+ }
+ else{
+ $data['default'] = get_option( 'default_role' );
+ }*/
}
- if ($um_user_value == $value) {
+ if ( $um_user_value == $value ) {
return true;
}
@@ -1578,7 +1595,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
if ($visibility == 'view' && $this->set_mode != 'register') return;
- if (( $visibility == 'view' && $this->set_mode == 'register' ) ||
+ if ( ( $visibility == 'view' && $this->set_mode == 'register' ) ||
( isset( $data['editable'] ) && $data['editable'] == 0 && $this->set_mode == 'profile' )
) {
@@ -1619,6 +1636,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
// forbidden in edit mode?
if (isset( $data['edit_forbidden'] )) return;
+
// required option
if (isset( $data['required_opt'] )) {
$opt = $data['required_opt'];
@@ -2872,7 +2890,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
$um_field_checkbox_item_title = $v;
$option_value = $v;
- if (!is_numeric( $k ) && in_array( $form_key, array( 'role' ) )) {
+ if ( ! is_numeric( $k ) && in_array( $form_key, array( 'role', 'role_radio' ) ) ) {
$um_field_checkbox_item_title = $v;
$option_value = $k;
}
@@ -3466,9 +3484,12 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
if (isset( $data['in_group'] ) && $data['in_group'] != '' && $rule != 'group') return;
- if ($visibility == 'edit') return;
+ if ( $visibility == 'edit' ) return;
- if (in_array( $type, array( 'block', 'shortcode', 'spacing', 'divider', 'group' ) )) {
+ //invisible on profile page
+ if ( $type == 'password' ) return;
+
+ if ( in_array( $type, array( 'block', 'shortcode', 'spacing', 'divider', 'group' ) ) ) {
} else {
diff --git a/includes/core/class-form.php b/includes/core/class-form.php
index a5fc3c6e..7c0c1db6 100644
--- a/includes/core/class-form.php
+++ b/includes/core/class-form.php
@@ -331,19 +331,6 @@ if ( ! class_exists( 'um\core\Form' ) ) {
wp_die( 'Hello, spam bot!', 'ultimate-member' );
}
- if ( ! in_array( $this->form_data['mode'], array( 'login' ) ) ) {
-
- $form_timestamp = trim($_POST['timestamp']);
- $live_timestamp = current_time( 'timestamp' );
-
- if ( $form_timestamp == '' && UM()->options()->get( 'enable_timebot' ) == 1 )
- wp_die( __('Hello, spam bot!','ultimate-member') );
-
- if ( !current_user_can('manage_options') && $live_timestamp - $form_timestamp < 6 && UM()->options()->get( 'enable_timebot' ) == 1 )
- wp_die( __('Whoa, slow down! You\'re seeing this message because you tried to submit a form too fast and we think you might be a spam bot. If you are a real human being please wait a few seconds before submitting the form. Thanks!','ultimate-member') );
-
- }
-
/**
* UM hook
*
@@ -478,8 +465,9 @@ if ( ! class_exists( 'um\core\Form' ) ) {
$global_role = get_option( 'default_role' ); // WP Global settings
$um_global_role = UM()->options()->get( 'register_role' ); // UM Settings Global settings
- if ( ! empty( $um_global_role ) )
+ if ( ! empty( $um_global_role ) ) {
$global_role = $um_global_role; // Form Global settings
+ }
$mode = $this->form_type( $post_id );
diff --git a/includes/core/class-gdpr.php b/includes/core/class-gdpr.php
new file mode 100644
index 00000000..82ec76e7
--- /dev/null
+++ b/includes/core/class-gdpr.php
@@ -0,0 +1,86 @@
+form()->add_error( 'use_gdpr_agreement', isset( $args['use_gdpr_error_text'] ) ? $args['use_gdpr_error_text'] : '' );
+ }
+ }
+
+
+ /**
+ * @param $submitted
+ *
+ * @return mixed
+ */
+ function add_agreement_date( $submitted ) {
+ if ( isset( $submitted['use_gdpr_agreement'] ) ) {
+ $submitted['use_gdpr_agreement'] = time();
+ }
+
+ return $submitted;
+ }
+
+
+ /**
+ * @param $submitted
+ *
+ * @return mixed
+ */
+ function email_registration_data( $submitted ) {
+
+ $timestamp = ! empty( $submitted['timestamp'] ) ? $submitted['timestamp'] : $submitted['use_gdpr_agreement'];
+
+ if ( ! empty( $submitted['use_gdpr_agreement'] ) ) {
+ $submitted['GDPR Applied'] = date( "d M Y H:i", $timestamp );
+ unset( $submitted['use_gdpr_agreement'] );
+ }
+
+ return $submitted;
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/includes/core/class-mail.php b/includes/core/class-mail.php
index 330c8290..e92a208f 100644
--- a/includes/core/class-mail.php
+++ b/includes/core/class-mail.php
@@ -124,10 +124,14 @@ if ( ! class_exists( 'um\core\Mail' ) ) {
$this->message = $this->prepare_template( $template, $args );
- add_filter( 'wp_mail_content_type', array( &$this, 'set_content_type' ) );
+ if ( UM()->options()->get( 'email_html' ) ) {
+ $this->headers .= "Content-Type: text/html\r\n";
+ } else {
+ $this->headers .= "Content-Type: text/plain\r\n";
+ }
+
// Send mail
wp_mail( $email, $this->subject, $this->message, $this->headers, $this->attachments );
- remove_filter( 'wp_mail_content_type', array( &$this, 'set_content_type' ) );
}
@@ -481,22 +485,6 @@ if ( ! class_exists( 'um\core\Mail' ) ) {
}
- /**
- * Set email content type
- *
- *
- * @param $content_type
- * @return string
- */
- function set_content_type( $content_type ) {
- if ( UM()->options()->get( 'email_html' ) ) {
- return 'text/html';
- } else {
- return 'text/plain';
- }
- }
-
-
/**
* Ajax copy template to the theme
*
diff --git a/includes/core/class-profile.php b/includes/core/class-profile.php
index 0de83c6c..a857654a 100644
--- a/includes/core/class-profile.php
+++ b/includes/core/class-profile.php
@@ -118,11 +118,18 @@ if ( ! class_exists( 'um\core\Profile' ) ) {
// disable private tabs
if ( ! is_admin() ) {
+ if( is_user_logged_in() ) {
+ $user_id = um_user('ID');
+ um_fetch_user( get_current_user_id() );
+ }
foreach ( $tabs as $id => $tab ) {
if ( ! $this->can_view_tab( $id ) ) {
unset( $tabs[$id] );
}
}
+ if( is_user_logged_in() ) {
+ um_fetch_user( $user_id );
+ }
}
return $tabs;
diff --git a/includes/core/class-user.php b/includes/core/class-user.php
index c58f0410..28cff8f4 100644
--- a/includes/core/class-user.php
+++ b/includes/core/class-user.php
@@ -39,6 +39,7 @@ if ( ! class_exists( 'um\core\User' ) ) {
add_action( 'init', array( &$this, 'set' ), 1 );
$this->preview = false;
+ $this->send_mail_on_delete = true;
// a list of keys that should never be in wp_usermeta
$this->update_user_keys = array(
@@ -54,6 +55,8 @@ if ( ! class_exists( 'um\core\User' ) ) {
// When the cache should be cleared
add_action('um_delete_user_hook', array(&$this, 'remove_cached_queue') );
+ add_action('um_delete_user', array( &$this, 'remove_cache' ), 10, 1 );
+
add_action('um_after_user_status_is_changed_hook', array(&$this, 'remove_cached_queue') );
// When user cache should be cleared
@@ -83,6 +86,73 @@ if ( ! class_exists( 'um\core\User' ) ) {
add_action( 'wpmu_activate_user', array( &$this, 'add_um_role_wpmu_new_user' ), 10, 1 );
add_action( 'init', array( &$this, 'check_membership' ), 10 );
+
+ add_action( 'delete_user', array( &$this, 'delete_user_handler' ), 10, 1 );
+ add_action( 'wpmu_delete_user', array( &$this, 'delete_user_handler' ), 10, 1 );
+ }
+
+
+ /**
+ * @param $user_id
+ */
+ function delete_user_handler( $user_id ) {
+
+ um_fetch_user( $user_id );
+
+ /**
+ * UM hook
+ *
+ * @type action
+ * @title um_delete_user_hook
+ * @description On delete user
+ * @change_log
+ * ["Since: 2.0"]
+ * @usage add_action( 'um_delete_user_hook', 'function_name', 10 );
+ * @example
+ *
+ */
+ do_action( 'um_delete_user_hook' );
+
+ /**
+ * UM hook
+ *
+ * @type action
+ * @title um_delete_user
+ * @description On delete user
+ * @input_vars
+ * [{"var":"$user_id","type":"int","desc":"User ID"}]
+ * @change_log
+ * ["Since: 2.0"]
+ * @usage add_action( 'um_delete_user', 'function_name', 10, 1 );
+ * @example
+ *
+ */
+ do_action( 'um_delete_user', um_user( 'ID' ) );
+
+ // send email notifications
+ if ( $this->send_mail_on_delete ) {
+ UM()->mail()->send( um_user( 'user_email' ), 'deletion_email' );
+
+ $emails = um_multi_admin_email();
+ if ( ! empty( $emails ) ) {
+ foreach ( $emails as $email ) {
+ UM()->mail()->send( $email, 'notification_deletion', array( 'admin' => true ) );
+ }
+ }
+ }
+
+ // remove uploads
+ UM()->files()->remove_dir( um_user_uploads_dir() );
}
@@ -890,6 +960,20 @@ if ( ! class_exists( 'um\core\User' ) ) {
unset( $submitted['confirm_user_password'] );
}
+ //remove all password field values from submitted details
+ $password_fields = array();
+ foreach ( $submitted as $k => $v ) {
+ if ( UM()->fields()->get_field_type( $k ) == 'password' ) {
+ $password_fields[] = $k;
+ $password_fields[] = 'confirm_' . $k;
+ }
+ }
+
+ foreach ( $password_fields as $pw_field ) {
+ unset( $submitted[ $pw_field ] );
+ }
+
+
/**
* UM hook
*
@@ -1274,59 +1358,10 @@ if ( ! class_exists( 'um\core\User' ) ) {
* @param bool $send_mail
*/
function delete( $send_mail = true ) {
- /**
- * UM hook
- *
- * @type action
- * @title um_delete_user_hook
- * @description On delete user
- * @change_log
- * ["Since: 2.0"]
- * @usage add_action( 'um_delete_user_hook', 'function_name', 10 );
- * @example
- *
- */
- do_action( 'um_delete_user_hook' );
- /**
- * UM hook
- *
- * @type action
- * @title um_delete_user
- * @description On delete user
- * @input_vars
- * [{"var":"$user_id","type":"int","desc":"User ID"}]
- * @change_log
- * ["Since: 2.0"]
- * @usage add_action( 'um_delete_user', 'function_name', 10, 1 );
- * @example
- *
- */
- do_action( 'um_delete_user', um_user( 'ID' ) );
- // send email notifications
- if ( $send_mail ) {
- UM()->mail()->send( um_user( 'user_email' ), 'deletion_email' );
+ $this->send_mail_on_delete = $send_mail;
- $emails = um_multi_admin_email();
- if ( ! empty( $emails ) ) {
- foreach ( $emails as $email ) {
- UM()->mail()->send( $email, 'notification_deletion', array( 'admin' => true ) );
- }
- }
- }
-
- // remove uploads
- UM()->files()->remove_dir( um_user_uploads_dir() );
+ $this->delete_user_handler( um_user( 'ID' ) );
// remove user
if ( is_multisite() ) {
@@ -1626,23 +1661,29 @@ if ( ! class_exists( 'um\core\User' ) ) {
}
}
+
+
// update user
if ( count( $args ) > 1 ) {
- global $wp_roles;
- $um_roles = get_option( 'um_roles' );
- if ( ! empty( $um_roles ) ) {
- $role_keys = array_map( function( $item ) {
- return 'um_' . $item;
- }, get_option( 'um_roles' ) );
- } else {
- $role_keys = array();
- }
+ //if isset roles argument validate role to properly for security reasons
+ if ( isset( $args['role'] ) ) {
+ global $wp_roles;
+ $um_roles = get_option( 'um_roles' );
- $exclude_roles = array_diff( array_keys( $wp_roles->roles ), array_merge( $role_keys, array( 'subscriber' ) ) );
+ if ( ! empty( $um_roles ) ) {
+ $role_keys = array_map( function( $item ) {
+ return 'um_' . $item;
+ }, get_option( 'um_roles' ) );
+ } else {
+ $role_keys = array();
+ }
- if ( isset( $args['role'] ) && in_array( $args['role'], $exclude_roles ) ) {
- unset( $args['role'] );
+ $exclude_roles = array_diff( array_keys( $wp_roles->roles ), array_merge( $role_keys, array( 'subscriber' ) ) );
+
+ if ( in_array( $args['role'], $exclude_roles ) ) {
+ unset( $args['role'] );
+ }
}
wp_update_user( $args );
diff --git a/includes/core/um-actions-core.php b/includes/core/um-actions-core.php
index 70865693..d5e8921d 100644
--- a/includes/core/um-actions-core.php
+++ b/includes/core/um-actions-core.php
@@ -108,7 +108,9 @@ function um_action_request_process() {
break;
case 'um_delete':
- if ( ! UM()->roles()->um_current_user_can( 'delete', $uid ) ) wp_die( __('You do not have permission to delete this user.','ultimate-member') );
+ if ( ! UM()->roles()->um_current_user_can( 'delete', $uid ) ) {
+ wp_die( __('You do not have permission to delete this user.','ultimate-member') );
+ }
um_fetch_user( $uid );
UM()->user()->delete();
exit( wp_redirect( UM()->permalinks()->get_current_url( true ) ) );
diff --git a/includes/core/um-actions-form.php b/includes/core/um-actions-form.php
index 8050be80..5cf15388 100644
--- a/includes/core/um-actions-form.php
+++ b/includes/core/um-actions-form.php
@@ -314,8 +314,9 @@ function um_submit_form_errors_hook_( $args ) {
foreach ( $array['conditions'] as $condition ) {
list( $visibility, $parent_key, $op, $parent_value ) = $condition;
- if ( ! isset( $args[ $parent_key ] ) )
+ if ( ! isset( $args[ $parent_key ] ) ) {
continue;
+ }
$cond_value = ( $fields[ $parent_key ]['type'] == 'radio' ) ? $args[ $parent_key ][0] : $args[ $parent_key ];
@@ -337,11 +338,11 @@ function um_submit_form_errors_hook_( $args ) {
continue 2;
}
} elseif ( $op == 'greater than' ) {
- if ( $cond_value > $op ) {
+ if ( $cond_value > $parent_value ) {
continue 2;
}
} elseif ( $op == 'less than' ) {
- if ( $cond_value < $op ) {
+ if ( $cond_value < $parent_value ) {
continue 2;
}
} elseif ( $op == 'contains' ) {
@@ -367,11 +368,11 @@ function um_submit_form_errors_hook_( $args ) {
continue 2;
}
} elseif ( $op == 'greater than' ) {
- if ( $cond_value <= $op ) {
+ if ( $cond_value <= $parent_value ) {
continue 2;
}
} elseif ( $op == 'less than' ) {
- if ( $cond_value >= $op ) {
+ if ( $cond_value >= $parent_value ) {
continue 2;
}
} elseif ( $op == 'contains' ) {
diff --git a/includes/core/um-actions-password.php b/includes/core/um-actions-password.php
index 876ca53c..041153e8 100644
--- a/includes/core/um-actions-password.php
+++ b/includes/core/um-actions-password.php
@@ -133,15 +133,6 @@ function um_reset_password_errors_hook( $args ) {
if ( $_POST[ UM()->honeypot ] != '' )
wp_die('Hello, spam bot!','ultimate-member');
- $form_timestamp = trim($_POST['timestamp']);
- $live_timestamp = current_time( 'timestamp' );
-
- if ( $form_timestamp == '' && UM()->options()->get( 'enable_timebot' ) == 1 )
- wp_die( __('Hello, spam bot!','ultimate-member') );
-
- if ( $live_timestamp - $form_timestamp < 3 && UM()->options()->get( 'enable_timebot' ) == 1 )
- wp_die( __('Whoa, slow down! You\'re seeing this message because you tried to submit a form too fast and we think you might be a spam bot. If you are a real human being please wait a few seconds before submitting the form. Thanks!','ultimate-member') );
-
$user = "";
foreach ( $_POST as $key => $val ) {
@@ -197,16 +188,6 @@ function um_change_password_errors_hook( $args ) {
wp_die('Hello, spam bot!','ultimate-member');
}
- $form_timestamp = trim($_POST['timestamp']);
- $live_timestamp = current_time( 'timestamp' );
-
- if ( $form_timestamp == '' && UM()->options()->get( 'enable_timebot' ) == 1 )
- wp_die( __('Hello, spam bot!','ultimate-member') );
-
- if ( $live_timestamp - $form_timestamp < 3 && UM()->options()->get( 'enable_timebot' ) == 1 ) {
- wp_die( __('Whoa, slow down! You\'re seeing this message because you tried to submit a form too fast and we think you might be a spam bot. If you are a real human being please wait a few seconds before submitting the form. Thanks!','ultimate-member') );
- }
-
$reset_pass_hash = '';
if( isset( $_REQUEST['act'] ) && $_REQUEST['act'] == 'reset_password' && um_is_core_page('password-reset') ){
diff --git a/includes/core/um-actions-profile.php b/includes/core/um-actions-profile.php
index e8efb2fd..494b6415 100644
--- a/includes/core/um-actions-profile.php
+++ b/includes/core/um-actions-profile.php
@@ -218,8 +218,12 @@ function um_user_edit_profile( $args ) {
// loop through fields
if ( ! empty( $fields ) ) {
+
foreach ( $fields as $key => $array ) {
+ /*if ( ! um_can_edit_field( $fields[ $key ] ) )
+ continue;*/
+
if ( ! um_can_edit_field( $fields[ $key ] ) && isset( $fields[ $key ]['editable'] ) && ! $fields[ $key ]['editable'] )
continue;
@@ -236,10 +240,15 @@ function um_user_edit_profile( $args ) {
} else {
- if ( isset( $userinfo[ $key ] ) && $args['submitted'][ $key ] != $userinfo[ $key ] ) {
- $to_update[ $key ] = $args['submitted'][ $key ];
- } elseif ( $args['submitted'][ $key ] ) {
- $to_update[ $key ] = $args['submitted'][ $key ];
+ if ( $array['type'] == 'password' ) {
+ $to_update[ $key ] = wp_hash_password( $args['submitted'][ $key ] );
+ $args['submitted'][ $key ] = sprintf( __( 'Your choosed %s', 'ultimate-member' ), $array['title'] );
+ } else {
+ if ( isset( $userinfo[ $key ] ) && $args['submitted'][ $key ] != $userinfo[ $key ] ) {
+ $to_update[ $key ] = $args['submitted'][ $key ];
+ } elseif ( $args['submitted'][ $key ] ) {
+ $to_update[ $key ] = $args['submitted'][ $key ];
+ }
}
}
@@ -1368,40 +1377,46 @@ function um_profile_menu( $args ) {
diff --git a/includes/core/um-actions-register.php b/includes/core/um-actions-register.php
index 4dfab462..addab9b4 100644
--- a/includes/core/um-actions-register.php
+++ b/includes/core/um-actions-register.php
@@ -54,8 +54,9 @@ function um_after_insert_user( $user_id, $args ) {
//clear Users cached queue
UM()->user()->remove_cached_queue();
+ um_fetch_user( $user_id );
+ UM()->user()->set_status( um_user( 'status' ) );
if ( ! empty( $args['submitted'] ) ) {
- um_fetch_user( $user_id );
UM()->user()->set_registration_details( $args['submitted'] );
}
@@ -103,7 +104,7 @@ function um_after_insert_user( $user_id, $args ) {
*/
do_action( 'um_registration_complete', $user_id, $args );
}
-add_action( 'um_user_register', 'um_after_insert_user', 10, 2 );
+add_action( 'um_user_register', 'um_after_insert_user', 1, 2 );
/**
@@ -118,7 +119,7 @@ function um_send_registration_notification( $user_id, $args ) {
$emails = um_multi_admin_email();
if ( ! empty( $emails ) ) {
foreach ( $emails as $email ) {
- if ( um_user( 'status' ) != 'pending' ) {
+ if ( um_user( 'account_status' ) != 'pending' ) {
UM()->mail()->send( $email, 'notification_new_user', array( 'admin' => true ) );
} else {
UM()->mail()->send( $email, 'notification_review', array( 'admin' => true ) );
@@ -136,7 +137,7 @@ add_action( 'um_registration_complete', 'um_send_registration_notification', 10,
* @param $args
*/
function um_check_user_status( $user_id, $args ) {
- $status = um_user( 'status' );
+ $status = um_user( 'account_status' );
/**
* UM hook
@@ -368,6 +369,30 @@ function um_submit_form_register( $args ) {
$args['submitted'] = array_merge( $args['submitted'], $credentials );
$args = array_merge( $args, $credentials );
+ //get user role from global or form's settings
+ $user_role = UM()->form()->assigned_role( UM()->form()->form_id );
+
+ //get user role from field Role dropdown or radio
+ if ( isset( $args['role'] ) ) {
+ global $wp_roles;
+ $um_roles = get_option( 'um_roles' );
+
+ if ( ! empty( $um_roles ) ) {
+ $role_keys = array_map( function( $item ) {
+ return 'um_' . $item;
+ }, get_option( 'um_roles' ) );
+ } else {
+ $role_keys = array();
+ }
+
+ $exclude_roles = array_diff( array_keys( $wp_roles->roles ), array_merge( $role_keys, array( 'subscriber' ) ) );
+
+ //if role is properly set it
+ if ( ! in_array( $args['role'], $exclude_roles ) ) {
+ $user_role = $args['role'];
+ }
+ }
+
/**
* UM hook
*
@@ -390,7 +415,7 @@ function um_submit_form_register( $args ) {
* }
* ?>
*/
- $user_role = apply_filters( 'um_registration_user_role', UM()->form()->assigned_role( UM()->form()->form_id ), $args );
+ $user_role = apply_filters( 'um_registration_user_role', $user_role, $args );
$userdata = array(
'user_login' => $user_login,
@@ -725,4 +750,18 @@ function um_registration_set_profile_full_name( $user_id, $args ) {
*/
do_action( 'um_update_profile_full_name', $user_id, $args );
}
-add_action( 'um_registration_set_extra_data', 'um_registration_set_profile_full_name', 10, 2 );
\ No newline at end of file
+add_action( 'um_registration_set_extra_data', 'um_registration_set_profile_full_name', 10, 2 );
+
+
+/**
+ * Redirect from default registration to UM registration page
+ */
+function um_form_register_redirect() {
+ $page_id = UM()->options()->get( UM()->options()->get_core_page_id( 'register' ) );
+ $register_post = get_post( $page_id );
+ if ( ! empty( $register_post ) ) {
+ wp_safe_redirect( get_permalink( $page_id ) );
+ exit();
+ }
+}
+add_action( 'login_form_register', 'um_form_register_redirect', 10 );
\ No newline at end of file
diff --git a/includes/core/um-filters-fields.php b/includes/core/um-filters-fields.php
index e68498ce..4a2f59bf 100644
--- a/includes/core/um-filters-fields.php
+++ b/includes/core/um-filters-fields.php
@@ -367,18 +367,70 @@ add_filter( 'um_get_form_fields', 'um_get_form_fields', 99 );
*/
function um_get_custom_field_array( $array, $fields ) {
- if ( isset( $array['conditions'] ) ) {
- for ( $a = 0; $a < count( $array['conditions'] ); $a++ ) {
- if ( isset( $array['conditional_value'] ) || isset( $array['conditional_value' . $a] ) ) {
- foreach ( $array['conditions'] as $key => $value ) {
- $condition_metakey = $fields[ $value[1] ]['metakey'];
+ if ( ! empty( $array['conditions'] ) ) {
+ foreach ( $array['conditions'] as $key => $value ) {
+ $condition_metakey = $fields[ $value[1] ]['metakey'];
+ if ( isset( $_POST[ $condition_metakey ] ) ) {
+ $cond_value = ( $fields[ $value[1] ]['type'] == 'radio' ) ? $_POST[ $condition_metakey ][0] : $_POST[ $condition_metakey ];
+ list( $visibility, $parent_key, $op, $parent_value ) = $value;
- if ( isset( $_POST[ $condition_metakey ] ) ) {
- $cond_value = ( $fields[ $value[1] ]['type'] == 'radio' ) ? $_POST[ $condition_metakey ][0] : $_POST[ $condition_metakey ];
-
- if ( isset( $array['conditional_value'] ) && $cond_value !== $array['conditional_value'] ) {
+ if ( $visibility == 'hide' ) {
+ if ( $op == 'empty' ) {
+ if ( empty( $cond_value ) ) {
$array['required'] = 0;
- } elseif ( isset( $array['conditional_value'.$a] ) && $cond_value !== $array['conditional_value'.$a] ) {
+ }
+ } elseif ( $op == 'not empty' ) {
+ if ( ! empty( $cond_value ) ) {
+ $array['required'] = 0;
+ }
+ } elseif ( $op == 'equals to' ) {
+ if ( $cond_value == $parent_value ) {
+ $array['required'] = 0;
+ }
+ } elseif ( $op == 'not equals' ) {
+ if ( $cond_value != $parent_value ) {
+ $array['required'] = 0;
+ }
+ } elseif ( $op == 'greater than' ) {
+ if ( $cond_value > $parent_value ) {
+ $array['required'] = 0;
+ }
+ } elseif ( $op == 'less than' ) {
+ if ( $cond_value < $parent_value ) {
+ $array['required'] = 0;
+ }
+ } elseif ( $op == 'contains' ) {
+ if ( strstr( $cond_value, $parent_value ) ) {
+ $array['required'] = 0;
+ }
+ }
+ } elseif ( $visibility == 'show' ) {
+ if ( $op == 'empty' ) {
+ if ( ! empty( $cond_value ) ) {
+ $array['required'] = 0;
+ }
+ } elseif ( $op == 'not empty' ) {
+ if ( empty( $cond_value ) ) {
+ $array['required'] = 0;
+ }
+ } elseif ( $op == 'equals to' ) {
+ if ( $cond_value != $parent_value ) {
+ $array['required'] = 0;
+ }
+ } elseif ( $op == 'not equals' ) {
+ if ( $cond_value == $parent_value ) {
+ $array['required'] = 0;
+ }
+ } elseif ( $op == 'greater than' ) {
+ if ( $cond_value <= $parent_value ) {
+ $array['required'] = 0;
+ }
+ } elseif ( $op == 'less than' ) {
+ if ( $cond_value >= $parent_value ) {
+ $array['required'] = 0;
+ }
+ } elseif ( $op == 'contains' ) {
+ if ( ! strstr( $cond_value, $parent_value ) ) {
$array['required'] = 0;
}
}
diff --git a/includes/core/um-filters-members.php b/includes/core/um-filters-members.php
index 3f780466..e4ea86df 100644
--- a/includes/core/um-filters-members.php
+++ b/includes/core/um-filters-members.php
@@ -211,7 +211,7 @@ function um_add_search_to_query( $query_args, $args ){
*/
$query_args = apply_filters( 'um_query_args_filter', $query_args );
- if ( count( $query_args['meta_query'] ) == 1 )
+ if ( isset( $query_args['meta_query'] ) && count( $query_args['meta_query'] ) == 1 )
unset( $query_args['meta_query'] );
return $query_args;
diff --git a/includes/core/um-navmenu.php b/includes/core/um-navmenu.php
index e46b3a4b..00b4a8a1 100644
--- a/includes/core/um-navmenu.php
+++ b/includes/core/um-navmenu.php
@@ -55,7 +55,8 @@ if ( ! class_exists( 'UM_Menu_Item_Custom_Fields_Editor' ) ) {
// Sanitize
if ( ! empty( $_POST[ $key ][ $menu_item_db_id ] ) ) {
// Do some checks here...
- $value = $_POST[ $key ][ $menu_item_db_id ];
+ $value = is_array( $_POST[ $key ][ $menu_item_db_id ] ) ?
+ array_keys( $_POST[ $key ][ $menu_item_db_id ] ) : $_POST[ $key ][ $menu_item_db_id ];
} else {
$value = null;
}
@@ -165,7 +166,7 @@ if ( ! class_exists( 'UM_Menu_Item_Custom_Fields_Editor' ) ) {
$id_attr = ' id="edit-menu-item-um_nav_roles-{{data.menuItemID}}_' . $k . '" ';
$for_attr = ' for="edit-menu-item-um_nav_roles-{{data.menuItemID}}_' . $k . '" ';
$html .= "
- checked='checked'<# } #> />
+ checked='checked'<# } #> />
{$title}
";
}
diff --git a/includes/um-short-functions.php b/includes/um-short-functions.php
index d15afc67..b0758afa 100644
--- a/includes/um-short-functions.php
+++ b/includes/um-short-functions.php
@@ -508,10 +508,11 @@ function um_user_submitted_registration( $style = false ) {
$data = um_user( 'submitted' );
- if ($style)
+ if ( $style ) {
$output .= '';
+ }
- if (isset( $data ) && is_array( $data )) {
+ if ( isset( $data ) && is_array( $data ) ) {
/**
* UM hook
@@ -535,38 +536,51 @@ function um_user_submitted_registration( $style = false ) {
*/
$data = apply_filters( 'um_email_registration_data', $data );
- foreach ($data as $k => $v) {
+ $pw_fields = array();
+ foreach ( $data as $k => $v ) {
- if (!is_array( $v ) && strstr( $v, 'ultimatemember/temp' )) {
+ if ( strstr( $k, 'user_pass' ) || in_array( $k, array( 'g-recaptcha-response', 'request', '_wpnonce', '_wp_http_referer' ) ) ) {
+ continue;
+ }
+
+ if ( UM()->fields()->get_field_type( $k ) == 'password' ) {
+ $pw_fields[] = $k;
+ $pw_fields[] = 'confirm_' . $k;
+ continue;
+ }
+
+ if ( ! empty( $pw_fields ) && in_array( $k, $pw_fields ) ) {
+ continue;
+ }
+
+ if ( ! is_array( $v ) && strstr( $v, 'ultimatemember/temp' ) ) {
$file = basename( $v );
$v = um_user_uploads_uri() . $file;
}
- if (!strstr( $k, 'user_pass' ) && !in_array( $k, array( 'g-recaptcha-response', 'request', '_wpnonce', '_wp_http_referer' ) )) {
-
- if (is_array( $v )) {
- $v = implode( ',', $v );
- }
-
- if ($k == 'timestamp') {
- $k = __( 'date submitted', 'ultimate-member' );
- $v = date( "d M Y H:i", $v );
- }
-
- if ($style) {
- if (!$v) $v = __( '(empty)', 'ultimate-member' );
- $output .= "
$k $v
";
- } else {
- $output .= "$k: $v" . "
";
- }
-
+ if ( is_array( $v ) ) {
+ $v = implode( ',', $v );
}
+ if ( $k == 'timestamp' ) {
+ $k = __( 'date submitted', 'ultimate-member' );
+ $v = date( "d M Y H:i", $v );
+ }
+
+ if ( $style ) {
+ if ( ! $v ) {
+ $v = __( '(empty)', 'ultimate-member' );
+ }
+ $output .= "
$k $v
";
+ } else {
+ $output .= "$k: $v" . "
";
+ }
}
}
- if ($style)
+ if ( $style ) {
$output .= '
';
+ }
return $output;
}
diff --git a/readme.txt b/readme.txt
index 847b4fee..9eb1d6fd 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.13
+Stable tag: 2.0.17
License: GNU Version 2 or Any Later Version
License URI: http://www.gnu.org/licenses/gpl-3.0.txt
@@ -131,6 +131,47 @@ 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.17: May 30, 2018 =
+
+* Enhancements:
+ - Added UM dashboard widget for getting latest extension's upgrades
+
+* Bugfixes:
+ - Fixed User Profile restriction when the user isn't logged in
+ - Fixed Profile Tabs displaying on desktop/mobile
+ - Fixed set user status after registration on some installs
+ - Fixed PHP memory limit issue on some installs with small PHP memory limit
+ - Fixed PHP validation on submit UM Forms with conditional fields logic
+
+= 2.0.16: May 23, 2018 =
+
+* Bugfixes:
+ - Fixed Profile Tabs issues
+
+= 2.0.15: May 22, 2018 =
+
+* Bugfixes:
+ - Fixed GDPR min.js script
+
+= 2.0.14: May 22, 2018 =
+
+* Enhancements:
+ - Added support for GDPR Personal Data Exporter
+ - Added support for GDPR Personal Data Eraser
+ - Added new privacy field to form builder for GDPR consent collection
+ - Added GDPR privacy policy guide text
+ - Added GDPR compatibility on delete user process
+ - Added security to Restricted posts comments
+ - Added security to custom field type `Password`
+ - Deprecated time checking spam bot
+
+* Bugfixes:
+ - Fixed settings tabs for PHP7.1
+ - Fixed issues with Profile Tabs
+ - Fixed User Avatars
+ - Fixed set user status on Registration process
+ - Fixed Account Privacy tab content
+
= 2.0.13: May 2, 2018 =
* Bugfixes:
diff --git a/templates/gdpr-register.php b/templates/gdpr-register.php
new file mode 100644
index 00000000..714c6e84
--- /dev/null
+++ b/templates/gdpr-register.php
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+ post_content, $args );
+ }
+ } ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ form()->errors;
+
+ if ( isset( $errors['use_gdpr_agreement'] ) ) {
+
+ $error_message = ! empty( $args['use_gdpr_error_text'] ) ? $args['use_gdpr_error_text'] : __( 'Please confirm your acceptance of our privacy policy', 'ultimate-member' );
+
+ echo '
' . $error_message . '
';
+ } ?>
+
+
+
+
\ No newline at end of file
diff --git a/ultimate-member.php b/ultimate-member.php
index bd87426e..eb040a25 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.13
+Version: 2.0.17
Author: Ultimate Member
Author URI: http://ultimatemember.com/
Text Domain: ultimate-member