diff --git a/includes/admin/core/class-admin-notices.php b/includes/admin/core/class-admin-notices.php
index ce698225..a26b409d 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 ) {
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..10112ed0 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
*
@@ -562,7 +522,7 @@ if ( ! class_exists( 'UM' ) ) {
$this->permalinks();
$this->modal();
$this->cron();
- $this->tracking();
+ //$this->tracking();
$this->mobile();
$this->external_integrations();
}
diff --git a/includes/core/class-access.php b/includes/core/class-access.php
index c0d601ac..7f1c1fc5 100644
--- a/includes/core/class-access.php
+++ b/includes/core/class-access.php
@@ -532,7 +532,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' ) || um_is_core_post( $post, 'user' ) )
return false;
}
diff --git a/includes/core/class-fields.php b/includes/core/class-fields.php
index 9a780c10..4f747a2a 100644
--- a/includes/core/class-fields.php
+++ b/includes/core/class-fields.php
@@ -798,6 +798,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;
}
@@ -1578,7 +1583,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' )
) {
diff --git a/includes/core/class-user.php b/includes/core/class-user.php
index c58f0410..6a0a9aca 100644
--- a/includes/core/class-user.php
+++ b/includes/core/class-user.php
@@ -890,6 +890,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
*
diff --git a/includes/core/um-actions-profile.php b/includes/core/um-actions-profile.php
index 803a3e88..912be967 100644
--- a/includes/core/um-actions-profile.php
+++ b/includes/core/um-actions-profile.php
@@ -220,6 +220,9 @@ function um_user_edit_profile( $args ) {
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;
diff --git a/includes/core/um-actions-register.php b/includes/core/um-actions-register.php
index 4dfab462..3abc44ed 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
diff --git a/includes/core/um-filters-fields.php b/includes/core/um-filters-fields.php
index e68498ce..7f55479e 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 > $op ) {
+ $array['required'] = 0;
+ }
+ } elseif ( $op == 'less than' ) {
+ if ( $cond_value < $op ) {
+ $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 <= $op ) {
+ $array['required'] = 0;
+ }
+ } elseif ( $op == 'less than' ) {
+ if ( $cond_value >= $op ) {
+ $array['required'] = 0;
+ }
+ } elseif ( $op == 'contains' ) {
+ if ( ! strstr( $cond_value, $parent_value ) ) {
$array['required'] = 0;
}
}
diff --git a/includes/core/um-navmenu.php b/includes/core/um-navmenu.php
index e46b3a4b..214e3258 100644
--- a/includes/core/um-navmenu.php
+++ b/includes/core/um-navmenu.php
@@ -47,7 +47,7 @@ if ( ! class_exists( 'UM_Menu_Item_Custom_Fields_Editor' ) ) {
if ( empty( $_POST['menu-item-db-id'] ) || ! in_array( $menu_item_db_id, $_POST['menu-item-db-id'] ) ) {
return;
}
-
+ //var_dump($_POST['menu-item-um_nav_roles']); exit;
foreach ( self::$fields as $_key => $label ) {
$key = sprintf( 'menu-item-%s', $_key );
@@ -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;
}