Ultimate Member – User Profile & Membership Plugin - Version 2.0.13

Version Description

Download this release

Release Info

Developer nsinelnikov
Plugin Icon 128x128 Ultimate Member – User Profile & Membership Plugin
Version 2.0.13
Comparing to
See all releases

Code changes from version 2.0.17 to 2.0.13

Files changed (37) hide show
  1. assets/css/um-profile.css +6 -24
  2. assets/js/um-gdpr.js +0 -22
  3. assets/js/um-gdpr.min.js +0 -1
  4. includes/admin/class-admin.php +0 -24
  5. includes/admin/core/class-admin-gdpr.php +0 -316
  6. includes/admin/core/class-admin-menu.php +0 -15
  7. includes/admin/core/class-admin-notices.php +2 -33
  8. includes/admin/core/class-admin-settings.php +3 -5
  9. includes/admin/core/class-admin-upgrade.php +6 -34
  10. includes/admin/core/packages/2.0-beta1/email_templates.php +2 -2
  11. includes/admin/core/packages/2.0-beta1/menus.php +1 -7
  12. includes/admin/templates/dashboard/upgrade-request.php +0 -6
  13. includes/admin/templates/form/register_gdpr.php +0 -71
  14. includes/admin/templates/gdpr.php +0 -40
  15. includes/class-dependencies.php +0 -1
  16. includes/class-init.php +43 -49
  17. includes/core/class-access.php +1 -62
  18. includes/core/class-account.php +3 -2
  19. includes/core/class-builtin.php +1 -1
  20. includes/core/class-enqueue.php +0 -2
  21. includes/core/class-fields.php +13 -34
  22. includes/core/class-form.php +14 -2
  23. includes/core/class-gdpr.php +0 -86
  24. includes/core/class-mail.php +18 -6
  25. includes/core/class-profile.php +0 -7
  26. includes/core/class-user.php +63 -104
  27. includes/core/um-actions-core.php +1 -3
  28. includes/core/um-actions-form.php +5 -6
  29. includes/core/um-actions-password.php +19 -0
  30. includes/core/um-actions-profile.php +18 -33
  31. includes/core/um-actions-register.php +6 -45
  32. includes/core/um-filters-fields.php +11 -63
  33. includes/core/um-navmenu.php +2 -3
  34. includes/um-short-functions.php +21 -35
  35. readme.txt +1 -42
  36. templates/gdpr-register.php +0 -44
  37. ultimate-member.php +1 -1
assets/css/um-profile.css CHANGED
@@ -393,31 +393,13 @@ font-weight: normal;
393
border-bottom: 0 !important;
394
}
395
396
- .um-profile-nav-item.without-icon a {
397
- padding-left: 10px;
398
- }
399
- .um-profile-nav-item.without-icon span.title {
400
- padding-left: 0;
401
- }
402
- .um-profile-nav-item.without-icon i {
403
- display: none;
404
- }
405
406
- .um-profile-nav-item a:hover {
407
- background: #555;
408
- }
409
- .um-profile-nav-item i {
410
- font-size: 18px;
411
- height: 18px;
412
- line-height: 18px;
413
- position: absolute;
414
- display: block;
415
- top: 8px;
416
- left: 10px;
417
- }
418
- .um-profile-nav-item span.title {
419
- padding-left: 5px;
420
- }
421
.um-profile-nav-item span.count {
422
font-size: 12px;
423
font-weight: 300;
393
border-bottom: 0 !important;
394
}
395
396
+ .um-profile-nav-item.without-icon a {padding-left: 10px}
397
+ .um-profile-nav-item.without-icon span.title {padding-left: 0}
398
+ .um-profile-nav-item.without-icon i {display: none}
399
400
+ .um-profile-nav-item a:hover {background: #555}
401
+ .um-profile-nav-item i {font-size: 18px;height: 18px;line-height: 18px;position: absolute;display: block;top: 8px;left: 10px}
402
+ .um-profile-nav-item span.title {padding-left: 5px}
403
.um-profile-nav-item span.count {
404
font-size: 12px;
405
font-weight: 300;
assets/js/um-gdpr.js DELETED
@@ -1,22 +0,0 @@
1
- (function( $ ) {
2
- 'use strict';
3
-
4
- $(document).on('click', "a.um-toggle-gdpr" ,function() {
5
-
6
- var me = jQuery(this);
7
-
8
- $( ".um-gdpr-content" ).toggle( "fast", function() {
9
- if( $( ".um-gdpr-content" ).is(':visible') ){
10
- me.text( me.data('toggle-hide') );
11
- }
12
-
13
- if( $( ".um-gdpr-content" ).is(':hidden') ){
14
- me.text( me.data('toggle-show') );
15
- }
16
-
17
- });
18
-
19
- });
20
-
21
-
22
- })( jQuery );
assets/js/um-gdpr.min.js DELETED
@@ -1 +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);
includes/admin/class-admin.php CHANGED
@@ -35,7 +35,6 @@ if ( ! class_exists( 'um\admin\Admin' ) ) {
35
36
add_action( 'um_admin_do_action__user_cache', array( &$this, 'user_cache' ) );
37
add_action( 'um_admin_do_action__purge_temp', array( &$this, 'purge_temp' ) );
38
- add_action( 'um_admin_do_action__manual_upgrades_request', array( &$this, 'manual_upgrades_request' ) );
39
add_action( 'um_admin_do_action__duplicate_form', array( &$this, 'duplicate_form' ) );
40
add_action( 'um_admin_do_action__um_language_downloader', array( &$this, 'um_language_downloader' ) );
41
add_action( 'um_admin_do_action__um_hide_locale_notice', array( &$this, 'um_hide_notice' ) );
@@ -49,29 +48,6 @@ if ( ! class_exists( 'um\admin\Admin' ) ) {
49
}
50
51
52
- function manual_upgrades_request() {
53
- if ( ! is_admin() || ! current_user_can( 'manage_options' ) ) {
54
- die();
55
- }
56
-
57
- $last_request = get_option( 'um_last_manual_upgrades_request', false );
58
-
59
- if ( empty( $last_request ) || time() > $last_request + DAY_IN_SECONDS ) {
60
-
61
- delete_transient( 'update_plugins' );
62
- delete_site_transient( 'update_plugins' );
63
-
64
- UM()->plugin_updater()->um_checklicenses();
65
-
66
- update_option( 'um_last_manual_upgrades_request', time() );
67
-
68
- $url = add_query_arg( array( 'page' => 'ultimatemember', 'update' => 'got_updates' ), admin_url( 'admin.php' ) );
69
- } else {
70
- $url = add_query_arg( array( 'page' => 'ultimatemember', 'update' => 'often_updates' ), admin_url( 'admin.php' ) );
71
- }
72
- exit( wp_redirect( $url ) );
73
- }
74
-
75
76
/**
77
* Clear all users cache
35
36
add_action( 'um_admin_do_action__user_cache', array( &$this, 'user_cache' ) );
37
add_action( 'um_admin_do_action__purge_temp', array( &$this, 'purge_temp' ) );
38
add_action( 'um_admin_do_action__duplicate_form', array( &$this, 'duplicate_form' ) );
39
add_action( 'um_admin_do_action__um_language_downloader', array( &$this, 'um_language_downloader' ) );
40
add_action( 'um_admin_do_action__um_hide_locale_notice', array( &$this, 'um_hide_notice' ) );
48
}
49
50
51
52
/**
53
* Clear all users cache
includes/admin/core/class-admin-gdpr.php DELETED
@@ -1,316 +0,0 @@
1
- <?php
2
- namespace um\admin\core;
3
-
4
- // Exit if accessed directly.
5
- if ( ! defined( 'ABSPATH' ) ) exit;
6
-
7
-
8
- if ( ! class_exists( 'um\admin\core\Admin_GDPR' ) ) {
9
-
10
-
11
- /**
12
- * Class Admin_GDPR
13
- * @package um\admin\core
14
- */
15
- class Admin_GDPR {
16
-
17
- /**
18
- * @var array
19
- */
20
- var $meta_associations = array();
21
-
22
-
23
- /**
24
- * Admin_GDPR constructor.
25
- */
26
- function __construct() {
27
- add_action( 'init', array( &$this, 'init_fields' ), 10 );
28
- add_action( 'admin_init', array( &$this, 'plugin_add_suggested_privacy_content' ), 20 );
29
- add_filter( 'wp_privacy_personal_data_exporters', array( &$this, 'plugin_register_exporters' ) );
30
- add_filter( 'wp_privacy_personal_data_erasers', array( &$this, 'plugin_register_erasers' ) );
31
-
32
- add_action( 'um_admin_custom_register_metaboxes', array( &$this, 'add_metabox_register' ) );
33
- }
34
-
35
-
36
- /**
37
- *
38
- */
39
- function add_metabox_register() {
40
- add_meta_box(
41
- "um-admin-form-register_gdpr",
42
- __( 'Privacy Policy', 'ultimate-member' ),
43
- array( UM()->metabox(), 'load_metabox_form' ),
44
- 'um_form',
45
- 'side',
46
- 'default'
47
- );
48
- }
49
-
50
-
51
- /**
52
- *
53
- */
54
- function init_fields() {
55
- $this->meta_associations = array(
56
-
57
- 'account_status' => __( 'Account Status', 'ultimate-member' ),
58
- 'submitted' => __( 'Submitted data on Registration', 'ultimate-member' ),
59
- 'form_id' => __( 'Registration Form ID', 'ultimate-member' ),
60
- 'timestamp' => __( 'Registration Timestamp', 'ultimate-member' ),
61
- 'request' => __( 'Registration Request', 'ultimate-member' ),
62
- '_wpnonce' => __( 'Registration Nonce', 'ultimate-member' ),
63
- '_wp_http_referer' => __( 'Registration HTTP referer', 'ultimate-member' ),
64
- 'role' => __( 'Community Role', 'ultimate-member' ),
65
- 'um_user_profile_url_slug_user_login' => __( 'Profile Slug "Username"', 'ultimate-member' ),
66
- 'um_user_profile_url_slug_name' => __( 'Profile Slug "First and Last Name with \'.\'"', 'ultimate-member' ),
67
- 'um_user_profile_url_slug_name_dash' => __( 'Profile Slug "First and Last Name with \'-\'"', 'ultimate-member' ),
68
- 'um_user_profile_url_slug_name_plus' => __( 'Profile Slug "First and Last Name with \'+\'"', 'ultimate-member' ),
69
- 'um_user_profile_url_slug_user_id' => __( 'Profile Slug "User ID"', 'ultimate-member' ),
70
- '_um_last_login' => __( 'Last Login Timestamp', 'ultimate-member' ),
71
-
72
- //Private content extension
73
- '_um_private_content_post_id' => __( 'Private Content Post ID', 'ultimate-member' ),
74
-
75
- //Verified Users extension
76
- '_um_verified' => __( 'Verified Account', 'ultimate-member' ),
77
-
78
- //Terms & Conditions extension
79
- 'use_terms_conditions_agreement' => __( 'Terms&Conditions Agreement', 'ultimate-member' ),
80
-
81
- //GDPR extension
82
- 'use_gdpr_agreement' => __( 'Privacy Policy Agreement', 'ultimate-member' ),
83
-
84
-
85
- );
86
-
87
- $all_fields = UM()->builtin()->all_user_fields( null, true );
88
- unset( $all_fields[0] );
89
-
90
- $all_fields = array_map( function( $value ) {
91
- return $value['title'];
92
- }, $all_fields );
93
-
94
- $this->meta_associations = array_merge( $this->meta_associations, $all_fields );
95
-
96
- /**
97
- * UM hook
98
- *
99
- * @type filter
100
- * @title um_gdpr_meta_associations
101
- * @description Exclude taxonomies for UM
102
- * @input_vars
103
- * [{"var":"$meta_associations","type":"array","desc":"Meta Keys Titles"}]
104
- * @change_log
105
- * ["Since: 2.0.14"]
106
- * @usage
107
- * <?php add_filter( 'um_gdpr_meta_associations', 'function_name', 10, 1 ); ?>
108
- * @example
109
- * <?php
110
- * add_filter( 'um_gdpr_meta_associations', 'my_gdpr_meta_associations', 10, 1 );
111
- * function my_gdpr_meta_associations( $meta_associations ) {
112
- * // your code here
113
- * return $meta_associations;
114
- * }
115
- * ?>
116
- */
117
- $this->meta_associations = apply_filters( 'um_gdpr_meta_associations', $this->meta_associations );
118
- }
119
-
120
-
121
- /**
122
- * Return the default suggested privacy policy content.
123
- *
124
- * @return string The default policy content.
125
- */
126
- function plugin_get_default_privacy_content() {
127
- ob_start();
128
-
129
- include UM()->admin()->templates_path . 'gdpr.php';
130
-
131
- return ob_get_clean();
132
- }
133
-
134
-
135
- /**
136
- * Add the suggested privacy policy text to the policy postbox.
137
- */
138
- function plugin_add_suggested_privacy_content() {
139
- $content = $this->plugin_get_default_privacy_content();
140
- wp_add_privacy_policy_content( ultimatemember_plugin_name, $content );
141
- }
142
-
143
-
144
- /**
145
- * Register exporter for Plugin user data.
146
- *
147
- * @see https://github.com/allendav/wp-privacy-requests/blob/master/EXPORT.md
148
- *
149
- * @param $exporters
150
- *
151
- * @return array
152
- */
153
- function plugin_register_exporters( $exporters ) {
154
- $exporters[] = array(
155
- 'exporter_friendly_name' => ultimatemember_plugin_name,
156
- 'callback' => array( &$this, 'data_exporter' )
157
- );
158
- return $exporters;
159
- }
160
-
161
-
162
- /**
163
- * Get user metadata in key => value array
164
- *
165
- *
166
- * @param $user_id
167
- *
168
- * @return array
169
- */
170
- function get_metadata( $user_id ) {
171
- global $wpdb;
172
-
173
- $metadata = $wpdb->get_results( $wpdb->prepare(
174
- "SELECT meta_key, meta_value
175
- FROM {$wpdb->usermeta}
176
- WHERE user_id = %d",
177
- $user_id
178
- ), ARRAY_A );
179
-
180
- $filtered = array();
181
- foreach ( $metadata as $data ) {
182
- if ( in_array( $data['meta_key'], array_keys( $this->meta_associations ) ) ) {
183
- $filtered[] = array(
184
- 'key' => $data['meta_key'],
185
- 'name' => $this->meta_associations[ $data['meta_key'] ],
186
- //'value' => maybe_unserialize( $data['meta_value'] ),
187
- 'value' => $data['meta_value'],
188
- );
189
- }
190
- }
191
-
192
- return $filtered;
193
- }
194
-
195
-
196
- /**
197
- * Exporter for Plugin user data.
198
- *
199
- * @see https://github.com/allendav/wp-privacy-requests/blob/master/EXPORT.md
200
- *
201
- * @param $email_address
202
- * @param int $page
203
- *
204
- * @return array
205
- */
206
- function data_exporter( $email_address, $page = 1 ) {
207
- $export_items = array();
208
- $user = get_user_by( 'email', $email_address );
209
-
210
- if ( $user && $user->ID ) {
211
- // Most item IDs should look like postType-postID
212
- // If you don't have a post, comment or other ID to work with,
213
- // use a unique value to avoid having this item's export
214
- // combined in the final report with other items of the same id
215
- $item_id = "ultimate-member-{$user->ID}";
216
-
217
- // Core group IDs include 'comments', 'posts', etc.
218
- // But you can add your own group IDs as needed
219
- $group_id = 'ultimate-member';
220
-
221
- // Optional group label. Core provides these for core groups.
222
- // If you define your own group, the first exporter to
223
- // include a label will be used as the group label in the
224
- // final exported report
225
- $group_label = ultimatemember_plugin_name;
226
-
227
- // Plugins can add as many items in the item data array as they want
228
- //$data = array();
229
-
230
- $data = $this->get_metadata( $user->ID );
231
-
232
- if ( ! empty( $data ) ) {
233
- // Add this group of items to the exporters data array.
234
- $export_items[] = array(
235
- 'group_id' => $group_id,
236
- 'group_label' => $group_label,
237
- 'item_id' => $item_id,
238
- 'data' => $data,
239
- );
240
- }
241
- }
242
- // Returns an array of exported items for this pass, but also a boolean whether this exporter is finished.
243
- //If not it will be called again with $page increased by 1.
244
- return array(
245
- 'data' => $export_items,
246
- 'done' => true,
247
- );
248
- }
249
-
250
-
251
- /**
252
- * Register eraser for Plugin user data.
253
- *
254
- * @param array $erasers
255
- *
256
- * @return array
257
- */
258
- function plugin_register_erasers( $erasers = array() ) {
259
- $erasers[] = array(
260
- 'eraser_friendly_name' => ultimatemember_plugin_name,
261
- 'callback' => array( &$this, 'data_eraser' )
262
- );
263
- return $erasers;
264
- }
265
-
266
-
267
- /**
268
- * Eraser for Plugin user data.
269
- *
270
- * @param $email_address
271
- * @param int $page
272
- *
273
- * @return array
274
- */
275
- function data_eraser( $email_address, $page = 1 ) {
276
- if ( empty( $email_address ) ) {
277
- return array(
278
- 'items_removed' => false,
279
- 'items_retained' => false,
280
- 'messages' => array(),
281
- 'done' => true,
282
- );
283
- }
284
-
285
- $user = get_user_by( 'email', $email_address );
286
- $messages = array();
287
- $items_removed = false;
288
- $items_retained = false;
289
-
290
- if ( $user && $user->ID ) {
291
- $data = $this->get_metadata( $user->ID );
292
-
293
- foreach ( $data as $metadata ) {
294
- $deleted = delete_user_meta( $user->ID, $metadata['key'] );
295
- if ( $deleted ) {
296
- $items_removed = true;
297
- } else {
298
- $messages[] = sprintf( __( 'Your %s was unable to be removed at this time.', 'ultimate-member' ), $metadata['name'] );
299
- $items_retained = true;
300
- }
301
- }
302
- }
303
-
304
- // Returns an array of exported items for this pass, but also a boolean whether this exporter is finished.
305
- //If not it will be called again with $page increased by 1.
306
- return array(
307
- 'items_removed' => $items_removed,
308
- 'items_retained' => $items_retained,
309
- 'messages' => $messages,
310
- 'done' => true,
311
- );
312
- }
313
-
314
- }
315
-
316
- }
includes/admin/core/class-admin-menu.php CHANGED
@@ -206,7 +206,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Menu' ) ) {
206
add_meta_box( 'um-metaboxes-mainbox-1', __( 'Latest from our blog', 'ultimate-member' ), array( &$this, 'um_news' ), $this->pagehook, 'normal', 'core' );
207
208
add_meta_box( 'um-metaboxes-sidebox-1', __( 'Purge Temp Files', 'ultimate-member' ), array( &$this, 'purge_temp' ), $this->pagehook, 'side', 'core' );
209
-
210
add_meta_box( 'um-metaboxes-sidebox-2', __( 'User Cache', 'ultimate-member' ), array( &$this, 'user_cache' ), $this->pagehook, 'side', 'core' );
211
212
if ( $this->language_avaialable_not_installed() ) {
@@ -216,12 +215,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Menu' ) ) {
216
} else if ( $this->language_not_available() ) {
217
add_meta_box( 'um-metaboxes-sidebox-2', __( 'Language', 'ultimate-member' ), array( &$this, 'ct_language' ), $this->pagehook, 'side', 'core' );
218
}
219
-
220
- //If there are active and licensed extensions - show metabox for upgrade it
221
- $exts = UM()->plugin_updater()->um_get_active_plugins();
222
- if ( 0 < count( $exts ) ) {
223
- add_meta_box( 'um-metaboxes-sidebox-3', __( 'Upgrade\'s Manual Request', 'ultimate-member' ), array( &$this, 'upgrade_request' ), $this->pagehook, 'side', 'core' );
224
- }
225
}
226
227
@@ -276,14 +269,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Menu' ) ) {
276
}
277
278
279
- /**
280
- *
281
- */
282
- function upgrade_request() {
283
- include_once UM()->admin()->templates_path . 'dashboard/upgrade-request.php';
284
- }
285
-
286
-
287
/**
288
*
289
*/
206
add_meta_box( 'um-metaboxes-mainbox-1', __( 'Latest from our blog', 'ultimate-member' ), array( &$this, 'um_news' ), $this->pagehook, 'normal', 'core' );
207
208
add_meta_box( 'um-metaboxes-sidebox-1', __( 'Purge Temp Files', 'ultimate-member' ), array( &$this, 'purge_temp' ), $this->pagehook, 'side', 'core' );
209
add_meta_box( 'um-metaboxes-sidebox-2', __( 'User Cache', 'ultimate-member' ), array( &$this, 'user_cache' ), $this->pagehook, 'side', 'core' );
210
211
if ( $this->language_avaialable_not_installed() ) {
215
} else if ( $this->language_not_available() ) {
216
add_meta_box( 'um-metaboxes-sidebox-2', __( 'Language', 'ultimate-member' ), array( &$this, 'ct_language' ), $this->pagehook, 'side', 'core' );
217
}
218
}
219
220
269
}
270
271
272
/**
273
*
274
*/
includes/admin/core/class-admin-notices.php CHANGED
@@ -38,7 +38,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
38
$this->localize_note();
39
$this->show_update_messages();
40
$this->check_wrong_install_folder();
41
- //$this->admin_notice_tracking();
42
$this->need_upgrade();
43
$this->check_wrong_licenses();
44
@@ -225,32 +225,9 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
225
function old_extensions_notice() {
226
$show = false;
227
228
- $old_extensions = array(
229
- 'bbpress',
230
- 'followers',
231
- 'friends',
232
- 'instagram',
233
- 'mailchimp',
234
- 'messaging',
235
- 'mycred',
236
- 'notices',
237
- 'notifications',
238
- 'online',
239
- 'private-content',
240
- 'profile-completeness',
241
- 'recaptcha',
242
- 'reviews',
243
- 'social-activity',
244
- 'social-login',
245
- 'terms-conditions',
246
- 'user-tags',
247
- 'verified-users',
248
- 'woocommerce',
249
- );
250
-
251
$slugs = array_map( function( $item ) {
252
return 'um-' . $item . '/um-' . $item . '.php';
253
- }, $old_extensions );
254
255
$active_plugins = UM()->dependencies()->get_active_plugins();
256
foreach ( $slugs as $slug ) {
@@ -420,14 +397,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
420
$messages[0]['content'] = __( 'Your user cache is now removed.', 'ultimate-member' );
421
break;
422
423
- case 'got_updates':
424
- $messages[0]['content'] = __( 'You got the latest upgrades.', 'ultimate-member' );
425
- break;
426
-
427
- case 'often_updates':
428
- $messages[0]['err_content'] = __( 'Try again later. You can run this action once daily.', 'ultimate-member' );
429
- break;
430
-
431
case 'form_duplicated':
432
$messages[0]['content'] = __( 'The form has been duplicated successfully.', 'ultimate-member' );
433
break;
38
$this->localize_note();
39
$this->show_update_messages();
40
$this->check_wrong_install_folder();
41
+ $this->admin_notice_tracking();
42
$this->need_upgrade();
43
$this->check_wrong_licenses();
44
225
function old_extensions_notice() {
226
$show = false;
227
228
$slugs = array_map( function( $item ) {
229
return 'um-' . $item . '/um-' . $item . '.php';
230
+ }, array_keys( UM()->dependencies()->ext_required_version ) );
231
232
$active_plugins = UM()->dependencies()->get_active_plugins();
233
foreach ( $slugs as $slug ) {
397
$messages[0]['content'] = __( 'Your user cache is now removed.', 'ultimate-member' );
398
break;
399
400
case 'form_duplicated':
401
$messages[0]['content'] = __( 'The form has been duplicated successfully.', 'ultimate-member' );
402
break;
includes/admin/core/class-admin-settings.php CHANGED
@@ -1197,14 +1197,12 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
1197
do_action( "um_settings_page_" . $current_tab . "_" . $current_subtab . "_before_section" );
1198
1199
$section_fields = $this->get_section_fields( $current_tab, $current_subtab );
1200
- $settings_section = $this->render_settings_section( $section_fields, $current_tab, $current_subtab );
1201
1202
/**
1203
* UM hook
1204
*
1205
* @type filter
1206
* @title um_settings_section_{$current_tab}_{$current_subtab}_content
1207
- *
1208
* @description Render settings section
1209
* @input_vars
1210
* [{"var":"$content","type":"string","desc":"Section content"},
@@ -1222,7 +1220,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
1222
* ?>
1223
*/
1224
echo apply_filters( 'um_settings_section_' . $current_tab . '_' . $current_subtab . '_content',
1225
- $settings_section,
1226
$section_fields
1227
);
1228
@@ -1260,7 +1258,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
1260
do_action( "um_settings_page_" . $current_tab . "_" . $current_subtab . "_before_section" );
1261
1262
$section_fields = $this->get_section_fields( $current_tab, $current_subtab );
1263
- $settings_section = $this->render_settings_section( $section_fields, $current_tab, $current_subtab );
1264
1265
/**
1266
* UM hook
@@ -1284,7 +1281,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
1284
* ?>
1285
*/
1286
echo apply_filters( 'um_settings_section_' . $current_tab . '_' . $current_subtab . '_content',
1287
- $settings_section,
1288
$section_fields
1289
);
1290
?>
@@ -2184,6 +2181,7 @@ Cache User Profile: <?php if( UM()->options()->get( 'um_profile_object_cache_s
2184
Generate Slugs on Directories: <?php if( UM()->options()->get( 'um_generate_slug_in_directory' ) == 1 ){ echo "No"; }else{ echo "Yes"; } echo "\n"; ?>
2185
Rewrite Rules: <?php if( UM()->options()->get( 'um_flush_stop' ) == 1 ){ echo "No"; }else{ echo "Yes"; } echo "\n"; ?>
2186
Force UTF-8 Encoding: <?php if( UM()->options()->get( 'um_force_utf8_strings' ) == 1 ){ echo "Yes"; }else{ echo "No"; } echo "\n"; ?>
2187
JS/CSS Compression: <?php if ( defined('SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) { echo "Yes"; }else{ echo "No"; } echo "\n"; ?>
2188
<?php if( is_multisite() ): ?>
2189
Network Structure: <?php echo UM()->options()->get( 'network_permalink_structure' ). "\n"; ?>
1197
do_action( "um_settings_page_" . $current_tab . "_" . $current_subtab . "_before_section" );
1198
1199
$section_fields = $this->get_section_fields( $current_tab, $current_subtab );
1200
1201
/**
1202
* UM hook
1203
*
1204
* @type filter
1205
* @title um_settings_section_{$current_tab}_{$current_subtab}_content
1206
* @description Render settings section
1207
* @input_vars
1208
* [{"var":"$content","type":"string","desc":"Section content"},
1220
* ?>
1221
*/
1222
echo apply_filters( 'um_settings_section_' . $current_tab . '_' . $current_subtab . '_content',
1223
+ $this->render_settings_section( $section_fields, $current_tab, $current_subtab ),
1224
$section_fields
1225
);
1226
1258
do_action( "um_settings_page_" . $current_tab . "_" . $current_subtab . "_before_section" );
1259
1260
$section_fields = $this->get_section_fields( $current_tab, $current_subtab );
1261
1262
/**
1263
* UM hook
1281
* ?>
1282
*/
1283
echo apply_filters( 'um_settings_section_' . $current_tab . '_' . $current_subtab . '_content',
1284
+ $this->render_settings_section( $section_fields, $current_tab, $current_subtab ),
1285
$section_fields
1286
);
1287
?>
2181
Generate Slugs on Directories: <?php if( UM()->options()->get( 'um_generate_slug_in_directory' ) == 1 ){ echo "No"; }else{ echo "Yes"; } echo "\n"; ?>
2182
Rewrite Rules: <?php if( UM()->options()->get( 'um_flush_stop' ) == 1 ){ echo "No"; }else{ echo "Yes"; } echo "\n"; ?>
2183
Force UTF-8 Encoding: <?php if( UM()->options()->get( 'um_force_utf8_strings' ) == 1 ){ echo "Yes"; }else{ echo "No"; } echo "\n"; ?>
2184
+ Time Check Security: <?php if( UM()->options()->get( 'enable_timebot' ) == 1 ){ echo "Yes"; }else{ echo "No"; } echo "\n"; ?>
2185
JS/CSS Compression: <?php if ( defined('SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) { echo "Yes"; }else{ echo "No"; } echo "\n"; ?>
2186
<?php if( is_multisite() ): ?>
2187
Network Structure: <?php echo UM()->options()->get( 'network_permalink_structure' ). "\n"; ?>
includes/admin/core/class-admin-upgrade.php CHANGED
@@ -17,12 +17,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Upgrade' ) ) {
17
class Admin_Upgrade {
18
19
20
- /**
21
- * @var null
22
- */
23
- protected static $instance = null;
24
-
25
-
26
/**
27
* @var
28
*/
@@ -37,25 +31,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Upgrade' ) ) {
37
var $packages_dir;
38
39
40
- /**
41
- * Main Admin_Upgrade Instance
42
- *
43
- * Ensures only one instance of UM is loaded or can be loaded.
44
- *
45
- * @since 1.0
46
- * @static
47
- * @see UM()
48
- * @return Admin_Upgrade - Main instance
49
- */
50
- static public function instance() {
51
- if ( is_null( self::$instance ) ) {
52
- self::$instance = new self();
53
- }
54
-
55
- return self::$instance;
56
- }
57
-
58
-
59
/**
60
* Admin_Upgrade constructor.
61
*/
@@ -64,14 +39,11 @@ if ( ! class_exists( 'um\admin\core\Admin_Upgrade' ) ) {
64
$this->necessary_packages = $this->need_run_upgrades();
65
66
if ( ! empty( $this->necessary_packages ) ) {
67
add_action( 'admin_menu', array( $this, 'admin_menu' ), 0 );
68
69
- if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
70
- $this->init_packages_ajax();
71
-
72
- add_action( 'wp_ajax_um_run_package', array( $this, 'ajax_run_package' ) );
73
- add_action( 'wp_ajax_um_get_packages', array( $this, 'ajax_get_packages' ) );
74
- }
75
}
76
77
//add_action( 'in_plugin_update_message-' . um_plugin, array( $this, 'in_plugin_update_message' ) );
@@ -171,7 +143,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Upgrade' ) ) {
171
foreach ( $this->necessary_packages as $package ) {
172
$hooks_file = $this->packages_dir . DIRECTORY_SEPARATOR . $package . DIRECTORY_SEPARATOR . 'hooks.php';
173
if ( file_exists( $hooks_file ) ) {
174
- $pack_ajax_hooks = include_once $hooks_file;
175
176
foreach ( $pack_ajax_hooks as $action => $function ) {
177
add_action( 'wp_ajax_um_' . $action, "um_upgrade_$function" );
@@ -188,7 +160,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Upgrade' ) ) {
188
foreach ( $this->necessary_packages as $package ) {
189
$handlers_file = $this->packages_dir . DIRECTORY_SEPARATOR . $package . DIRECTORY_SEPARATOR . 'functions.php';
190
if ( file_exists( $handlers_file ) ) {
191
- include_once $handlers_file;
192
}
193
}
194
}
@@ -318,7 +290,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Upgrade' ) ) {
318
exit('');
319
} else {
320
ob_start();
321
- include_once $this->packages_dir . DIRECTORY_SEPARATOR . $_POST['pack'] . DIRECTORY_SEPARATOR . 'init.php';
322
ob_get_flush();
323
exit;
324
}
17
class Admin_Upgrade {
18
19
20
/**
21
* @var
22
*/
31
var $packages_dir;
32
33
34
/**
35
* Admin_Upgrade constructor.
36
*/
39
$this->necessary_packages = $this->need_run_upgrades();
40
41
if ( ! empty( $this->necessary_packages ) ) {
42
+ $this->init_packages_ajax();
43
add_action( 'admin_menu', array( $this, 'admin_menu' ), 0 );
44
45
+ add_action( 'wp_ajax_um_run_package', array( $this, 'ajax_run_package' ) );
46
+ add_action( 'wp_ajax_um_get_packages', array( $this, 'ajax_get_packages' ) );
47
}
48
49
//add_action( 'in_plugin_update_message-' . um_plugin, array( $this, 'in_plugin_update_message' ) );
143
foreach ( $this->necessary_packages as $package ) {
144
$hooks_file = $this->packages_dir . DIRECTORY_SEPARATOR . $package . DIRECTORY_SEPARATOR . 'hooks.php';
145
if ( file_exists( $hooks_file ) ) {
146
+ $pack_ajax_hooks = include $hooks_file;
147
148
foreach ( $pack_ajax_hooks as $action => $function ) {
149
add_action( 'wp_ajax_um_' . $action, "um_upgrade_$function" );
160
foreach ( $this->necessary_packages as $package ) {
161
$handlers_file = $this->packages_dir . DIRECTORY_SEPARATOR . $package . DIRECTORY_SEPARATOR . 'functions.php';
162
if ( file_exists( $handlers_file ) ) {
163
+ include $handlers_file;
164
}
165
}
166
}
290
exit('');
291
} else {
292
ob_start();
293
+ include $this->packages_dir . DIRECTORY_SEPARATOR . $_POST['pack'] . DIRECTORY_SEPARATOR . 'init.php';
294
ob_get_flush();
295
exit;
296
}
includes/admin/core/packages/2.0-beta1/email_templates.php CHANGED
@@ -25,8 +25,8 @@ foreach ( $emails as $email_key => $value ) {
25
} else {
26
$setting_value = UM()->options()->get( $email_key );
27
28
- $fp = @fopen( $theme_template_path, "w" );
29
- $result = @fputs( $fp, $setting_value );
30
fclose( $fp );
31
}
32
} else {
25
} else {
26
$setting_value = UM()->options()->get( $email_key );
27
28
+ $fp = fopen( $theme_template_path, "w" );
29
+ $result = fputs( $fp, $setting_value );
30
fclose( $fp );
31
}
32
} else {
includes/admin/core/packages/2.0-beta1/menus.php CHANGED
@@ -18,15 +18,9 @@ $menus = get_posts( array(
18
foreach ( $menus as $menu ) {
19
$menu_roles = get_post_meta( $menu->ID, 'menu-item-um_nav_roles', true );
20
21
- if( !is_array( $menu_roles ) ) {
22
- $menu_roles = array();
23
- }
24
foreach ( $menu_roles as $i => $role_k ) {
25
- if( $role_k != '' && isset( $roles_associations[ $role_k ] ) ) {
26
- $menu_roles[ $i ] = $roles_associations[ $role_k ];
27
- }
28
}
29
30
-
31
update_post_meta( $menu->ID, 'menu-item-um_nav_roles', $menu_roles );
32
}
18
foreach ( $menus as $menu ) {
19
$menu_roles = get_post_meta( $menu->ID, 'menu-item-um_nav_roles', true );
20
21
foreach ( $menu_roles as $i => $role_k ) {
22
+ $menu_roles[ $i ] = $roles_associations[ $role_k ];
23
}
24
25
update_post_meta( $menu->ID, 'menu-item-um_nav_roles', $menu_roles );
26
}
includes/admin/templates/dashboard/upgrade-request.php DELETED
@@ -1,6 +0,0 @@
1
- <p><?php _e( 'Run this task from time to time if you have issues with WP Cron and need to get UM extension updates.', 'ultimate-member' ) ?></p>
2
- <p>
3
- <a href="<?php echo add_query_arg( 'um_adm_action', 'manual_upgrades_request' ); ?>" class="button">
4
- <?php _e( 'Get latest versions', 'ultimate-member' ) ?>
5
- </a>
6
- </p>
includes/admin/templates/form/register_gdpr.php DELETED
@@ -1,71 +0,0 @@
1
- <div class="um-admin-metabox">
2
-
3
- <?php
4
- $options = array(
5
- '' => __( 'Select page', 'ultimate-member' )
6
- );
7
-
8
- $pages = get_pages();
9
- foreach ( $pages as $page ) {
10
- $options[$page->ID] = $page->post_title;
11
- }
12
-
13
- UM()->admin_forms( array(
14
- 'class' => 'um-form-register-gdpr um-top-label',
15
- 'prefix_id' => 'form',
16
- 'fields' => array(
17
- array(
18
- 'id' => '_um_register_use_gdpr',
19
- 'type' => 'select',
20
- 'label' => __( 'Enable on this form', 'ultimate-member' ),
21
- 'value' => UM()->query()->get_meta_value( '_um_register_use_gdpr', null, '' ),
22
- 'options' => array(
23
- '0' => __( 'No', 'ultimate-member' ),
24
- '1' => __( 'Yes', 'ultimate-member' )
25
- ),
26
- ),
27
- array(
28
- 'id' => '_um_register_use_gdpr_content_id',
29
- 'type' => 'select',
30
- 'label' => __( 'Content', 'ultimate-member' ),
31
- 'value' => UM()->query()->get_meta_value('_um_register_use_gdpr_content_id', null, '' ),
32
- 'options' => $options,
33
- 'conditional' => array( '_um_register_use_gdpr', '=', '1' )
34
- ),
35
- array(
36
- 'id' => '_um_register_use_gdpr_toggle_show',
37
- 'type' => 'text',
38
- 'label' => __( 'Toggle Show text', 'ultimate-member' ),
39
- 'placeholder' => __( 'Show privacy policy', 'ultimate-member' ),
40
- 'value' => UM()->query()->get_meta_value('_um_register_use_gdpr_toggle_show', null, __( 'Show privacy policy', 'ultimate-member' ) ),
41
- 'conditional' => array( '_um_register_use_gdpr', '=', '1' )
42
- ),
43
- array(
44
- 'id' => '_um_register_use_gdpr_toggle_hide',
45
- 'type' => 'text',
46
- 'label' => __( 'Toggle Hide text', 'ultimate-member' ),
47
- 'placeholder' => __( 'Hide privacy policy', 'ultimate-member' ),
48
- 'value' => UM()->query()->get_meta_value('_um_register_use_gdpr_toggle_hide', null, __( 'Hide privacy policy', 'ultimate-member' ) ),
49
- 'conditional' => array( '_um_register_use_gdpr', '=', '1' )
50
- ),
51
- array(
52
- 'id' => '_um_register_use_gdpr_agreement',
53
- 'type' => 'text',
54
- 'label' => __( 'Checkbox agreement description', 'ultimate-member' ),
55
- 'placeholder' => __( 'Please confirm that you agree to our privacy policy', 'ultimate-member' ),
56
- 'value' => UM()->query()->get_meta_value('_um_register_use_gdpr_agreement', null, __( 'Please confirm that you agree to our privacy policy', 'ultimate-member' ) ),
57
- 'conditional' => array( '_um_register_use_gdpr', '=', '1' )
58
- ),
59
- array(
60
- 'id' => '_um_register_use_gdpr_error_text',
61
- 'type' => 'text',
62
- 'label' => __( 'Error Text', 'ultimate-member' ),
63
- 'placeholder' => __( 'Please confirm your acceptance of our privacy policy', 'ultimate-member' ),
64
- 'value' => UM()->query()->get_meta_value('_um_register_use_gdpr_error_text', null, __( 'Please confirm your acceptance of our privacy policy', 'ultimate-member' ) ),
65
- 'conditional' => array( '_um_register_use_gdpr', '=', '1' )
66
- )
67
- )
68
- ) )->render_form(); ?>
69
-
70
- <div class="um-admin-clear"></div>
71
- </div>
includes/admin/templates/gdpr.php DELETED
@@ -1,40 +0,0 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly. ?>
2
-
3
- <h2>
4
- <?php _e( 'What personal data we collect and why we collect it', 'ultimate-member' ); ?>
5
- </h2>
6
- <h3>
7
- <?php _e( 'Forms', 'ultimate-member' ); ?>
8
- </h3>
9
- <p>
10
- <?php printf( __( '%s provides you with forms for user registration, login and profiles.', 'ultimate-member' ), ultimatemember_plugin_name ); ?>
11
- </p>
12
- <p>
13
- <?php _e( 'Via these forms you are collecting personal data from your users.', 'ultimate-member' ); ?>
14
- </p>
15
- <p>
16
- <?php _e( 'You should include in your privacy policy what personal data is captured when someone submits/fills in one of the forms, why you collect it and what you do with this data and how long you keep it.', 'ultimate-member' ); ?>
17
- </p>
18
-
19
- <h2>
20
- <?php _e( 'How long we retain your data', 'ultimate-member' ); ?>
21
- </h2>
22
- <p>
23
- <?php _e( 'Registered user information is retained in your website’s database indefinitely.', 'ultimate-member' ); ?>
24
- </p>
25
- <p>
26
- <?php _e( 'Data can be exported or removed upon users request via the existing WordPress data exporter or eraser.', 'ultimate-member' ); ?>
27
- </p>
28
- <p>
29
- <?php _e( 'If syncing data to a 3rd party service (e.g Mailchimp via our MailChimp extension), data is retained there until unsubscribed or deleted.', 'ultimate-member' ); ?>
30
- </p>
31
-
32
- <h2>
33
- <?php _e( 'Where we send your data', 'ultimate-member' ); ?>
34
- </h2>
35
- <p>
36
- <?php printf( __( '%s does not send any user data outside of your site by default.', 'ultimate-member' ), ultimatemember_plugin_name ); ?>
37
- </p>
38
- <p>
39
- <?php _e( 'If you have extended the functionality of the plugin (e.g sending registered user data to MailChimp via our MailChimp extension, this user info may be passed to these external services. These services may be located abroad and outwith the EU.', 'ultimate-member' ); ?>
40
- </p>
includes/class-dependencies.php CHANGED
@@ -57,7 +57,6 @@ if ( ! class_exists( 'um\Dependencies' ) ) {
57
'woocommerce' => '2.0.1',
58
'restrict-content' => '2.0',
59
'beaver-builder' => '2.0',
60
- 'gdpr' => '1.0.0',
61
);
62
63
57
'woocommerce' => '2.0.1',
58
'restrict-content' => '2.0',
59
'beaver-builder' => '2.0',
60
);
61
62
includes/class-init.php CHANGED
@@ -30,7 +30,6 @@ if ( ! class_exists( 'UM' ) ) {
30
* @method UM_Terms_Conditions_API Terms_Conditions_API()
31
* @method UM_Private_Content_API Private_Content_API()
32
* @method UM_User_Location_API User_Location_API()
33
- * @method UM_GDPR_API GDPR_API()
34
*
35
*/
36
final class UM extends UM_Functions {
@@ -386,6 +385,47 @@ if ( ! class_exists( 'UM' ) ) {
386
}
387
388
389
/**
390
* Autoload UM classes handler
391
*
@@ -485,7 +525,6 @@ if ( ! class_exists( 'UM' ) ) {
485
$this->ajax_init();
486
$this->metabox();
487
$this->admin_upgrade()->init_packages_ajax_handlers();
488
- $this->admin_gdpr();
489
} elseif ( $this->is_request( 'admin' ) ) {
490
$this->admin();
491
$this->admin_menu();
@@ -498,7 +537,6 @@ if ( ! class_exists( 'UM' ) ) {
498
$this->users();
499
$this->dragdrop();
500
$this->plugin_updater();
501
- $this->admin_gdpr();
502
} elseif ( $this->is_request( 'frontend' ) ) {
503
$this->enqueue();
504
$this->account();
@@ -524,10 +562,9 @@ if ( ! class_exists( 'UM' ) ) {
524
$this->permalinks();
525
$this->modal();
526
$this->cron();
527
- //$this->tracking();
528
$this->mobile();
529
$this->external_integrations();
530
- $this->gdpr();
531
}
532
533
@@ -637,55 +674,12 @@ if ( ! class_exists( 'UM' ) ) {
637
*/
638
function admin_upgrade() {
639
if ( empty( $this->classes['admin_upgrade'] ) ) {
640
- $this->classes['admin_upgrade'] = um\admin\core\Admin_Upgrade::instance();
641
- //$this->classes['admin_upgrade'] = new um\admin\core\Admin_Upgrade();
642
}
643
return $this->classes['admin_upgrade'];
644
}
645
646
647
- /**
648
- * GDPR privacy policy
649
- *
650
- * @since 2.0.14
651
- *
652
- * @return bool|um\admin\core\Admin_GDPR()
653
- */
654
- function admin_gdpr() {
655
- global $wp_version;
656
-
657
- if ( version_compare( $wp_version, '4.9.6', '<' ) ) {
658
- return false;
659
- }
660
-
661
- if ( empty( $this->classes['admin_gdpr'] ) ) {
662
- $this->classes['admin_gdpr'] = new um\admin\core\Admin_GDPR();
663
- }
664
- return $this->classes['admin_gdpr'];
665
- }
666
-
667
-
668
- /**
669
- * GDPR privacy policy
670
- *
671
- * @since 2.0.14
672
- *
673
- * @return bool|um\core\GDPR()
674
- */
675
- function gdpr() {
676
- global $wp_version;
677
-
678
- if ( version_compare( $wp_version, '4.9.6', '<' ) ) {
679
- return false;
680
- }
681
-
682
- if ( empty( $this->classes['gdpr'] ) ) {
683
- $this->classes['gdpr'] = new um\core\GDPR();
684
- }
685
- return $this->classes['gdpr'];
686
- }
687
-
688
-
689
/**
690
* @since 2.0
691
*
30
* @method UM_Terms_Conditions_API Terms_Conditions_API()
31
* @method UM_Private_Content_API Private_Content_API()
32
* @method UM_User_Location_API User_Location_API()
33
*
34
*/
35
final class UM extends UM_Functions {
385
}
386
387
388
+ /**
389
+ * Show notice for customers with old extension's versions
390
+ */
391
+ /*function old_extensions_notice() {
392
+ if ( ! is_admin() ) {
393
+ return;
394
+ }
395
+
396
+ if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
397
+ return;
398
+ }
399
+
400
+ $show = false;
401
+
402
+ $slugs = array_map( function( $item ) {
403
+ return 'um-' . $item . '/um-' . $item . '.php';
404
+ }, array_keys( $this->dependencies()->ext_required_version ) );
405
+
406
+ $active_plugins = $this->dependencies()->get_active_plugins();
407
+ foreach ( $slugs as $slug ) {
408
+ if ( in_array( $slug, $active_plugins ) ) {
409
+ $plugin_data = get_plugin_data( um_path . '..' . DIRECTORY_SEPARATOR . $slug );
410
+ if ( version_compare( '2.0', $plugin_data['Version'], '>' ) ) {
411
+ $show = true;
412
+ break;
413
+ }
414
+ }
415
+ }
416
+
417
+ if ( ! $show ) {
418
+ return;
419
+ }
420
+
421
+ /*global $um_woocommerce;
422
+ remove_action( 'init', array( $um_woocommerce, 'plugin_check' ), 1 );
423
+ $um_woocommerce->plugin_inactive = true;*
424
+
425
+ echo '<div class="error"><p>' . sprintf( __( '<strong>%s %s</strong> requires 2.0 extensions. You have pre 2.0 extensions installed on your site. <br /> Please update %s extensions to latest versions. For more info see this <a href="%s" target="_blank">doc</a>.', 'ultimate-member' ), ultimatemember_plugin_name, ultimatemember_version, ultimatemember_plugin_name, 'http://docs.ultimatemember.com/article/266-updating-to-2-0-versions-of-extensions' ) . '</p></div>';
426
+ }*/
427
+
428
+
429
/**
430
* Autoload UM classes handler
431
*
525
$this->ajax_init();
526
$this->metabox();
527
$this->admin_upgrade()->init_packages_ajax_handlers();
528
} elseif ( $this->is_request( 'admin' ) ) {
529
$this->admin();
530
$this->admin_menu();
537
$this->users();
538
$this->dragdrop();
539
$this->plugin_updater();
540
} elseif ( $this->is_request( 'frontend' ) ) {
541
$this->enqueue();
542
$this->account();
562
$this->permalinks();
563
$this->modal();
564
$this->cron();
565
+ $this->tracking();
566
$this->mobile();
567
$this->external_integrations();
568
}
569
570
674
*/
675
function admin_upgrade() {
676
if ( empty( $this->classes['admin_upgrade'] ) ) {
677
+ $this->classes['admin_upgrade'] = new um\admin\core\Admin_Upgrade();
678
}
679
return $this->classes['admin_upgrade'];
680
}
681
682
683
/**
684
* @since 2.0
685
*
includes/core/class-access.php CHANGED
@@ -65,10 +65,6 @@ if ( ! class_exists( 'um\core\Access' ) ) {
65
add_action( 'template_redirect', array( &$this, 'template_redirect' ), 1000 );
66
add_action( 'um_access_check_individual_term_settings', array( &$this, 'um_access_check_individual_term_settings' ) );
67
add_action( 'um_access_check_global_settings', array( &$this, 'um_access_check_global_settings' ) );
68
-
69
- /* Disable comments if user has not permission to access current post */
70
- add_filter( 'comments_open', array( $this, 'disable_comments_open' ), 99, 2 );
71
- add_filter( 'get_comments_number', array( $this, 'disable_comments_open' ), 99, 2 );
72
}
73
74
@@ -536,7 +532,7 @@ if ( ! class_exists( 'um\core\Access' ) ) {
536
if ( ! empty( $post->post_type ) && $post->post_type == 'page' ) {
537
if ( um_is_core_post( $post, 'login' ) || um_is_core_post( $post, 'register' ) ||
538
um_is_core_post( $post, 'account' ) || um_is_core_post( $post, 'logout' ) ||
539
- um_is_core_post( $post, 'password-reset' ) || ( is_user_logged_in() && um_is_core_post( $post, 'user' ) ) )
540
return false;
541
}
542
@@ -938,63 +934,6 @@ if ( ! class_exists( 'um\core\Access' ) ) {
938
}
939
940
941
- /**
942
- * Disable comments if user has not permission to access this post
943
- * @param mixed $open
944
- * @param int $post_id
945
- * @return boolean
946
- */
947
- public function disable_comments_open( $open, $post_id ) {
948
-
949
- static $cache = array();
950
-
951
- if ( isset( $cache[ $post_id ] ) ) {
952
- return $cache[ $post_id ] ? $open : false;
953
- }
954
-
955
- $post = get_post( $post_id );
956
- $restriction = $this->get_post_privacy_settings( $post );
957
-
958
- if ( ! $restriction ) {
959
- $cache[ $post_id ] = $open;
960
- return $open;
961
- }
962
-
963
- if ( '1' == $restriction['_um_accessible'] ) {
964
-
965
- if ( is_user_logged_in() ) {
966
- if ( ! current_user_can( 'administrator' ) ) {
967
- $open = false;
968
- }
969
- }
970
-
971
- } elseif ( '2' == $restriction['_um_accessible'] ) {
972
- if ( ! is_user_logged_in() ) {
973
- $open = false;
974
- } else {
975
- if ( ! current_user_can( 'administrator' ) ) {
976
- $custom_restrict = $this->um_custom_restriction( $restriction );
977
-
978
- if ( empty( $restriction['_um_access_roles'] ) || false === array_search( '1', $restriction['_um_access_roles'] ) ) {
979
- if ( ! $custom_restrict ) {
980
- $open = false;
981
- }
982
- } else {
983
- $user_can = $this->user_can( get_current_user_id(), $restriction['_um_access_roles'] );
984
-
985
- if ( ! isset( $user_can ) || ! $user_can || ! $custom_restrict ) {
986
- $open = false;
987
- }
988
- }
989
- }
990
- }
991
- }
992
-
993
- $cache[ $post_id ] = $open;
994
- return $open;
995
- }
996
-
997
-
998
/**
999
* Protect Post Types in menu query
1000
* Restrict content new logic
65
add_action( 'template_redirect', array( &$this, 'template_redirect' ), 1000 );
66
add_action( 'um_access_check_individual_term_settings', array( &$this, 'um_access_check_individual_term_settings' ) );
67
add_action( 'um_access_check_global_settings', array( &$this, 'um_access_check_global_settings' ) );
68
}
69
70
532
if ( ! empty( $post->post_type ) && $post->post_type == 'page' ) {
533
if ( um_is_core_post( $post, 'login' ) || um_is_core_post( $post, 'register' ) ||
534
um_is_core_post( $post, 'account' ) || um_is_core_post( $post, 'logout' ) ||
535
+ um_is_core_post( $post, 'password-reset' ) )
536
return false;
537
}
538
934
}
935
936
937
/**
938
* Protect Post Types in menu query
939
* Restrict content new logic
includes/core/class-account.php CHANGED
@@ -55,7 +55,6 @@ if ( ! class_exists( 'um\core\Account' ) ) {
55
* @param $args
56
*/
57
function init_tabs( $args ) {
58
-
59
$this->tabs = $this->get_tabs();
60
61
ksort( $this->tabs );
@@ -76,6 +75,7 @@ if ( ! class_exists( 'um\core\Account' ) ) {
76
}
77
78
}
79
$this->tabs = $tabs_structed;
80
}
81
@@ -527,7 +527,7 @@ if ( ! class_exists( 'um\core\Account' ) ) {
527
* ?>
528
*/
529
$args = apply_filters( 'um_account_tab_privacy_fields', $args, $shortcode_args );
530
-
531
$fields = UM()->builtin()->get_specific_fields( $args );
532
$fields = $this->account_secure_fields( $fields, $id );
533
$fields = $this->filter_fields_by_attrs( $fields, $shortcode_args );
@@ -535,6 +535,7 @@ if ( ! class_exists( 'um\core\Account' ) ) {
535
foreach ( $fields as $key => $data ){
536
$output .= UM()->fields()->edit_field( $key, $data );
537
}
538
break;
539
540
case 'delete':
55
* @param $args
56
*/
57
function init_tabs( $args ) {
58
$this->tabs = $this->get_tabs();
59
60
ksort( $this->tabs );
75
}
76
77
}
78
+
79
$this->tabs = $tabs_structed;
80
}
81
527
* ?>
528
*/
529
$args = apply_filters( 'um_account_tab_privacy_fields', $args, $shortcode_args );
530
+
531
$fields = UM()->builtin()->get_specific_fields( $args );
532
$fields = $this->account_secure_fields( $fields, $id );
533
$fields = $this->filter_fields_by_attrs( $fields, $shortcode_args );
535
foreach ( $fields as $key => $data ){
536
$output .= UM()->fields()->edit_field( $key, $data );
537
}
538
+
539
break;
540
541
case 'delete':
includes/core/class-builtin.php CHANGED
@@ -1252,7 +1252,7 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
1252
*/
1253
$fields_without_metakey = apply_filters( 'um_fields_without_metakey', $fields_without_metakey );
1254
1255
- if ( ! $show_all ) {
1256
$this->fields_dropdown = array('image','file','password','rating');
1257
$this->fields_dropdown = array_merge( $this->fields_dropdown, $fields_without_metakey );
1258
} else {
1252
*/
1253
$fields_without_metakey = apply_filters( 'um_fields_without_metakey', $fields_without_metakey );
1254
1255
+ if ( !$show_all ) {
1256
$this->fields_dropdown = array('image','file','password','rating');
1257
$this->fields_dropdown = array_merge( $this->fields_dropdown, $fields_without_metakey );
1258
} else {
includes/core/class-enqueue.php CHANGED
@@ -319,8 +319,6 @@ if ( ! class_exists( 'um\core\Enqueue' ) ) {
319
wp_register_script('um_functions', um_url . 'assets/js/um-functions' . $this->suffix . '.js', array('jquery', 'jquery-masonry') );
320
wp_enqueue_script('um_functions');
321
322
- wp_enqueue_script( 'um-gdpr', um_url . 'assets/js/um-gdpr' . $this->suffix . '.js', array( 'jquery' ), ultimatemember_version, false );
323
-
324
}
325
326
319
wp_register_script('um_functions', um_url . 'assets/js/um-functions' . $this->suffix . '.js', array('jquery', 'jquery-masonry') );
320
wp_enqueue_script('um_functions');
321
322
}
323
324
includes/core/class-fields.php CHANGED
@@ -573,8 +573,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
573
574
} elseif ( um_user( $key ) && $this->editing == true ) {
575
576
- //show empty value for password fields
577
- if ( strstr( $key, 'user_pass' ) || $type == 'password' ) {
578
return '';
579
}
580
@@ -799,11 +798,6 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
799
return true;
800
}
801
802
- $stripslashed = array_map( 'stripslashes', UM()->form()->post_form[ $key ] );
803
- if ( in_array( $value, $stripslashed ) ) {
804
- return true;
805
- }
806
-
807
if ( in_array( html_entity_decode( $value ), UM()->form()->post_form[ $key ] ) ) {
808
return true;
809
}
@@ -814,21 +808,16 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
814
815
$field_value = um_user( $key );
816
817
- if ( $key == 'role' ) {
818
819
$role_keys = get_option( 'um_roles' );
820
821
- if ( ! empty( $role_keys ) ) {
822
- if ( in_array( $field_value, $role_keys ) ) {
823
$field_value = 'um_' . $field_value;
824
}
825
}
826
- /*elseif( $this->set_mode == 'register' ){
827
- $data['default'] = UM()->options()->get( 'register_role' );
828
- }
829
- else{
830
- $data['default'] = get_option( 'default_role' );
831
- }*/
832
}
833
834
/**
@@ -941,25 +930,19 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
941
942
$um_user_value = um_user( $key );
943
944
- if ( $key == 'role' ) {
945
$um_user_value = strtolower( $um_user_value );
946
947
$role_keys = get_option( 'um_roles' );
948
949
- if ( ! empty( $role_keys ) ) {
950
- if ( in_array( $um_user_value, $role_keys ) ) {
951
$um_user_value = 'um_' . $um_user_value;
952
}
953
}
954
- /*elseif( $this->set_mode == 'register' ){
955
- $data['default'] = UM()->options()->get( 'register_role' );
956
- }
957
- else{
958
- $data['default'] = get_option( 'default_role' );
959
- }*/
960
}
961
962
- if ( $um_user_value == $value ) {
963
return true;
964
}
965
@@ -1595,7 +1578,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
1595
1596
if ($visibility == 'view' && $this->set_mode != 'register') return;
1597
1598
- if ( ( $visibility == 'view' && $this->set_mode == 'register' ) ||
1599
( isset( $data['editable'] ) && $data['editable'] == 0 && $this->set_mode == 'profile' )
1600
) {
1601
@@ -1636,7 +1619,6 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
1636
// forbidden in edit mode?
1637
if (isset( $data['edit_forbidden'] )) return;
1638
1639
-
1640
// required option
1641
if (isset( $data['required_opt'] )) {
1642
$opt = $data['required_opt'];
@@ -2890,7 +2872,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
2890
$um_field_checkbox_item_title = $v;
2891
$option_value = $v;
2892
2893
- if ( ! is_numeric( $k ) && in_array( $form_key, array( 'role', 'role_radio' ) ) ) {
2894
$um_field_checkbox_item_title = $v;
2895
$option_value = $k;
2896
}
@@ -3484,12 +3466,9 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
3484
3485
if (isset( $data['in_group'] ) && $data['in_group'] != '' && $rule != 'group') return;
3486
3487
- if ( $visibility == 'edit' ) return;
3488
-
3489
- //invisible on profile page
3490
- if ( $type == 'password' ) return;
3491
3492
- if ( in_array( $type, array( 'block', 'shortcode', 'spacing', 'divider', 'group' ) ) ) {
3493
3494
} else {
3495
573
574
} elseif ( um_user( $key ) && $this->editing == true ) {
575
576
+ if ( strstr( $key, 'user_pass' ) ) {
577
return '';
578
}
579
798
return true;
799
}
800
801
if ( in_array( html_entity_decode( $value ), UM()->form()->post_form[ $key ] ) ) {
802
return true;
803
}
808
809
$field_value = um_user( $key );
810
811
+ if ($key == 'role') {
812
813
$role_keys = get_option( 'um_roles' );
814
815
+ if (!empty( $role_keys )) {
816
+ if (in_array( $field_value, $role_keys )) {
817
$field_value = 'um_' . $field_value;
818
}
819
}
820
+
821
}
822
823
/**
930
931
$um_user_value = um_user( $key );
932
933
+ if ($key == 'role') {
934
$um_user_value = strtolower( $um_user_value );
935
936
$role_keys = get_option( 'um_roles' );
937
938
+ if (!empty( $role_keys )) {
939
+ if (in_array( $um_user_value, $role_keys )) {
940
$um_user_value = 'um_' . $um_user_value;
941
}
942
}
943
}
944
945
+ if ($um_user_value == $value) {
946
return true;
947
}
948
1578
1579
if ($visibility == 'view' && $this->set_mode != 'register') return;
1580
1581
+ if (( $visibility == 'view' && $this->set_mode == 'register' ) ||
1582
( isset( $data['editable'] ) && $data['editable'] == 0 && $this->set_mode == 'profile' )
1583
) {
1584
1619
// forbidden in edit mode?
1620
if (isset( $data['edit_forbidden'] )) return;
1621
1622
// required option
1623
if (isset( $data['required_opt'] )) {
1624
$opt = $data['required_opt'];
2872
$um_field_checkbox_item_title = $v;
2873
$option_value = $v;
2874
2875
+ if (!is_numeric( $k ) && in_array( $form_key, array( 'role' ) )) {
2876
$um_field_checkbox_item_title = $v;
2877
$option_value = $k;
2878
}
3466
3467
if (isset( $data['in_group'] ) && $data['in_group'] != '' && $rule != 'group') return;
3468
3469
+ if ($visibility == 'edit') return;
3470
3471
+ if (in_array( $type, array( 'block', 'shortcode', 'spacing', 'divider', 'group' ) )) {
3472
3473
} else {
3474
includes/core/class-form.php CHANGED
@@ -331,6 +331,19 @@ if ( ! class_exists( 'um\core\Form' ) ) {
331
wp_die( 'Hello, spam bot!', 'ultimate-member' );
332
}
333
334
/**
335
* UM hook
336
*
@@ -465,9 +478,8 @@ if ( ! class_exists( 'um\core\Form' ) ) {
465
$global_role = get_option( 'default_role' ); // WP Global settings
466
467
$um_global_role = UM()->options()->get( 'register_role' ); // UM Settings Global settings
468
- if ( ! empty( $um_global_role ) ) {
469
$global_role = $um_global_role; // Form Global settings
470
- }
471
472
473
$mode = $this->form_type( $post_id );
331
wp_die( 'Hello, spam bot!', 'ultimate-member' );
332
}
333
334
+ if ( ! in_array( $this->form_data['mode'], array( 'login' ) ) ) {
335
+
336
+ $form_timestamp = trim($_POST['timestamp']);
337
+ $live_timestamp = current_time( 'timestamp' );
338
+
339
+ if ( $form_timestamp == '' && UM()->options()->get( 'enable_timebot' ) == 1 )
340
+ wp_die( __('Hello, spam bot!','ultimate-member') );
341
+
342
+ if ( !current_user_can('manage_options') && $live_timestamp - $form_timestamp < 6 && UM()->options()->get( 'enable_timebot' ) == 1 )
343
+ 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') );
344
+
345
+ }
346
+
347
/**
348
* UM hook
349
*
478
$global_role = get_option( 'default_role' ); // WP Global settings
479
480
$um_global_role = UM()->options()->get( 'register_role' ); // UM Settings Global settings
481
+ if ( ! empty( $um_global_role ) )
482
$global_role = $um_global_role; // Form Global settings
483
484
485
$mode = $this->form_type( $post_id );
includes/core/class-gdpr.php DELETED
@@ -1,86 +0,0 @@
1
- <?php
2
- namespace um\core;
3
-
4
- // Exit if accessed directly.
5
- if ( ! defined( 'ABSPATH' ) ) exit;
6
-
7
-
8
- if ( ! class_exists( 'um\core\GDPR' ) ) {
9
-
10
-
11
- /**
12
- * Class Admin_GDPR
13
- * @package um\core
14
- */
15
- class GDPR {
16
-
17
-
18
- /**
19
- * Admin_GDPR constructor.
20
- */
21
- function __construct() {
22
- add_action( 'um_submit_form_register', array( &$this, 'agreement_validation' ), 9 );
23
-
24
- add_filter( 'um_before_save_filter_submitted', array( &$this, 'add_agreement_date' ), 10, 1 );
25
- add_filter( 'um_email_registration_data', array( &$this, 'email_registration_data' ), 10, 1 );
26
-
27
- add_action( 'um_after_form_fields', array( &$this, 'display_option' ) );
28
- }
29
-
30
-
31
- /**
32
- * @param $args
33
- */
34
- function display_option( $args ) {
35
- if ( isset( $args['use_gdpr'] ) && $args['use_gdpr'] == 1 ) {
36
- require um_path . 'templates/gdpr-register.php';
37
- }
38
- }
39
-
40
-
41
- /**
42
- * @param $args
43
- */
44
- function agreement_validation( $args ) {
45
- $gdpr_enabled = get_post_meta( $args['form_id'], '_um_register_use_gdpr', true );
46
-
47
- if ( $gdpr_enabled && ! isset( $args['submitted']['use_gdpr_agreement'] ) ) {
48
- UM()->form()->add_error( 'use_gdpr_agreement', isset( $args['use_gdpr_error_text'] ) ? $args['use_gdpr_error_text'] : '' );
49
- }
50
- }
51
-
52
-
53
- /**
54
- * @param $submitted
55
- *
56
- * @return mixed
57
- */
58
- function add_agreement_date( $submitted ) {
59
- if ( isset( $submitted['use_gdpr_agreement'] ) ) {
60
- $submitted['use_gdpr_agreement'] = time();
61
- }
62
-
63
- return $submitted;
64
- }
65
-
66
-
67
- /**
68
- * @param $submitted
69
- *
70
- * @return mixed
71
- */
72
- function email_registration_data( $submitted ) {
73
-
74
- $timestamp = ! empty( $submitted['timestamp'] ) ? $submitted['timestamp'] : $submitted['use_gdpr_agreement'];
75
-
76
- if ( ! empty( $submitted['use_gdpr_agreement'] ) ) {
77
- $submitted['GDPR Applied'] = date( "d M Y H:i", $timestamp );
78
- unset( $submitted['use_gdpr_agreement'] );
79
- }
80
-
81
- return $submitted;
82
- }
83
-
84
- }
85
-
86
- }
includes/core/class-mail.php CHANGED
@@ -124,14 +124,10 @@ if ( ! class_exists( 'um\core\Mail' ) ) {
124
125
$this->message = $this->prepare_template( $template, $args );
126
127
- if ( UM()->options()->get( 'email_html' ) ) {
128
- $this->headers .= "Content-Type: text/html\r\n";
129
- } else {
130
- $this->headers .= "Content-Type: text/plain\r\n";
131
- }
132
-
133
// Send mail
134
wp_mail( $email, $this->subject, $this->message, $this->headers, $this->attachments );
135
}
136
137
@@ -485,6 +481,22 @@ if ( ! class_exists( 'um\core\Mail' ) ) {
485
}
486
487
488
/**
489
* Ajax copy template to the theme
490
*
124
125
$this->message = $this->prepare_template( $template, $args );
126
127
+ add_filter( 'wp_mail_content_type', array( &$this, 'set_content_type' ) );
128
// Send mail
129
wp_mail( $email, $this->subject, $this->message, $this->headers, $this->attachments );
130
+ remove_filter( 'wp_mail_content_type', array( &$this, 'set_content_type' ) );
131
}
132
133
481
}
482
483
484
+ /**
485
+ * Set email content type
486
+ *
487
+ *
488
+ * @param $content_type
489
+ * @return string
490
+ */
491
+ function set_content_type( $content_type ) {
492
+ if ( UM()->options()->get( 'email_html' ) ) {
493
+ return 'text/html';
494
+ } else {
495
+ return 'text/plain';
496
+ }
497
+ }
498
+
499
+
500
/**
501
* Ajax copy template to the theme
502
*
includes/core/class-profile.php CHANGED
@@ -118,18 +118,11 @@ if ( ! class_exists( 'um\core\Profile' ) ) {
118
119
// disable private tabs
120
if ( ! is_admin() ) {
121
- if( is_user_logged_in() ) {
122
- $user_id = um_user('ID');
123
- um_fetch_user( get_current_user_id() );
124
- }
125
foreach ( $tabs as $id => $tab ) {
126
if ( ! $this->can_view_tab( $id ) ) {
127
unset( $tabs[$id] );
128
}
129
}
130
- if( is_user_logged_in() ) {
131
- um_fetch_user( $user_id );
132
- }
133
}
134
135
return $tabs;
118
119
// disable private tabs
120
if ( ! is_admin() ) {
121
foreach ( $tabs as $id => $tab ) {
122
if ( ! $this->can_view_tab( $id ) ) {
123
unset( $tabs[$id] );
124
}
125
}
126
}
127
128
return $tabs;
includes/core/class-user.php CHANGED
@@ -39,7 +39,6 @@ if ( ! class_exists( 'um\core\User' ) ) {
39
add_action( 'init', array( &$this, 'set' ), 1 );
40
41
$this->preview = false;
42
- $this->send_mail_on_delete = true;
43
44
// a list of keys that should never be in wp_usermeta
45
$this->update_user_keys = array(
@@ -55,8 +54,6 @@ if ( ! class_exists( 'um\core\User' ) ) {
55
56
// When the cache should be cleared
57
add_action('um_delete_user_hook', array(&$this, 'remove_cached_queue') );
58
- add_action('um_delete_user', array( &$this, 'remove_cache' ), 10, 1 );
59
-
60
add_action('um_after_user_status_is_changed_hook', array(&$this, 'remove_cached_queue') );
61
62
// When user cache should be cleared
@@ -86,73 +83,6 @@ if ( ! class_exists( 'um\core\User' ) ) {
86
add_action( 'wpmu_activate_user', array( &$this, 'add_um_role_wpmu_new_user' ), 10, 1 );
87
88
add_action( 'init', array( &$this, 'check_membership' ), 10 );
89
-
90
- add_action( 'delete_user', array( &$this, 'delete_user_handler' ), 10, 1 );
91
- add_action( 'wpmu_delete_user', array( &$this, 'delete_user_handler' ), 10, 1 );
92
- }
93
-
94
-
95
- /**
96
- * @param $user_id
97
- */
98
- function delete_user_handler( $user_id ) {
99
-
100
- um_fetch_user( $user_id );
101
-
102
- /**
103
- * UM hook
104
- *
105
- * @type action
106
- * @title um_delete_user_hook
107
- * @description On delete user
108
- * @change_log
109
- * ["Since: 2.0"]
110
- * @usage add_action( 'um_delete_user_hook', 'function_name', 10 );
111
- * @example
112
- * <?php
113
- * add_action( 'um_delete_user_hook', 'my_delete_user', 10 );
114
- * function my_delete_user() {
115
- * // your code here
116
- * }
117
- * ?>
118
- */
119
- do_action( 'um_delete_user_hook' );
120
-
121
- /**
122
- * UM hook
123
- *
124
- * @type action
125
- * @title um_delete_user
126
- * @description On delete user
127
- * @input_vars
128
- * [{"var":"$user_id","type":"int","desc":"User ID"}]
129
- * @change_log
130
- * ["Since: 2.0"]
131
- * @usage add_action( 'um_delete_user', 'function_name', 10, 1 );
132
- * @example
133
- * <?php
134
- * add_action( 'um_delete_user', 'my_delete_user', 10, 1 );
135
- * function my_delete_user( $user_id ) {
136
- * // your code here
137
- * }
138
- * ?>
139
- */
140
- do_action( 'um_delete_user', um_user( 'ID' ) );
141
-
142
- // send email notifications
143
- if ( $this->send_mail_on_delete ) {
144
- UM()->mail()->send( um_user( 'user_email' ), 'deletion_email' );
145
-
146
- $emails = um_multi_admin_email();
147
- if ( ! empty( $emails ) ) {
148
- foreach ( $emails as $email ) {
149
- UM()->mail()->send( $email, 'notification_deletion', array( 'admin' => true ) );
150
- }
151
- }
152
- }
153
-
154
- // remove uploads
155
- UM()->files()->remove_dir( um_user_uploads_dir() );
156
}
157
158
@@ -960,20 +890,6 @@ if ( ! class_exists( 'um\core\User' ) ) {
960
unset( $submitted['confirm_user_password'] );
961
}
962
963
- //remove all password field values from submitted details
964
- $password_fields = array();
965
- foreach ( $submitted as $k => $v ) {
966
- if ( UM()->fields()->get_field_type( $k ) == 'password' ) {
967
- $password_fields[] = $k;
968
- $password_fields[] = 'confirm_' . $k;
969
- }
970
- }
971
-
972
- foreach ( $password_fields as $pw_field ) {
973
- unset( $submitted[ $pw_field ] );
974
- }
975
-
976
-
977
/**
978
* UM hook
979
*
@@ -1358,10 +1274,59 @@ if ( ! class_exists( 'um\core\User' ) ) {
1358
* @param bool $send_mail
1359
*/
1360
function delete( $send_mail = true ) {
1361
1362
- $this->send_mail_on_delete = $send_mail;
1363
1364
- $this->delete_user_handler( um_user( 'ID' ) );
1365
1366
// remove user
1367
if ( is_multisite() ) {
@@ -1661,29 +1626,23 @@ if ( ! class_exists( 'um\core\User' ) ) {
1661
}
1662
1663
}
1664
-
1665
-
1666
// update user
1667
if ( count( $args ) > 1 ) {
1668
1669
- //if isset roles argument validate role to properly for security reasons
1670
- if ( isset( $args['role'] ) ) {
1671
- global $wp_roles;
1672
- $um_roles = get_option( 'um_roles' );
1673
-
1674
- if ( ! empty( $um_roles ) ) {
1675
- $role_keys = array_map( function( $item ) {
1676
- return 'um_' . $item;
1677
- }, get_option( 'um_roles' ) );
1678
- } else {
1679
- $role_keys = array();
1680
- }
1681
1682
- $exclude_roles = array_diff( array_keys( $wp_roles->roles ), array_merge( $role_keys, array( 'subscriber' ) ) );
1683
1684
- if ( in_array( $args['role'], $exclude_roles ) ) {
1685
- unset( $args['role'] );
1686
- }
1687
}
1688
1689
wp_update_user( $args );
39
add_action( 'init', array( &$this, 'set' ), 1 );
40
41
$this->preview = false;
42
43
// a list of keys that should never be in wp_usermeta
44
$this->update_user_keys = array(
54
55
// When the cache should be cleared
56
add_action('um_delete_user_hook', array(&$this, 'remove_cached_queue') );
57
add_action('um_after_user_status_is_changed_hook', array(&$this, 'remove_cached_queue') );
58
59
// When user cache should be cleared
83
add_action( 'wpmu_activate_user', array( &$this, 'add_um_role_wpmu_new_user' ), 10, 1 );
84
85
add_action( 'init', array( &$this, 'check_membership' ), 10 );
86
}
87
88
890
unset( $submitted['confirm_user_password'] );
891
}
892
893
/**
894
* UM hook
895
*
1274
* @param bool $send_mail
1275
*/
1276
function delete( $send_mail = true ) {
1277
+ /**
1278
+ * UM hook
1279
+ *
1280
+ * @type action
1281
+ * @title um_delete_user_hook
1282
+ * @description On delete user
1283
+ * @change_log
1284
+ * ["Since: 2.0"]
1285
+ * @usage add_action( 'um_delete_user_hook', 'function_name', 10 );
1286
+ * @example
1287
+ * <?php
1288
+ * add_action( 'um_delete_user_hook', 'my_delete_user', 10 );
1289
+ * function my_delete_user() {
1290
+ * // your code here
1291
+ * }
1292
+ * ?>
1293
+ */
1294
+ do_action( 'um_delete_user_hook' );
1295
+ /**
1296
+ * UM hook
1297
+ *
1298
+ * @type action
1299
+ * @title um_delete_user
1300
+ * @description On delete user
1301
+ * @input_vars
1302
+ * [{"var":"$user_id","type":"int","desc":"User ID"}]
1303
+ * @change_log
1304
+ * ["Since: 2.0"]
1305
+ * @usage add_action( 'um_delete_user', 'function_name', 10, 1 );
1306
+ * @example
1307
+ * <?php
1308
+ * add_action( 'um_delete_user', 'my_delete_user', 10, 1 );
1309
+ * function my_delete_user( $user_id ) {
1310
+ * // your code here
1311
+ * }
1312
+ * ?>
1313
+ */
1314
+ do_action( 'um_delete_user', um_user( 'ID' ) );
1315
1316
+ // send email notifications
1317
+ if ( $send_mail ) {
1318
+ UM()->mail()->send( um_user( 'user_email' ), 'deletion_email' );
1319
+
1320
+ $emails = um_multi_admin_email();
1321
+ if ( ! empty( $emails ) ) {
1322
+ foreach ( $emails as $email ) {
1323
+ UM()->mail()->send( $email, 'notification_deletion', array( 'admin' => true ) );
1324
+ }
1325
+ }
1326
+ }
1327
1328
+ // remove uploads
1329
+ UM()->files()->remove_dir( um_user_uploads_dir() );
1330
1331
// remove user
1332
if ( is_multisite() ) {
1626
}
1627
1628
}
1629
// update user
1630
if ( count( $args ) > 1 ) {
1631
+ global $wp_roles;
1632
+ $um_roles = get_option( 'um_roles' );
1633
1634
+ if ( ! empty( $um_roles ) ) {
1635
+ $role_keys = array_map( function( $item ) {
1636
+ return 'um_' . $item;
1637
+ }, get_option( 'um_roles' ) );
1638
+ } else {
1639
+ $role_keys = array();
1640
+ }
1641
1642
+ $exclude_roles = array_diff( array_keys( $wp_roles->roles ), array_merge( $role_keys, array( 'subscriber' ) ) );
1643
1644
+ if ( isset( $args['role'] ) && in_array( $args['role'], $exclude_roles ) ) {
1645
+ unset( $args['role'] );
1646
}
1647
1648
wp_update_user( $args );
includes/core/um-actions-core.php CHANGED
@@ -108,9 +108,7 @@ function um_action_request_process() {
108
break;
109
110
case 'um_delete':
111
- if ( ! UM()->roles()->um_current_user_can( 'delete', $uid ) ) {
112
- wp_die( __('You do not have permission to delete this user.','ultimate-member') );
113
- }
114
um_fetch_user( $uid );
115
UM()->user()->delete();
116
exit( wp_redirect( UM()->permalinks()->get_current_url( true ) ) );
108
break;
109
110
case 'um_delete':
111
+ if ( ! UM()->roles()->um_current_user_can( 'delete', $uid ) ) wp_die( __('You do not have permission to delete this user.','ultimate-member') );
112
um_fetch_user( $uid );
113
UM()->user()->delete();
114
exit( wp_redirect( UM()->permalinks()->get_current_url( true ) ) );
includes/core/um-actions-form.php CHANGED
@@ -314,9 +314,8 @@ function um_submit_form_errors_hook_( $args ) {
314
foreach ( $array['conditions'] as $condition ) {
315
list( $visibility, $parent_key, $op, $parent_value ) = $condition;
316
317
- if ( ! isset( $args[ $parent_key ] ) ) {
318
continue;
319
- }
320
321
$cond_value = ( $fields[ $parent_key ]['type'] == 'radio' ) ? $args[ $parent_key ][0] : $args[ $parent_key ];
322
@@ -338,11 +337,11 @@ function um_submit_form_errors_hook_( $args ) {
338
continue 2;
339
}
340
} elseif ( $op == 'greater than' ) {
341
- if ( $cond_value > $parent_value ) {
342
continue 2;
343
}
344
} elseif ( $op == 'less than' ) {
345
- if ( $cond_value < $parent_value ) {
346
continue 2;
347
}
348
} elseif ( $op == 'contains' ) {
@@ -368,11 +367,11 @@ function um_submit_form_errors_hook_( $args ) {
368
continue 2;
369
}
370
} elseif ( $op == 'greater than' ) {
371
- if ( $cond_value <= $parent_value ) {
372
continue 2;
373
}
374
} elseif ( $op == 'less than' ) {
375
- if ( $cond_value >= $parent_value ) {
376
continue 2;
377
}
378
} elseif ( $op == 'contains' ) {
314
foreach ( $array['conditions'] as $condition ) {
315
list( $visibility, $parent_key, $op, $parent_value ) = $condition;
316
317
+ if ( ! isset( $args[ $parent_key ] ) )
318
continue;
319
320
$cond_value = ( $fields[ $parent_key ]['type'] == 'radio' ) ? $args[ $parent_key ][0] : $args[ $parent_key ];
321
337
continue 2;
338
}
339
} elseif ( $op == 'greater than' ) {
340
+ if ( $cond_value > $op ) {
341
continue 2;
342
}
343
} elseif ( $op == 'less than' ) {
344
+ if ( $cond_value < $op ) {
345
continue 2;
346
}
347
} elseif ( $op == 'contains' ) {
367
continue 2;
368
}
369
} elseif ( $op == 'greater than' ) {
370
+ if ( $cond_value <= $op ) {
371
continue 2;
372
}
373
} elseif ( $op == 'less than' ) {
374
+ if ( $cond_value >= $op ) {
375
continue 2;
376
}
377
} elseif ( $op == 'contains' ) {
includes/core/um-actions-password.php CHANGED
@@ -133,6 +133,15 @@ function um_reset_password_errors_hook( $args ) {
133
if ( $_POST[ UM()->honeypot ] != '' )
134
wp_die('Hello, spam bot!','ultimate-member');
135
136
$user = "";
137
138
foreach ( $_POST as $key => $val ) {
@@ -188,6 +197,16 @@ function um_change_password_errors_hook( $args ) {
188
wp_die('Hello, spam bot!','ultimate-member');
189
}
190
191
$reset_pass_hash = '';
192
193
if( isset( $_REQUEST['act'] ) && $_REQUEST['act'] == 'reset_password' && um_is_core_page('password-reset') ){
133
if ( $_POST[ UM()->honeypot ] != '' )
134
wp_die('Hello, spam bot!','ultimate-member');
135
136
+ $form_timestamp = trim($_POST['timestamp']);
137
+ $live_timestamp = current_time( 'timestamp' );
138
+
139
+ if ( $form_timestamp == '' && UM()->options()->get( 'enable_timebot' ) == 1 )
140
+ wp_die( __('Hello, spam bot!','ultimate-member') );
141
+
142
+ if ( $live_timestamp - $form_timestamp < 3 && UM()->options()->get( 'enable_timebot' ) == 1 )
143
+ 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') );
144
+
145
$user = "";
146
147
foreach ( $_POST as $key => $val ) {
197
wp_die('Hello, spam bot!','ultimate-member');
198
}
199
200
+ $form_timestamp = trim($_POST['timestamp']);
201
+ $live_timestamp = current_time( 'timestamp' );
202
+
203
+ if ( $form_timestamp == '' && UM()->options()->get( 'enable_timebot' ) == 1 )
204
+ wp_die( __('Hello, spam bot!','ultimate-member') );
205
+
206
+ if ( $live_timestamp - $form_timestamp < 3 && UM()->options()->get( 'enable_timebot' ) == 1 ) {
207
+ 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') );
208
+ }
209
+
210
$reset_pass_hash = '';
211
212
if( isset( $_REQUEST['act'] ) && $_REQUEST['act'] == 'reset_password' && um_is_core_page('password-reset') ){
includes/core/um-actions-profile.php CHANGED
@@ -218,12 +218,8 @@ function um_user_edit_profile( $args ) {
218
219
// loop through fields
220
if ( ! empty( $fields ) ) {
221
-
222
foreach ( $fields as $key => $array ) {
223
224
- /*if ( ! um_can_edit_field( $fields[ $key ] ) )
225
- continue;*/
226
-
227
if ( ! um_can_edit_field( $fields[ $key ] ) && isset( $fields[ $key ]['editable'] ) && ! $fields[ $key ]['editable'] )
228
continue;
229
@@ -240,15 +236,10 @@ function um_user_edit_profile( $args ) {
240
241
} else {
242
243
- if ( $array['type'] == 'password' ) {
244
- $to_update[ $key ] = wp_hash_password( $args['submitted'][ $key ] );
245
- $args['submitted'][ $key ] = sprintf( __( 'Your choosed %s', 'ultimate-member' ), $array['title'] );
246
- } else {
247
- if ( isset( $userinfo[ $key ] ) && $args['submitted'][ $key ] != $userinfo[ $key ] ) {
248
- $to_update[ $key ] = $args['submitted'][ $key ];
249
- } elseif ( $args['submitted'][ $key ] ) {
250
- $to_update[ $key ] = $args['submitted'][ $key ];
251
- }
252
}
253
254
}
@@ -1377,46 +1368,40 @@ function um_profile_menu( $args ) {
1377
1378
<div class="um-profile-nav-item um-profile-nav-<?php echo $id . ' ' . $profile_nav_class; ?>">
1379
<?php if ( UM()->options()->get( 'profile_menu_icons' ) ) { ?>
1380
- <a href="<?php echo $nav_link; ?>" class="uimob800-show uimob500-show uimob340-show um-tip-n"
1381
title="<?php echo esc_attr( $tab['name'] ); ?>" original-title="<?php echo esc_attr( $tab['name'] ); ?>">
1382
1383
<i class="<?php echo $tab['icon']; ?>"></i>
1384
1385
<?php if ( isset( $tab['notifier'] ) && $tab['notifier'] > 0 ) { ?>
1386
- <span class="um-tab-notifier uimob800-show uimob500-show uimob340-show"><?php echo $tab['notifier']; ?></span>
1387
<?php } ?>
1388
1389
- <span class="uimob800-hide uimob500-hide uimob340-hide title"><?php echo $tab['name']; ?></span>
1390
- </a>
1391
- <a href="<?php echo $nav_link; ?>" class="uimob800-hide uimob500-hide uimob340-hide"
1392
- title="<?php echo esc_attr( $tab['name'] ); ?>">
1393
-
1394
- <i class="<?php echo $tab['icon']; ?>"></i>
1395
1396
- <?php if ( isset( $tab['notifier'] ) && $tab['notifier'] > 0 ) { ?>
1397
- <span class="um-tab-notifier uimob800-show uimob500-show uimob340-show"><?php echo $tab['notifier']; ?></span>
1398
- <?php } ?>
1399
-
1400
- <span class="title"><?php echo $tab['name']; ?></span>
1401
</a>
1402
- <?php } else { ?>
1403
- <a href="<?php echo $nav_link; ?>" class="uimob800-show uimob500-show uimob340-show um-tip-n"
1404
title="<?php echo esc_attr( $tab['name'] ); ?>" original-title="<?php echo esc_attr( $tab['name'] ); ?>">
1405
1406
<i class="<?php echo $tab['icon']; ?>"></i>
1407
1408
<?php if ( isset( $tab['notifier'] ) && $tab['notifier'] > 0 ) { ?>
1409
- <span class="um-tab-notifier uimob800-show uimob500-show uimob340-show"><?php echo $tab['notifier']; ?></span>
1410
<?php } ?>
1411
</a>
1412
- <a href="<?php echo $nav_link; ?>" class="uimob800-hide uimob500-hide uimob340-hide"
1413
- title="<?php echo esc_attr( $tab['name'] ); ?>">
1414
1415
<?php if ( isset( $tab['notifier'] ) && $tab['notifier'] > 0) { ?>
1416
- <span class="um-tab-notifier uimob800-show uimob500-show uimob340-show"><?php echo $tab['notifier']; ?></span>
1417
<?php } ?>
1418
1419
- <span class="title"><?php echo $tab['name']; ?></span>
1420
</a>
1421
<?php } ?>
1422
</div>
218
219
// loop through fields
220
if ( ! empty( $fields ) ) {
221
foreach ( $fields as $key => $array ) {
222
223
if ( ! um_can_edit_field( $fields[ $key ] ) && isset( $fields[ $key ]['editable'] ) && ! $fields[ $key ]['editable'] )
224
continue;
225
236
237
} else {
238
239
+ if ( isset( $userinfo[ $key ] ) && $args['submitted'][ $key ] != $userinfo[ $key ] ) {
240
+ $to_update[ $key ] = $args['submitted'][ $key ];
241
+ } elseif ( $args['submitted'][ $key ] ) {
242
+ $to_update[ $key ] = $args['submitted'][ $key ];
243
}
244
245
}
1368
1369
<div class="um-profile-nav-item um-profile-nav-<?php echo $id . ' ' . $profile_nav_class; ?>">
1370
<?php if ( UM()->options()->get( 'profile_menu_icons' ) ) { ?>
1371
+ <a href="<?php echo $nav_link; ?>" class="um-tip-n uimob500-show uimob340-show uimob800-show"
1372
title="<?php echo esc_attr( $tab['name'] ); ?>" original-title="<?php echo esc_attr( $tab['name'] ); ?>">
1373
1374
<i class="<?php echo $tab['icon']; ?>"></i>
1375
1376
<?php if ( isset( $tab['notifier'] ) && $tab['notifier'] > 0 ) { ?>
1377
+ <span class="um-tab-notifier uimob500-show uimob340-show uimob800-show"><?php echo $tab['notifier']; ?></span>
1378
<?php } ?>
1379
1380
+ <span class="uimob500-hide uimob340-hide uimob800-hide title"><?php echo $tab['name']; ?></span>
1381
1382
</a>
1383
+ <a href="<?php echo $nav_link; ?>" class="uimob500-hide uimob340-hide uimob800-hide"
1384
title="<?php echo esc_attr( $tab['name'] ); ?>" original-title="<?php echo esc_attr( $tab['name'] ); ?>">
1385
1386
<i class="<?php echo $tab['icon']; ?>"></i>
1387
1388
<?php if ( isset( $tab['notifier'] ) && $tab['notifier'] > 0 ) { ?>
1389
+ <span class="um-tab-notifier uimob500-show uimob340-show uimob800-show"><?php echo $tab['notifier']; ?></span>
1390
<?php } ?>
1391
+
1392
+ <span class="uimob500-hide uimob340-hide uimob800-hide title"><?php echo $tab['name']; ?></span>
1393
+
1394
</a>
1395
+ <?php } else { ?>
1396
+ <a href="<?php echo $nav_link; ?>" title="<?php echo esc_attr( $tab['name'] ); ?>"
1397
+ original-title="<?php echo esc_attr( $tab['name'] ); ?>">
1398
1399
<?php if ( isset( $tab['notifier'] ) && $tab['notifier'] > 0) { ?>
1400
+ <span class="um-tab-notifier uimob500-show uimob340-show uimob800-show"><?php echo $tab['notifier']; ?></span>
1401
<?php } ?>
1402
1403
+ <span class="uimob500-hide uimob340-hide uimob800-hide title"><?php echo $tab['name']; ?></span>
1404
+
1405
</a>
1406
<?php } ?>
1407
</div>
includes/core/um-actions-register.php CHANGED
@@ -54,9 +54,8 @@ function um_after_insert_user( $user_id, $args ) {
54
//clear Users cached queue
55
UM()->user()->remove_cached_queue();
56
57
- um_fetch_user( $user_id );
58
- UM()->user()->set_status( um_user( 'status' ) );
59
if ( ! empty( $args['submitted'] ) ) {
60
UM()->user()->set_registration_details( $args['submitted'] );
61
}
62
@@ -104,7 +103,7 @@ function um_after_insert_user( $user_id, $args ) {
104
*/
105
do_action( 'um_registration_complete', $user_id, $args );
106
}
107
- add_action( 'um_user_register', 'um_after_insert_user', 1, 2 );
108
109
110
/**
@@ -119,7 +118,7 @@ function um_send_registration_notification( $user_id, $args ) {
119
$emails = um_multi_admin_email();
120
if ( ! empty( $emails ) ) {
121
foreach ( $emails as $email ) {
122
- if ( um_user( 'account_status' ) != 'pending' ) {
123
UM()->mail()->send( $email, 'notification_new_user', array( 'admin' => true ) );
124
} else {
125
UM()->mail()->send( $email, 'notification_review', array( 'admin' => true ) );
@@ -137,7 +136,7 @@ add_action( 'um_registration_complete', 'um_send_registration_notification', 10,
137
* @param $args
138
*/
139
function um_check_user_status( $user_id, $args ) {
140
- $status = um_user( 'account_status' );
141