Merge branch 'master' of https://github.com/ultimatemember/ultimatemember into allow_roles_edit_and_delete_members

This commit is contained in:
nikitozzzzzzz
2018-05-31 11:36:30 +03:00
39 changed files with 1236 additions and 266 deletions
+2 -2
View File
@@ -7,7 +7,7 @@ Ultimate Member is the #1 user profile & membership plugin for WordPress. The pl
| Latest Version |Requires at least|Stable Tag| | Latest Version |Requires at least|Stable Tag|
| :------------: |:------------:|:------------:| | :------------: |:------------:|:------------:|
| 2.0.12 | WordPress 4.9 or higher| 2.0.12 | | 2.0.17 | WordPress 4.9 or higher| 2.0.17 |
Features of the plugin include: Features of the plugin include:
@@ -48,7 +48,7 @@ GNU Version 2 or Any Later Version
Releases Releases
==================== ====================
[Official Release Version: 2.0.12](https://github.com/ultimatemember/ultimatemember/releases/tag/2.0.12). [Official Release Version: 2.0.17](https://github.com/ultimatemember/ultimatemember/releases/tag/2.0.17).
[Official Release Version: 1.3.88](https://github.com/ultimatemember/ultimatemember/releases). [Official Release Version: 1.3.88](https://github.com/ultimatemember/ultimatemember/releases).
+24 -6
View File
@@ -393,13 +393,31 @@ font-weight: normal;
border-bottom: 0 !important; border-bottom: 0 !important;
} }
.um-profile-nav-item.without-icon a {padding-left: 10px} .um-profile-nav-item.without-icon a {
.um-profile-nav-item.without-icon span.title {padding-left: 0} padding-left: 10px;
.um-profile-nav-item.without-icon i {display: none} }
.um-profile-nav-item.without-icon span.title {
padding-left: 0;
}
.um-profile-nav-item.without-icon i {
display: none;
}
.um-profile-nav-item a:hover {background: #555} .um-profile-nav-item a:hover {
.um-profile-nav-item i {font-size: 18px;height: 18px;line-height: 18px;position: absolute;display: block;top: 8px;left: 10px} background: #555;
.um-profile-nav-item span.title {padding-left: 5px} }
.um-profile-nav-item i {
font-size: 18px;
height: 18px;
line-height: 18px;
position: absolute;
display: block;
top: 8px;
left: 10px;
}
.um-profile-nav-item span.title {
padding-left: 5px;
}
.um-profile-nav-item span.count { .um-profile-nav-item span.count {
font-size: 12px; font-size: 12px;
font-weight: 300; font-weight: 300;
+22
View File
@@ -0,0 +1,22 @@
(function( $ ) {
'use strict';
$(document).on('click', "a.um-toggle-gdpr" ,function() {
var me = jQuery(this);
$( ".um-gdpr-content" ).toggle( "fast", function() {
if( $( ".um-gdpr-content" ).is(':visible') ){
me.text( me.data('toggle-hide') );
}
if( $( ".um-gdpr-content" ).is(':hidden') ){
me.text( me.data('toggle-show') );
}
});
});
})( jQuery );
+1
View File
@@ -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);
+24
View File
@@ -35,6 +35,7 @@ if ( ! class_exists( 'um\admin\Admin' ) ) {
add_action( 'um_admin_do_action__user_cache', array( &$this, 'user_cache' ) ); add_action( 'um_admin_do_action__user_cache', array( &$this, 'user_cache' ) );
add_action( 'um_admin_do_action__purge_temp', array( &$this, 'purge_temp' ) ); add_action( 'um_admin_do_action__purge_temp', array( &$this, 'purge_temp' ) );
add_action( 'um_admin_do_action__manual_upgrades_request', array( &$this, 'manual_upgrades_request' ) );
add_action( 'um_admin_do_action__duplicate_form', array( &$this, 'duplicate_form' ) ); add_action( 'um_admin_do_action__duplicate_form', array( &$this, 'duplicate_form' ) );
add_action( 'um_admin_do_action__um_language_downloader', array( &$this, 'um_language_downloader' ) ); add_action( 'um_admin_do_action__um_language_downloader', array( &$this, 'um_language_downloader' ) );
add_action( 'um_admin_do_action__um_hide_locale_notice', array( &$this, 'um_hide_notice' ) ); add_action( 'um_admin_do_action__um_hide_locale_notice', array( &$this, 'um_hide_notice' ) );
@@ -48,6 +49,29 @@ if ( ! class_exists( 'um\admin\Admin' ) ) {
} }
function manual_upgrades_request() {
if ( ! is_admin() || ! current_user_can( 'manage_options' ) ) {
die();
}
$last_request = get_option( 'um_last_manual_upgrades_request', false );
if ( empty( $last_request ) || time() > $last_request + DAY_IN_SECONDS ) {
delete_transient( 'update_plugins' );
delete_site_transient( 'update_plugins' );
UM()->plugin_updater()->um_checklicenses();
update_option( 'um_last_manual_upgrades_request', time() );
$url = add_query_arg( array( 'page' => 'ultimatemember', 'update' => 'got_updates' ), admin_url( 'admin.php' ) );
} else {
$url = add_query_arg( array( 'page' => 'ultimatemember', 'update' => 'often_updates' ), admin_url( 'admin.php' ) );
}
exit( wp_redirect( $url ) );
}
/** /**
* Clear all users cache * Clear all users cache
+316
View File
@@ -0,0 +1,316 @@
<?php
namespace um\admin\core;
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) exit;
if ( ! class_exists( 'um\admin\core\Admin_GDPR' ) ) {
/**
* Class Admin_GDPR
* @package um\admin\core
*/
class Admin_GDPR {
/**
* @var array
*/
var $meta_associations = array();
/**
* Admin_GDPR constructor.
*/
function __construct() {
add_action( 'init', array( &$this, 'init_fields' ), 10 );
add_action( 'admin_init', array( &$this, 'plugin_add_suggested_privacy_content' ), 20 );
add_filter( 'wp_privacy_personal_data_exporters', array( &$this, 'plugin_register_exporters' ) );
add_filter( 'wp_privacy_personal_data_erasers', array( &$this, 'plugin_register_erasers' ) );
add_action( 'um_admin_custom_register_metaboxes', array( &$this, 'add_metabox_register' ) );
}
/**
*
*/
function add_metabox_register() {
add_meta_box(
"um-admin-form-register_gdpr",
__( 'Privacy Policy', 'ultimate-member' ),
array( UM()->metabox(), 'load_metabox_form' ),
'um_form',
'side',
'default'
);
}
/**
*
*/
function init_fields() {
$this->meta_associations = array(
'account_status' => __( 'Account Status', 'ultimate-member' ),
'submitted' => __( 'Submitted data on Registration', 'ultimate-member' ),
'form_id' => __( 'Registration Form ID', 'ultimate-member' ),
'timestamp' => __( 'Registration Timestamp', 'ultimate-member' ),
'request' => __( 'Registration Request', 'ultimate-member' ),
'_wpnonce' => __( 'Registration Nonce', 'ultimate-member' ),
'_wp_http_referer' => __( 'Registration HTTP referer', 'ultimate-member' ),
'role' => __( 'Community Role', 'ultimate-member' ),
'um_user_profile_url_slug_user_login' => __( 'Profile Slug "Username"', 'ultimate-member' ),
'um_user_profile_url_slug_name' => __( 'Profile Slug "First and Last Name with \'.\'"', 'ultimate-member' ),
'um_user_profile_url_slug_name_dash' => __( 'Profile Slug "First and Last Name with \'-\'"', 'ultimate-member' ),
'um_user_profile_url_slug_name_plus' => __( 'Profile Slug "First and Last Name with \'+\'"', 'ultimate-member' ),
'um_user_profile_url_slug_user_id' => __( 'Profile Slug "User ID"', 'ultimate-member' ),
'_um_last_login' => __( 'Last Login Timestamp', 'ultimate-member' ),
//Private content extension
'_um_private_content_post_id' => __( 'Private Content Post ID', 'ultimate-member' ),
//Verified Users extension
'_um_verified' => __( 'Verified Account', 'ultimate-member' ),
//Terms & Conditions extension
'use_terms_conditions_agreement' => __( 'Terms&Conditions Agreement', 'ultimate-member' ),
//GDPR extension
'use_gdpr_agreement' => __( 'Privacy Policy Agreement', 'ultimate-member' ),
);
$all_fields = UM()->builtin()->all_user_fields( null, true );
unset( $all_fields[0] );
$all_fields = array_map( function( $value ) {
return $value['title'];
}, $all_fields );
$this->meta_associations = array_merge( $this->meta_associations, $all_fields );
/**
* UM hook
*
* @type filter
* @title um_gdpr_meta_associations
* @description Exclude taxonomies for UM
* @input_vars
* [{"var":"$meta_associations","type":"array","desc":"Meta Keys Titles"}]
* @change_log
* ["Since: 2.0.14"]
* @usage
* <?php add_filter( 'um_gdpr_meta_associations', 'function_name', 10, 1 ); ?>
* @example
* <?php
* add_filter( 'um_gdpr_meta_associations', 'my_gdpr_meta_associations', 10, 1 );
* function my_gdpr_meta_associations( $meta_associations ) {
* // your code here
* return $meta_associations;
* }
* ?>
*/
$this->meta_associations = apply_filters( 'um_gdpr_meta_associations', $this->meta_associations );
}
/**
* Return the default suggested privacy policy content.
*
* @return string The default policy content.
*/
function plugin_get_default_privacy_content() {
ob_start();
include UM()->admin()->templates_path . 'gdpr.php';
return ob_get_clean();
}
/**
* Add the suggested privacy policy text to the policy postbox.
*/
function plugin_add_suggested_privacy_content() {
$content = $this->plugin_get_default_privacy_content();
wp_add_privacy_policy_content( ultimatemember_plugin_name, $content );
}
/**
* Register exporter for Plugin user data.
*
* @see https://github.com/allendav/wp-privacy-requests/blob/master/EXPORT.md
*
* @param $exporters
*
* @return array
*/
function plugin_register_exporters( $exporters ) {
$exporters[] = array(
'exporter_friendly_name' => ultimatemember_plugin_name,
'callback' => array( &$this, 'data_exporter' )
);
return $exporters;
}
/**
* Get user metadata in key => value array
*
*
* @param $user_id
*
* @return array
*/
function get_metadata( $user_id ) {
global $wpdb;
$metadata = $wpdb->get_results( $wpdb->prepare(
"SELECT meta_key, meta_value
FROM {$wpdb->usermeta}
WHERE user_id = %d",
$user_id
), ARRAY_A );
$filtered = array();
foreach ( $metadata as $data ) {
if ( in_array( $data['meta_key'], array_keys( $this->meta_associations ) ) ) {
$filtered[] = array(
'key' => $data['meta_key'],
'name' => $this->meta_associations[ $data['meta_key'] ],
//'value' => maybe_unserialize( $data['meta_value'] ),
'value' => $data['meta_value'],
);
}
}
return $filtered;
}
/**
* Exporter for Plugin user data.
*
* @see https://github.com/allendav/wp-privacy-requests/blob/master/EXPORT.md
*
* @param $email_address
* @param int $page
*
* @return array
*/
function data_exporter( $email_address, $page = 1 ) {
$export_items = array();
$user = get_user_by( 'email', $email_address );
if ( $user && $user->ID ) {
// Most item IDs should look like postType-postID
// If you don't have a post, comment or other ID to work with,
// use a unique value to avoid having this item's export
// combined in the final report with other items of the same id
$item_id = "ultimate-member-{$user->ID}";
// Core group IDs include 'comments', 'posts', etc.
// But you can add your own group IDs as needed
$group_id = 'ultimate-member';
// Optional group label. Core provides these for core groups.
// If you define your own group, the first exporter to
// include a label will be used as the group label in the
// final exported report
$group_label = ultimatemember_plugin_name;
// Plugins can add as many items in the item data array as they want
//$data = array();
$data = $this->get_metadata( $user->ID );
if ( ! empty( $data ) ) {
// Add this group of items to the exporters data array.
$export_items[] = array(
'group_id' => $group_id,
'group_label' => $group_label,
'item_id' => $item_id,
'data' => $data,
);
}
}
// Returns an array of exported items for this pass, but also a boolean whether this exporter is finished.
//If not it will be called again with $page increased by 1.
return array(
'data' => $export_items,
'done' => true,
);
}
/**
* Register eraser for Plugin user data.
*
* @param array $erasers
*
* @return array
*/
function plugin_register_erasers( $erasers = array() ) {
$erasers[] = array(
'eraser_friendly_name' => ultimatemember_plugin_name,
'callback' => array( &$this, 'data_eraser' )
);
return $erasers;
}
/**
* Eraser for Plugin user data.
*
* @param $email_address
* @param int $page
*
* @return array
*/
function data_eraser( $email_address, $page = 1 ) {
if ( empty( $email_address ) ) {
return array(
'items_removed' => false,
'items_retained' => false,
'messages' => array(),
'done' => true,
);
}
$user = get_user_by( 'email', $email_address );
$messages = array();
$items_removed = false;
$items_retained = false;
if ( $user && $user->ID ) {
$data = $this->get_metadata( $user->ID );
foreach ( $data as $metadata ) {
$deleted = delete_user_meta( $user->ID, $metadata['key'] );
if ( $deleted ) {
$items_removed = true;
} else {
$messages[] = sprintf( __( 'Your %s was unable to be removed at this time.', 'ultimate-member' ), $metadata['name'] );
$items_retained = true;
}
}
}
// Returns an array of exported items for this pass, but also a boolean whether this exporter is finished.
//If not it will be called again with $page increased by 1.
return array(
'items_removed' => $items_removed,
'items_retained' => $items_retained,
'messages' => $messages,
'done' => true,
);
}
}
}
+15
View File
@@ -206,6 +206,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Menu' ) ) {
add_meta_box( 'um-metaboxes-mainbox-1', __( 'Latest from our blog', 'ultimate-member' ), array( &$this, 'um_news' ), $this->pagehook, 'normal', 'core' ); add_meta_box( 'um-metaboxes-mainbox-1', __( 'Latest from our blog', 'ultimate-member' ), array( &$this, 'um_news' ), $this->pagehook, 'normal', 'core' );
add_meta_box( 'um-metaboxes-sidebox-1', __( 'Purge Temp Files', 'ultimate-member' ), array( &$this, 'purge_temp' ), $this->pagehook, 'side', 'core' ); add_meta_box( 'um-metaboxes-sidebox-1', __( 'Purge Temp Files', 'ultimate-member' ), array( &$this, 'purge_temp' ), $this->pagehook, 'side', 'core' );
add_meta_box( 'um-metaboxes-sidebox-2', __( 'User Cache', 'ultimate-member' ), array( &$this, 'user_cache' ), $this->pagehook, 'side', 'core' ); add_meta_box( 'um-metaboxes-sidebox-2', __( 'User Cache', 'ultimate-member' ), array( &$this, 'user_cache' ), $this->pagehook, 'side', 'core' );
if ( $this->language_avaialable_not_installed() ) { if ( $this->language_avaialable_not_installed() ) {
@@ -215,6 +216,12 @@ if ( ! class_exists( 'um\admin\core\Admin_Menu' ) ) {
} else if ( $this->language_not_available() ) { } else if ( $this->language_not_available() ) {
add_meta_box( 'um-metaboxes-sidebox-2', __( 'Language', 'ultimate-member' ), array( &$this, 'ct_language' ), $this->pagehook, 'side', 'core' ); add_meta_box( 'um-metaboxes-sidebox-2', __( 'Language', 'ultimate-member' ), array( &$this, 'ct_language' ), $this->pagehook, 'side', 'core' );
} }
//If there are active and licensed extensions - show metabox for upgrade it
$exts = UM()->plugin_updater()->um_get_active_plugins();
if ( 0 < count( $exts ) ) {
add_meta_box( 'um-metaboxes-sidebox-3', __( 'Upgrade\'s Manual Request', 'ultimate-member' ), array( &$this, 'upgrade_request' ), $this->pagehook, 'side', 'core' );
}
} }
@@ -269,6 +276,14 @@ if ( ! class_exists( 'um\admin\core\Admin_Menu' ) ) {
} }
/**
*
*/
function upgrade_request() {
include_once UM()->admin()->templates_path . 'dashboard/upgrade-request.php';
}
/** /**
* *
*/ */
+33 -2
View File
@@ -38,7 +38,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
$this->localize_note(); $this->localize_note();
$this->show_update_messages(); $this->show_update_messages();
$this->check_wrong_install_folder(); $this->check_wrong_install_folder();
$this->admin_notice_tracking(); //$this->admin_notice_tracking();
$this->need_upgrade(); $this->need_upgrade();
$this->check_wrong_licenses(); $this->check_wrong_licenses();
@@ -225,9 +225,32 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
function old_extensions_notice() { function old_extensions_notice() {
$show = false; $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 ) { $slugs = array_map( function( $item ) {
return 'um-' . $item . '/um-' . $item . '.php'; return 'um-' . $item . '/um-' . $item . '.php';
}, array_keys( UM()->dependencies()->ext_required_version ) ); }, $old_extensions );
$active_plugins = UM()->dependencies()->get_active_plugins(); $active_plugins = UM()->dependencies()->get_active_plugins();
foreach ( $slugs as $slug ) { foreach ( $slugs as $slug ) {
@@ -397,6 +420,14 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
$messages[0]['content'] = __( 'Your user cache is now removed.', 'ultimate-member' ); $messages[0]['content'] = __( 'Your user cache is now removed.', 'ultimate-member' );
break; break;
case 'got_updates':
$messages[0]['content'] = __( 'You got the latest upgrades.', 'ultimate-member' );
break;
case 'often_updates':
$messages[0]['err_content'] = __( 'Try again later. You can run this action once daily.', 'ultimate-member' );
break;
case 'form_duplicated': case 'form_duplicated':
$messages[0]['content'] = __( 'The form has been duplicated successfully.', 'ultimate-member' ); $messages[0]['content'] = __( 'The form has been duplicated successfully.', 'ultimate-member' );
break; break;
+5 -3
View File
@@ -1197,12 +1197,14 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
do_action( "um_settings_page_" . $current_tab . "_" . $current_subtab . "_before_section" ); do_action( "um_settings_page_" . $current_tab . "_" . $current_subtab . "_before_section" );
$section_fields = $this->get_section_fields( $current_tab, $current_subtab ); $section_fields = $this->get_section_fields( $current_tab, $current_subtab );
$settings_section = $this->render_settings_section( $section_fields, $current_tab, $current_subtab );
/** /**
* UM hook * UM hook
* *
* @type filter * @type filter
* @title um_settings_section_{$current_tab}_{$current_subtab}_content * @title um_settings_section_{$current_tab}_{$current_subtab}_content
*
* @description Render settings section * @description Render settings section
* @input_vars * @input_vars
* [{"var":"$content","type":"string","desc":"Section content"}, * [{"var":"$content","type":"string","desc":"Section content"},
@@ -1220,7 +1222,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
* ?> * ?>
*/ */
echo apply_filters( 'um_settings_section_' . $current_tab . '_' . $current_subtab . '_content', echo apply_filters( 'um_settings_section_' . $current_tab . '_' . $current_subtab . '_content',
$this->render_settings_section( $section_fields, $current_tab, $current_subtab ), $settings_section,
$section_fields $section_fields
); );
@@ -1258,6 +1260,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
do_action( "um_settings_page_" . $current_tab . "_" . $current_subtab . "_before_section" ); do_action( "um_settings_page_" . $current_tab . "_" . $current_subtab . "_before_section" );
$section_fields = $this->get_section_fields( $current_tab, $current_subtab ); $section_fields = $this->get_section_fields( $current_tab, $current_subtab );
$settings_section = $this->render_settings_section( $section_fields, $current_tab, $current_subtab );
/** /**
* UM hook * UM hook
@@ -1281,7 +1284,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
* ?> * ?>
*/ */
echo apply_filters( 'um_settings_section_' . $current_tab . '_' . $current_subtab . '_content', echo apply_filters( 'um_settings_section_' . $current_tab . '_' . $current_subtab . '_content',
$this->render_settings_section( $section_fields, $current_tab, $current_subtab ), $settings_section,
$section_fields $section_fields
); );
?> ?>
@@ -2181,7 +2184,6 @@ Cache User Profile: <?php if( UM()->options()->get( 'um_profile_object_cache_s
Generate Slugs on Directories: <?php if( UM()->options()->get( 'um_generate_slug_in_directory' ) == 1 ){ echo "No"; }else{ echo "Yes"; } echo "\n"; ?> Generate Slugs on Directories: <?php if( UM()->options()->get( 'um_generate_slug_in_directory' ) == 1 ){ echo "No"; }else{ echo "Yes"; } echo "\n"; ?>
Rewrite Rules: <?php if( UM()->options()->get( 'um_flush_stop' ) == 1 ){ echo "No"; }else{ echo "Yes"; } echo "\n"; ?> Rewrite Rules: <?php if( UM()->options()->get( 'um_flush_stop' ) == 1 ){ echo "No"; }else{ echo "Yes"; } echo "\n"; ?>
Force UTF-8 Encoding: <?php if( UM()->options()->get( 'um_force_utf8_strings' ) == 1 ){ echo "Yes"; }else{ echo "No"; } echo "\n"; ?> Force UTF-8 Encoding: <?php if( UM()->options()->get( 'um_force_utf8_strings' ) == 1 ){ echo "Yes"; }else{ echo "No"; } echo "\n"; ?>
Time Check Security: <?php if( UM()->options()->get( 'enable_timebot' ) == 1 ){ echo "Yes"; }else{ echo "No"; } echo "\n"; ?>
JS/CSS Compression: <?php if ( defined('SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) { echo "Yes"; }else{ echo "No"; } echo "\n"; ?> JS/CSS Compression: <?php if ( defined('SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) { echo "Yes"; }else{ echo "No"; } echo "\n"; ?>
<?php if( is_multisite() ): ?> <?php if( is_multisite() ): ?>
Network Structure: <?php echo UM()->options()->get( 'network_permalink_structure' ). "\n"; ?> Network Structure: <?php echo UM()->options()->get( 'network_permalink_structure' ). "\n"; ?>
+34 -6
View File
@@ -17,6 +17,12 @@ if ( ! class_exists( 'um\admin\core\Admin_Upgrade' ) ) {
class Admin_Upgrade { class Admin_Upgrade {
/**
* @var null
*/
protected static $instance = null;
/** /**
* @var * @var
*/ */
@@ -31,6 +37,25 @@ if ( ! class_exists( 'um\admin\core\Admin_Upgrade' ) ) {
var $packages_dir; var $packages_dir;
/**
* Main Admin_Upgrade Instance
*
* Ensures only one instance of UM is loaded or can be loaded.
*
* @since 1.0
* @static
* @see UM()
* @return Admin_Upgrade - Main instance
*/
static public function instance() {
if ( is_null( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
/** /**
* Admin_Upgrade constructor. * Admin_Upgrade constructor.
*/ */
@@ -39,11 +64,14 @@ if ( ! class_exists( 'um\admin\core\Admin_Upgrade' ) ) {
$this->necessary_packages = $this->need_run_upgrades(); $this->necessary_packages = $this->need_run_upgrades();
if ( ! empty( $this->necessary_packages ) ) { if ( ! empty( $this->necessary_packages ) ) {
$this->init_packages_ajax();
add_action( 'admin_menu', array( $this, 'admin_menu' ), 0 ); add_action( 'admin_menu', array( $this, 'admin_menu' ), 0 );
add_action( 'wp_ajax_um_run_package', array( $this, 'ajax_run_package' ) ); if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
add_action( 'wp_ajax_um_get_packages', array( $this, 'ajax_get_packages' ) ); $this->init_packages_ajax();
add_action( 'wp_ajax_um_run_package', array( $this, 'ajax_run_package' ) );
add_action( 'wp_ajax_um_get_packages', array( $this, 'ajax_get_packages' ) );
}
} }
//add_action( 'in_plugin_update_message-' . um_plugin, array( $this, 'in_plugin_update_message' ) ); //add_action( 'in_plugin_update_message-' . um_plugin, array( $this, 'in_plugin_update_message' ) );
@@ -143,7 +171,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Upgrade' ) ) {
foreach ( $this->necessary_packages as $package ) { foreach ( $this->necessary_packages as $package ) {
$hooks_file = $this->packages_dir . DIRECTORY_SEPARATOR . $package . DIRECTORY_SEPARATOR . 'hooks.php'; $hooks_file = $this->packages_dir . DIRECTORY_SEPARATOR . $package . DIRECTORY_SEPARATOR . 'hooks.php';
if ( file_exists( $hooks_file ) ) { if ( file_exists( $hooks_file ) ) {
$pack_ajax_hooks = include $hooks_file; $pack_ajax_hooks = include_once $hooks_file;
foreach ( $pack_ajax_hooks as $action => $function ) { foreach ( $pack_ajax_hooks as $action => $function ) {
add_action( 'wp_ajax_um_' . $action, "um_upgrade_$function" ); add_action( 'wp_ajax_um_' . $action, "um_upgrade_$function" );
@@ -160,7 +188,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Upgrade' ) ) {
foreach ( $this->necessary_packages as $package ) { foreach ( $this->necessary_packages as $package ) {
$handlers_file = $this->packages_dir . DIRECTORY_SEPARATOR . $package . DIRECTORY_SEPARATOR . 'functions.php'; $handlers_file = $this->packages_dir . DIRECTORY_SEPARATOR . $package . DIRECTORY_SEPARATOR . 'functions.php';
if ( file_exists( $handlers_file ) ) { if ( file_exists( $handlers_file ) ) {
include $handlers_file; include_once $handlers_file;
} }
} }
} }
@@ -290,7 +318,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Upgrade' ) ) {
exit(''); exit('');
} else { } else {
ob_start(); ob_start();
include $this->packages_dir . DIRECTORY_SEPARATOR . $_POST['pack'] . DIRECTORY_SEPARATOR . 'init.php'; include_once $this->packages_dir . DIRECTORY_SEPARATOR . $_POST['pack'] . DIRECTORY_SEPARATOR . 'init.php';
ob_get_flush(); ob_get_flush();
exit; exit;
} }
@@ -25,8 +25,8 @@ foreach ( $emails as $email_key => $value ) {
} else { } else {
$setting_value = UM()->options()->get( $email_key ); $setting_value = UM()->options()->get( $email_key );
$fp = fopen( $theme_template_path, "w" ); $fp = @fopen( $theme_template_path, "w" );
$result = fputs( $fp, $setting_value ); $result = @fputs( $fp, $setting_value );
fclose( $fp ); fclose( $fp );
} }
} else { } else {
@@ -18,9 +18,15 @@ $menus = get_posts( array(
foreach ( $menus as $menu ) { foreach ( $menus as $menu ) {
$menu_roles = get_post_meta( $menu->ID, 'menu-item-um_nav_roles', true ); $menu_roles = get_post_meta( $menu->ID, 'menu-item-um_nav_roles', true );
foreach ( $menu_roles as $i => $role_k ) { if( !is_array( $menu_roles ) ) {
$menu_roles[ $i ] = $roles_associations[ $role_k ]; $menu_roles = array();
} }
foreach ( $menu_roles as $i => $role_k ) {
if( $role_k != '' && isset( $roles_associations[ $role_k ] ) ) {
$menu_roles[ $i ] = $roles_associations[ $role_k ];
}
}
update_post_meta( $menu->ID, 'menu-item-um_nav_roles', $menu_roles ); update_post_meta( $menu->ID, 'menu-item-um_nav_roles', $menu_roles );
} }
@@ -0,0 +1,6 @@
<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>
<p>
<a href="<?php echo add_query_arg( 'um_adm_action', 'manual_upgrades_request' ); ?>" class="button">
<?php _e( 'Get latest versions', 'ultimate-member' ) ?>
</a>
</p>
@@ -0,0 +1,71 @@
<div class="um-admin-metabox">
<?php
$options = array(
'' => __( 'Select page', 'ultimate-member' )
);
$pages = get_pages();
foreach ( $pages as $page ) {
$options[$page->ID] = $page->post_title;
}
UM()->admin_forms( array(
'class' => 'um-form-register-gdpr um-top-label',
'prefix_id' => 'form',
'fields' => array(
array(
'id' => '_um_register_use_gdpr',
'type' => 'select',
'label' => __( 'Enable on this form', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_register_use_gdpr', null, '' ),
'options' => array(
'0' => __( 'No', 'ultimate-member' ),
'1' => __( 'Yes', 'ultimate-member' )
),
),
array(
'id' => '_um_register_use_gdpr_content_id',
'type' => 'select',
'label' => __( 'Content', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value('_um_register_use_gdpr_content_id', null, '' ),
'options' => $options,
'conditional' => array( '_um_register_use_gdpr', '=', '1' )
),
array(
'id' => '_um_register_use_gdpr_toggle_show',
'type' => 'text',
'label' => __( 'Toggle Show text', 'ultimate-member' ),
'placeholder' => __( 'Show privacy policy', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value('_um_register_use_gdpr_toggle_show', null, __( 'Show privacy policy', 'ultimate-member' ) ),
'conditional' => array( '_um_register_use_gdpr', '=', '1' )
),
array(
'id' => '_um_register_use_gdpr_toggle_hide',
'type' => 'text',
'label' => __( 'Toggle Hide text', 'ultimate-member' ),
'placeholder' => __( 'Hide privacy policy', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value('_um_register_use_gdpr_toggle_hide', null, __( 'Hide privacy policy', 'ultimate-member' ) ),
'conditional' => array( '_um_register_use_gdpr', '=', '1' )
),
array(
'id' => '_um_register_use_gdpr_agreement',
'type' => 'text',
'label' => __( 'Checkbox agreement description', 'ultimate-member' ),
'placeholder' => __( 'Please confirm that you agree to our privacy policy', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value('_um_register_use_gdpr_agreement', null, __( 'Please confirm that you agree to our privacy policy', 'ultimate-member' ) ),
'conditional' => array( '_um_register_use_gdpr', '=', '1' )
),
array(
'id' => '_um_register_use_gdpr_error_text',
'type' => 'text',
'label' => __( 'Error Text', 'ultimate-member' ),
'placeholder' => __( 'Please confirm your acceptance of our privacy policy', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value('_um_register_use_gdpr_error_text', null, __( 'Please confirm your acceptance of our privacy policy', 'ultimate-member' ) ),
'conditional' => array( '_um_register_use_gdpr', '=', '1' )
)
)
) )->render_form(); ?>
<div class="um-admin-clear"></div>
</div>
+40
View File
@@ -0,0 +1,40 @@
<?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly. ?>
<h2>
<?php _e( 'What personal data we collect and why we collect it', 'ultimate-member' ); ?>
</h2>
<h3>
<?php _e( 'Forms', 'ultimate-member' ); ?>
</h3>
<p>
<?php printf( __( '%s provides you with forms for user registration, login and profiles.', 'ultimate-member' ), ultimatemember_plugin_name ); ?>
</p>
<p>
<?php _e( 'Via these forms you are collecting personal data from your users.', 'ultimate-member' ); ?>
</p>
<p>
<?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' ); ?>
</p>
<h2>
<?php _e( 'How long we retain your data', 'ultimate-member' ); ?>
</h2>
<p>
<?php _e( 'Registered user information is retained in your websites database indefinitely.', 'ultimate-member' ); ?>
</p>
<p>
<?php _e( 'Data can be exported or removed upon users request via the existing WordPress data exporter or eraser.', 'ultimate-member' ); ?>
</p>
<p>
<?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' ); ?>
</p>
<h2>
<?php _e( 'Where we send your data', 'ultimate-member' ); ?>
</h2>
<p>
<?php printf( __( '%s does not send any user data outside of your site by default.', 'ultimate-member' ), ultimatemember_plugin_name ); ?>
</p>
<p>
<?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' ); ?>
</p>
+1
View File
@@ -57,6 +57,7 @@ if ( ! class_exists( 'um\Dependencies' ) ) {
'woocommerce' => '2.0.1', 'woocommerce' => '2.0.1',
'restrict-content' => '2.0', 'restrict-content' => '2.0',
'beaver-builder' => '2.0', 'beaver-builder' => '2.0',
'gdpr' => '1.0.0',
); );
+49 -43
View File
@@ -30,6 +30,7 @@ if ( ! class_exists( 'UM' ) ) {
* @method UM_Terms_Conditions_API Terms_Conditions_API() * @method UM_Terms_Conditions_API Terms_Conditions_API()
* @method UM_Private_Content_API Private_Content_API() * @method UM_Private_Content_API Private_Content_API()
* @method UM_User_Location_API User_Location_API() * @method UM_User_Location_API User_Location_API()
* @method UM_GDPR_API GDPR_API()
* *
*/ */
final class UM extends UM_Functions { 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 '<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>';
}*/
/** /**
* Autoload UM classes handler * Autoload UM classes handler
* *
@@ -525,6 +485,7 @@ if ( ! class_exists( 'UM' ) ) {
$this->ajax_init(); $this->ajax_init();
$this->metabox(); $this->metabox();
$this->admin_upgrade()->init_packages_ajax_handlers(); $this->admin_upgrade()->init_packages_ajax_handlers();
$this->admin_gdpr();
} elseif ( $this->is_request( 'admin' ) ) { } elseif ( $this->is_request( 'admin' ) ) {
$this->admin(); $this->admin();
$this->admin_menu(); $this->admin_menu();
@@ -537,6 +498,7 @@ if ( ! class_exists( 'UM' ) ) {
$this->users(); $this->users();
$this->dragdrop(); $this->dragdrop();
$this->plugin_updater(); $this->plugin_updater();
$this->admin_gdpr();
} elseif ( $this->is_request( 'frontend' ) ) { } elseif ( $this->is_request( 'frontend' ) ) {
$this->enqueue(); $this->enqueue();
$this->account(); $this->account();
@@ -562,9 +524,10 @@ if ( ! class_exists( 'UM' ) ) {
$this->permalinks(); $this->permalinks();
$this->modal(); $this->modal();
$this->cron(); $this->cron();
$this->tracking(); //$this->tracking();
$this->mobile(); $this->mobile();
$this->external_integrations(); $this->external_integrations();
$this->gdpr();
} }
@@ -674,12 +637,55 @@ if ( ! class_exists( 'UM' ) ) {
*/ */
function admin_upgrade() { function admin_upgrade() {
if ( empty( $this->classes['admin_upgrade'] ) ) { if ( empty( $this->classes['admin_upgrade'] ) ) {
$this->classes['admin_upgrade'] = new um\admin\core\Admin_Upgrade(); $this->classes['admin_upgrade'] = um\admin\core\Admin_Upgrade::instance();
//$this->classes['admin_upgrade'] = new um\admin\core\Admin_Upgrade();
} }
return $this->classes['admin_upgrade']; return $this->classes['admin_upgrade'];
} }
/**
* GDPR privacy policy
*
* @since 2.0.14
*
* @return bool|um\admin\core\Admin_GDPR()
*/
function admin_gdpr() {
global $wp_version;
if ( version_compare( $wp_version, '4.9.6', '<' ) ) {
return false;
}
if ( empty( $this->classes['admin_gdpr'] ) ) {
$this->classes['admin_gdpr'] = new um\admin\core\Admin_GDPR();
}
return $this->classes['admin_gdpr'];
}
/**
* GDPR privacy policy
*
* @since 2.0.14
*
* @return bool|um\core\GDPR()
*/
function gdpr() {
global $wp_version;
if ( version_compare( $wp_version, '4.9.6', '<' ) ) {
return false;
}
if ( empty( $this->classes['gdpr'] ) ) {
$this->classes['gdpr'] = new um\core\GDPR();
}
return $this->classes['gdpr'];
}
/** /**
* @since 2.0 * @since 2.0
* *
+62 -1
View File
@@ -65,6 +65,10 @@ if ( ! class_exists( 'um\core\Access' ) ) {
add_action( 'template_redirect', array( &$this, 'template_redirect' ), 1000 ); add_action( 'template_redirect', array( &$this, 'template_redirect' ), 1000 );
add_action( 'um_access_check_individual_term_settings', array( &$this, 'um_access_check_individual_term_settings' ) ); add_action( 'um_access_check_individual_term_settings', array( &$this, 'um_access_check_individual_term_settings' ) );
add_action( 'um_access_check_global_settings', array( &$this, 'um_access_check_global_settings' ) ); add_action( 'um_access_check_global_settings', array( &$this, 'um_access_check_global_settings' ) );
/* Disable comments if user has not permission to access current post */
add_filter( 'comments_open', array( $this, 'disable_comments_open' ), 99, 2 );
add_filter( 'get_comments_number', array( $this, 'disable_comments_open' ), 99, 2 );
} }
@@ -532,7 +536,7 @@ if ( ! class_exists( 'um\core\Access' ) ) {
if ( ! empty( $post->post_type ) && $post->post_type == 'page' ) { if ( ! empty( $post->post_type ) && $post->post_type == 'page' ) {
if ( um_is_core_post( $post, 'login' ) || um_is_core_post( $post, 'register' ) || 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, 'account' ) || um_is_core_post( $post, 'logout' ) ||
um_is_core_post( $post, 'password-reset' ) ) um_is_core_post( $post, 'password-reset' ) || ( is_user_logged_in() && um_is_core_post( $post, 'user' ) ) )
return false; return false;
} }
@@ -934,6 +938,63 @@ if ( ! class_exists( 'um\core\Access' ) ) {
} }
/**
* Disable comments if user has not permission to access this post
* @param mixed $open
* @param int $post_id
* @return boolean
*/
public function disable_comments_open( $open, $post_id ) {
static $cache = array();
if ( isset( $cache[ $post_id ] ) ) {
return $cache[ $post_id ] ? $open : false;
}
$post = get_post( $post_id );
$restriction = $this->get_post_privacy_settings( $post );
if ( ! $restriction ) {
$cache[ $post_id ] = $open;
return $open;
}
if ( '1' == $restriction['_um_accessible'] ) {
if ( is_user_logged_in() ) {
if ( ! current_user_can( 'administrator' ) ) {
$open = false;
}
}
} elseif ( '2' == $restriction['_um_accessible'] ) {
if ( ! is_user_logged_in() ) {
$open = false;
} else {
if ( ! current_user_can( 'administrator' ) ) {
$custom_restrict = $this->um_custom_restriction( $restriction );
if ( empty( $restriction['_um_access_roles'] ) || false === array_search( '1', $restriction['_um_access_roles'] ) ) {
if ( ! $custom_restrict ) {
$open = false;
}
} else {
$user_can = $this->user_can( get_current_user_id(), $restriction['_um_access_roles'] );
if ( ! isset( $user_can ) || ! $user_can || ! $custom_restrict ) {
$open = false;
}
}
}
}
}
$cache[ $post_id ] = $open;
return $open;
}
/** /**
* Protect Post Types in menu query * Protect Post Types in menu query
* Restrict content new logic * Restrict content new logic
+2 -3
View File
@@ -55,6 +55,7 @@ if ( ! class_exists( 'um\core\Account' ) ) {
* @param $args * @param $args
*/ */
function init_tabs( $args ) { function init_tabs( $args ) {
$this->tabs = $this->get_tabs(); $this->tabs = $this->get_tabs();
ksort( $this->tabs ); ksort( $this->tabs );
@@ -75,7 +76,6 @@ if ( ! class_exists( 'um\core\Account' ) ) {
} }
} }
$this->tabs = $tabs_structed; $this->tabs = $tabs_structed;
} }
@@ -527,7 +527,7 @@ if ( ! class_exists( 'um\core\Account' ) ) {
* ?> * ?>
*/ */
$args = apply_filters( 'um_account_tab_privacy_fields', $args, $shortcode_args ); $args = apply_filters( 'um_account_tab_privacy_fields', $args, $shortcode_args );
$fields = UM()->builtin()->get_specific_fields( $args ); $fields = UM()->builtin()->get_specific_fields( $args );
$fields = $this->account_secure_fields( $fields, $id ); $fields = $this->account_secure_fields( $fields, $id );
$fields = $this->filter_fields_by_attrs( $fields, $shortcode_args ); $fields = $this->filter_fields_by_attrs( $fields, $shortcode_args );
@@ -535,7 +535,6 @@ if ( ! class_exists( 'um\core\Account' ) ) {
foreach ( $fields as $key => $data ){ foreach ( $fields as $key => $data ){
$output .= UM()->fields()->edit_field( $key, $data ); $output .= UM()->fields()->edit_field( $key, $data );
} }
break; break;
case 'delete': case 'delete':
+1 -1
View File
@@ -1252,7 +1252,7 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
*/ */
$fields_without_metakey = apply_filters( 'um_fields_without_metakey', $fields_without_metakey ); $fields_without_metakey = apply_filters( 'um_fields_without_metakey', $fields_without_metakey );
if ( !$show_all ) { if ( ! $show_all ) {
$this->fields_dropdown = array('image','file','password','rating'); $this->fields_dropdown = array('image','file','password','rating');
$this->fields_dropdown = array_merge( $this->fields_dropdown, $fields_without_metakey ); $this->fields_dropdown = array_merge( $this->fields_dropdown, $fields_without_metakey );
} else { } else {
+2
View File
@@ -319,6 +319,8 @@ if ( ! class_exists( 'um\core\Enqueue' ) ) {
wp_register_script('um_functions', um_url . 'assets/js/um-functions' . $this->suffix . '.js', array('jquery', 'jquery-masonry') ); wp_register_script('um_functions', um_url . 'assets/js/um-functions' . $this->suffix . '.js', array('jquery', 'jquery-masonry') );
wp_enqueue_script('um_functions'); wp_enqueue_script('um_functions');
wp_enqueue_script( 'um-gdpr', um_url . 'assets/js/um-gdpr' . $this->suffix . '.js', array( 'jquery' ), ultimatemember_version, false );
} }
+34 -13
View File
@@ -573,7 +573,8 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
} elseif ( um_user( $key ) && $this->editing == true ) { } elseif ( um_user( $key ) && $this->editing == true ) {
if ( strstr( $key, 'user_pass' ) ) { //show empty value for password fields
if ( strstr( $key, 'user_pass' ) || $type == 'password' ) {
return ''; return '';
} }
@@ -798,6 +799,11 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
return true; 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 ] ) ) { if ( in_array( html_entity_decode( $value ), UM()->form()->post_form[ $key ] ) ) {
return true; return true;
} }
@@ -808,16 +814,21 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
$field_value = um_user( $key ); $field_value = um_user( $key );
if ($key == 'role') { if ( $key == 'role' ) {
$role_keys = get_option( 'um_roles' ); $role_keys = get_option( 'um_roles' );
if (!empty( $role_keys )) { if ( ! empty( $role_keys ) ) {
if (in_array( $field_value, $role_keys )) { if ( in_array( $field_value, $role_keys ) ) {
$field_value = 'um_' . $field_value; $field_value = 'um_' . $field_value;
} }
} }
/*elseif( $this->set_mode == 'register' ){
$data['default'] = UM()->options()->get( 'register_role' );
}
else{
$data['default'] = get_option( 'default_role' );
}*/
} }
/** /**
@@ -930,19 +941,25 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
$um_user_value = um_user( $key ); $um_user_value = um_user( $key );
if ($key == 'role') { if ( $key == 'role' ) {
$um_user_value = strtolower( $um_user_value ); $um_user_value = strtolower( $um_user_value );
$role_keys = get_option( 'um_roles' ); $role_keys = get_option( 'um_roles' );
if (!empty( $role_keys )) { if ( ! empty( $role_keys ) ) {
if (in_array( $um_user_value, $role_keys )) { if ( in_array( $um_user_value, $role_keys ) ) {
$um_user_value = 'um_' . $um_user_value; $um_user_value = 'um_' . $um_user_value;
} }
} }
/*elseif( $this->set_mode == 'register' ){
$data['default'] = UM()->options()->get( 'register_role' );
}
else{
$data['default'] = get_option( 'default_role' );
}*/
} }
if ($um_user_value == $value) { if ( $um_user_value == $value ) {
return true; return true;
} }
@@ -1578,7 +1595,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
if ($visibility == 'view' && $this->set_mode != 'register') return; if ($visibility == 'view' && $this->set_mode != 'register') 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' ) ( isset( $data['editable'] ) && $data['editable'] == 0 && $this->set_mode == 'profile' )
) { ) {
@@ -1619,6 +1636,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
// forbidden in edit mode? // forbidden in edit mode?
if (isset( $data['edit_forbidden'] )) return; if (isset( $data['edit_forbidden'] )) return;
// required option // required option
if (isset( $data['required_opt'] )) { if (isset( $data['required_opt'] )) {
$opt = $data['required_opt']; $opt = $data['required_opt'];
@@ -2872,7 +2890,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
$um_field_checkbox_item_title = $v; $um_field_checkbox_item_title = $v;
$option_value = $v; $option_value = $v;
if (!is_numeric( $k ) && in_array( $form_key, array( 'role' ) )) { if ( ! is_numeric( $k ) && in_array( $form_key, array( 'role', 'role_radio' ) ) ) {
$um_field_checkbox_item_title = $v; $um_field_checkbox_item_title = $v;
$option_value = $k; $option_value = $k;
} }
@@ -3466,9 +3484,12 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
if (isset( $data['in_group'] ) && $data['in_group'] != '' && $rule != 'group') return; if (isset( $data['in_group'] ) && $data['in_group'] != '' && $rule != 'group') return;
if ($visibility == 'edit') return; if ( $visibility == 'edit' ) return;
if (in_array( $type, array( 'block', 'shortcode', 'spacing', 'divider', 'group' ) )) { //invisible on profile page
if ( $type == 'password' ) return;
if ( in_array( $type, array( 'block', 'shortcode', 'spacing', 'divider', 'group' ) ) ) {
} else { } else {
+2 -14
View File
@@ -331,19 +331,6 @@ if ( ! class_exists( 'um\core\Form' ) ) {
wp_die( 'Hello, spam bot!', 'ultimate-member' ); wp_die( 'Hello, spam bot!', 'ultimate-member' );
} }
if ( ! in_array( $this->form_data['mode'], array( 'login' ) ) ) {
$form_timestamp = trim($_POST['timestamp']);
$live_timestamp = current_time( 'timestamp' );
if ( $form_timestamp == '' && UM()->options()->get( 'enable_timebot' ) == 1 )
wp_die( __('Hello, spam bot!','ultimate-member') );
if ( !current_user_can('manage_options') && $live_timestamp - $form_timestamp < 6 && UM()->options()->get( 'enable_timebot' ) == 1 )
wp_die( __('Whoa, slow down! You\'re seeing this message because you tried to submit a form too fast and we think you might be a spam bot. If you are a real human being please wait a few seconds before submitting the form. Thanks!','ultimate-member') );
}
/** /**
* UM hook * UM hook
* *
@@ -478,8 +465,9 @@ if ( ! class_exists( 'um\core\Form' ) ) {
$global_role = get_option( 'default_role' ); // WP Global settings $global_role = get_option( 'default_role' ); // WP Global settings
$um_global_role = UM()->options()->get( 'register_role' ); // UM Settings Global settings $um_global_role = UM()->options()->get( 'register_role' ); // UM Settings Global settings
if ( ! empty( $um_global_role ) ) if ( ! empty( $um_global_role ) ) {
$global_role = $um_global_role; // Form Global settings $global_role = $um_global_role; // Form Global settings
}
$mode = $this->form_type( $post_id ); $mode = $this->form_type( $post_id );
+86
View File
@@ -0,0 +1,86 @@
<?php
namespace um\core;
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) exit;
if ( ! class_exists( 'um\core\GDPR' ) ) {
/**
* Class Admin_GDPR
* @package um\core
*/
class GDPR {
/**
* Admin_GDPR constructor.
*/
function __construct() {
add_action( 'um_submit_form_register', array( &$this, 'agreement_validation' ), 9 );
add_filter( 'um_before_save_filter_submitted', array( &$this, 'add_agreement_date' ), 10, 1 );
add_filter( 'um_email_registration_data', array( &$this, 'email_registration_data' ), 10, 1 );
add_action( 'um_after_form_fields', array( &$this, 'display_option' ) );
}
/**
* @param $args
*/
function display_option( $args ) {
if ( isset( $args['use_gdpr'] ) && $args['use_gdpr'] == 1 ) {
require um_path . 'templates/gdpr-register.php';
}
}
/**
* @param $args
*/
function agreement_validation( $args ) {
$gdpr_enabled = get_post_meta( $args['form_id'], '_um_register_use_gdpr', true );
if ( $gdpr_enabled && ! isset( $args['submitted']['use_gdpr_agreement'] ) ) {
UM()->form()->add_error( 'use_gdpr_agreement', isset( $args['use_gdpr_error_text'] ) ? $args['use_gdpr_error_text'] : '' );
}
}
/**
* @param $submitted
*
* @return mixed
*/
function add_agreement_date( $submitted ) {
if ( isset( $submitted['use_gdpr_agreement'] ) ) {
$submitted['use_gdpr_agreement'] = time();
}
return $submitted;
}
/**
* @param $submitted
*
* @return mixed
*/
function email_registration_data( $submitted ) {
$timestamp = ! empty( $submitted['timestamp'] ) ? $submitted['timestamp'] : $submitted['use_gdpr_agreement'];
if ( ! empty( $submitted['use_gdpr_agreement'] ) ) {
$submitted['GDPR Applied'] = date( "d M Y H:i", $timestamp );
unset( $submitted['use_gdpr_agreement'] );
}
return $submitted;
}
}
}
+6 -18
View File
@@ -124,10 +124,14 @@ if ( ! class_exists( 'um\core\Mail' ) ) {
$this->message = $this->prepare_template( $template, $args ); $this->message = $this->prepare_template( $template, $args );
add_filter( 'wp_mail_content_type', array( &$this, 'set_content_type' ) ); if ( UM()->options()->get( 'email_html' ) ) {
$this->headers .= "Content-Type: text/html\r\n";
} else {
$this->headers .= "Content-Type: text/plain\r\n";
}
// Send mail // Send mail
wp_mail( $email, $this->subject, $this->message, $this->headers, $this->attachments ); wp_mail( $email, $this->subject, $this->message, $this->headers, $this->attachments );
remove_filter( 'wp_mail_content_type', array( &$this, 'set_content_type' ) );
} }
@@ -481,22 +485,6 @@ if ( ! class_exists( 'um\core\Mail' ) ) {
} }
/**
* Set email content type
*
*
* @param $content_type
* @return string
*/
function set_content_type( $content_type ) {
if ( UM()->options()->get( 'email_html' ) ) {
return 'text/html';
} else {
return 'text/plain';
}
}
/** /**
* Ajax copy template to the theme * Ajax copy template to the theme
* *
+7
View File
@@ -118,11 +118,18 @@ if ( ! class_exists( 'um\core\Profile' ) ) {
// disable private tabs // disable private tabs
if ( ! is_admin() ) { if ( ! is_admin() ) {
if( is_user_logged_in() ) {
$user_id = um_user('ID');
um_fetch_user( get_current_user_id() );
}
foreach ( $tabs as $id => $tab ) { foreach ( $tabs as $id => $tab ) {
if ( ! $this->can_view_tab( $id ) ) { if ( ! $this->can_view_tab( $id ) ) {
unset( $tabs[$id] ); unset( $tabs[$id] );
} }
} }
if( is_user_logged_in() ) {
um_fetch_user( $user_id );
}
} }
return $tabs; return $tabs;
+104 -63
View File
@@ -39,6 +39,7 @@ if ( ! class_exists( 'um\core\User' ) ) {
add_action( 'init', array( &$this, 'set' ), 1 ); add_action( 'init', array( &$this, 'set' ), 1 );
$this->preview = false; $this->preview = false;
$this->send_mail_on_delete = true;
// a list of keys that should never be in wp_usermeta // a list of keys that should never be in wp_usermeta
$this->update_user_keys = array( $this->update_user_keys = array(
@@ -54,6 +55,8 @@ if ( ! class_exists( 'um\core\User' ) ) {
// When the cache should be cleared // When the cache should be cleared
add_action('um_delete_user_hook', array(&$this, 'remove_cached_queue') ); add_action('um_delete_user_hook', array(&$this, 'remove_cached_queue') );
add_action('um_delete_user', array( &$this, 'remove_cache' ), 10, 1 );
add_action('um_after_user_status_is_changed_hook', array(&$this, 'remove_cached_queue') ); add_action('um_after_user_status_is_changed_hook', array(&$this, 'remove_cached_queue') );
// When user cache should be cleared // When user cache should be cleared
@@ -83,6 +86,73 @@ if ( ! class_exists( 'um\core\User' ) ) {
add_action( 'wpmu_activate_user', array( &$this, 'add_um_role_wpmu_new_user' ), 10, 1 ); add_action( 'wpmu_activate_user', array( &$this, 'add_um_role_wpmu_new_user' ), 10, 1 );
add_action( 'init', array( &$this, 'check_membership' ), 10 ); add_action( 'init', array( &$this, 'check_membership' ), 10 );
add_action( 'delete_user', array( &$this, 'delete_user_handler' ), 10, 1 );
add_action( 'wpmu_delete_user', array( &$this, 'delete_user_handler' ), 10, 1 );
}
/**
* @param $user_id
*/
function delete_user_handler( $user_id ) {
um_fetch_user( $user_id );
/**
* UM hook
*
* @type action
* @title um_delete_user_hook
* @description On delete user
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_delete_user_hook', 'function_name', 10 );
* @example
* <?php
* add_action( 'um_delete_user_hook', 'my_delete_user', 10 );
* function my_delete_user() {
* // your code here
* }
* ?>
*/
do_action( 'um_delete_user_hook' );
/**
* UM hook
*
* @type action
* @title um_delete_user
* @description On delete user
* @input_vars
* [{"var":"$user_id","type":"int","desc":"User ID"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_delete_user', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_delete_user', 'my_delete_user', 10, 1 );
* function my_delete_user( $user_id ) {
* // your code here
* }
* ?>
*/
do_action( 'um_delete_user', um_user( 'ID' ) );
// send email notifications
if ( $this->send_mail_on_delete ) {
UM()->mail()->send( um_user( 'user_email' ), 'deletion_email' );
$emails = um_multi_admin_email();
if ( ! empty( $emails ) ) {
foreach ( $emails as $email ) {
UM()->mail()->send( $email, 'notification_deletion', array( 'admin' => true ) );
}
}
}
// remove uploads
UM()->files()->remove_dir( um_user_uploads_dir() );
} }
@@ -890,6 +960,20 @@ if ( ! class_exists( 'um\core\User' ) ) {
unset( $submitted['confirm_user_password'] ); 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 * UM hook
* *
@@ -1274,59 +1358,10 @@ if ( ! class_exists( 'um\core\User' ) ) {
* @param bool $send_mail * @param bool $send_mail
*/ */
function delete( $send_mail = true ) { function delete( $send_mail = true ) {
/**
* UM hook
*
* @type action
* @title um_delete_user_hook
* @description On delete user
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_delete_user_hook', 'function_name', 10 );
* @example
* <?php
* add_action( 'um_delete_user_hook', 'my_delete_user', 10 );
* function my_delete_user() {
* // your code here
* }
* ?>
*/
do_action( 'um_delete_user_hook' );
/**
* UM hook
*
* @type action
* @title um_delete_user
* @description On delete user
* @input_vars
* [{"var":"$user_id","type":"int","desc":"User ID"}]
* @change_log
* ["Since: 2.0"]
* @usage add_action( 'um_delete_user', 'function_name', 10, 1 );
* @example
* <?php
* add_action( 'um_delete_user', 'my_delete_user', 10, 1 );
* function my_delete_user( $user_id ) {
* // your code here
* }
* ?>
*/
do_action( 'um_delete_user', um_user( 'ID' ) );
// send email notifications $this->send_mail_on_delete = $send_mail;
if ( $send_mail ) {
UM()->mail()->send( um_user( 'user_email' ), 'deletion_email' );
$emails = um_multi_admin_email(); $this->delete_user_handler( um_user( 'ID' ) );
if ( ! empty( $emails ) ) {
foreach ( $emails as $email ) {
UM()->mail()->send( $email, 'notification_deletion', array( 'admin' => true ) );
}
}
}
// remove uploads
UM()->files()->remove_dir( um_user_uploads_dir() );
// remove user // remove user
if ( is_multisite() ) { if ( is_multisite() ) {
@@ -1626,23 +1661,29 @@ if ( ! class_exists( 'um\core\User' ) ) {
} }
} }
// update user // update user
if ( count( $args ) > 1 ) { if ( count( $args ) > 1 ) {
global $wp_roles;
$um_roles = get_option( 'um_roles' );
if ( ! empty( $um_roles ) ) { //if isset roles argument validate role to properly for security reasons
$role_keys = array_map( function( $item ) { if ( isset( $args['role'] ) ) {
return 'um_' . $item; global $wp_roles;
}, get_option( 'um_roles' ) ); $um_roles = get_option( 'um_roles' );
} else {
$role_keys = array();
}
$exclude_roles = array_diff( array_keys( $wp_roles->roles ), array_merge( $role_keys, array( 'subscriber' ) ) ); if ( ! empty( $um_roles ) ) {
$role_keys = array_map( function( $item ) {
return 'um_' . $item;
}, get_option( 'um_roles' ) );
} else {
$role_keys = array();
}
if ( isset( $args['role'] ) && in_array( $args['role'], $exclude_roles ) ) { $exclude_roles = array_diff( array_keys( $wp_roles->roles ), array_merge( $role_keys, array( 'subscriber' ) ) );
unset( $args['role'] );
if ( in_array( $args['role'], $exclude_roles ) ) {
unset( $args['role'] );
}
} }
wp_update_user( $args ); wp_update_user( $args );
+3 -1
View File
@@ -108,7 +108,9 @@ function um_action_request_process() {
break; break;
case 'um_delete': case 'um_delete':
if ( ! UM()->roles()->um_current_user_can( 'delete', $uid ) ) wp_die( __('You do not have permission to delete this user.','ultimate-member') ); if ( ! UM()->roles()->um_current_user_can( 'delete', $uid ) ) {
wp_die( __('You do not have permission to delete this user.','ultimate-member') );
}
um_fetch_user( $uid ); um_fetch_user( $uid );
UM()->user()->delete(); UM()->user()->delete();
exit( wp_redirect( UM()->permalinks()->get_current_url( true ) ) ); exit( wp_redirect( UM()->permalinks()->get_current_url( true ) ) );
+6 -5
View File
@@ -314,8 +314,9 @@ function um_submit_form_errors_hook_( $args ) {
foreach ( $array['conditions'] as $condition ) { foreach ( $array['conditions'] as $condition ) {
list( $visibility, $parent_key, $op, $parent_value ) = $condition; list( $visibility, $parent_key, $op, $parent_value ) = $condition;
if ( ! isset( $args[ $parent_key ] ) ) if ( ! isset( $args[ $parent_key ] ) ) {
continue; continue;
}
$cond_value = ( $fields[ $parent_key ]['type'] == 'radio' ) ? $args[ $parent_key ][0] : $args[ $parent_key ]; $cond_value = ( $fields[ $parent_key ]['type'] == 'radio' ) ? $args[ $parent_key ][0] : $args[ $parent_key ];
@@ -337,11 +338,11 @@ function um_submit_form_errors_hook_( $args ) {
continue 2; continue 2;
} }
} elseif ( $op == 'greater than' ) { } elseif ( $op == 'greater than' ) {
if ( $cond_value > $op ) { if ( $cond_value > $parent_value ) {
continue 2; continue 2;
} }
} elseif ( $op == 'less than' ) { } elseif ( $op == 'less than' ) {
if ( $cond_value < $op ) { if ( $cond_value < $parent_value ) {
continue 2; continue 2;
} }
} elseif ( $op == 'contains' ) { } elseif ( $op == 'contains' ) {
@@ -367,11 +368,11 @@ function um_submit_form_errors_hook_( $args ) {
continue 2; continue 2;
} }
} elseif ( $op == 'greater than' ) { } elseif ( $op == 'greater than' ) {
if ( $cond_value <= $op ) { if ( $cond_value <= $parent_value ) {
continue 2; continue 2;
} }
} elseif ( $op == 'less than' ) { } elseif ( $op == 'less than' ) {
if ( $cond_value >= $op ) { if ( $cond_value >= $parent_value ) {
continue 2; continue 2;
} }
} elseif ( $op == 'contains' ) { } elseif ( $op == 'contains' ) {
-19
View File
@@ -133,15 +133,6 @@ function um_reset_password_errors_hook( $args ) {
if ( $_POST[ UM()->honeypot ] != '' ) if ( $_POST[ UM()->honeypot ] != '' )
wp_die('Hello, spam bot!','ultimate-member'); wp_die('Hello, spam bot!','ultimate-member');
$form_timestamp = trim($_POST['timestamp']);
$live_timestamp = current_time( 'timestamp' );
if ( $form_timestamp == '' && UM()->options()->get( 'enable_timebot' ) == 1 )
wp_die( __('Hello, spam bot!','ultimate-member') );
if ( $live_timestamp - $form_timestamp < 3 && UM()->options()->get( 'enable_timebot' ) == 1 )
wp_die( __('Whoa, slow down! You\'re seeing this message because you tried to submit a form too fast and we think you might be a spam bot. If you are a real human being please wait a few seconds before submitting the form. Thanks!','ultimate-member') );
$user = ""; $user = "";
foreach ( $_POST as $key => $val ) { foreach ( $_POST as $key => $val ) {
@@ -197,16 +188,6 @@ function um_change_password_errors_hook( $args ) {
wp_die('Hello, spam bot!','ultimate-member'); wp_die('Hello, spam bot!','ultimate-member');
} }
$form_timestamp = trim($_POST['timestamp']);
$live_timestamp = current_time( 'timestamp' );
if ( $form_timestamp == '' && UM()->options()->get( 'enable_timebot' ) == 1 )
wp_die( __('Hello, spam bot!','ultimate-member') );
if ( $live_timestamp - $form_timestamp < 3 && UM()->options()->get( 'enable_timebot' ) == 1 ) {
wp_die( __('Whoa, slow down! You\'re seeing this message because you tried to submit a form too fast and we think you might be a spam bot. If you are a real human being please wait a few seconds before submitting the form. Thanks!','ultimate-member') );
}
$reset_pass_hash = ''; $reset_pass_hash = '';
if( isset( $_REQUEST['act'] ) && $_REQUEST['act'] == 'reset_password' && um_is_core_page('password-reset') ){ if( isset( $_REQUEST['act'] ) && $_REQUEST['act'] == 'reset_password' && um_is_core_page('password-reset') ){
+33 -18
View File
@@ -218,8 +218,12 @@ function um_user_edit_profile( $args ) {
// loop through fields // loop through fields
if ( ! empty( $fields ) ) { if ( ! empty( $fields ) ) {
foreach ( $fields as $key => $array ) { 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'] ) if ( ! um_can_edit_field( $fields[ $key ] ) && isset( $fields[ $key ]['editable'] ) && ! $fields[ $key ]['editable'] )
continue; continue;
@@ -236,10 +240,15 @@ function um_user_edit_profile( $args ) {
} else { } else {
if ( isset( $userinfo[ $key ] ) && $args['submitted'][ $key ] != $userinfo[ $key ] ) { if ( $array['type'] == 'password' ) {
$to_update[ $key ] = $args['submitted'][ $key ]; $to_update[ $key ] = wp_hash_password( $args['submitted'][ $key ] );
} elseif ( $args['submitted'][ $key ] ) { $args['submitted'][ $key ] = sprintf( __( 'Your choosed %s', 'ultimate-member' ), $array['title'] );
$to_update[ $key ] = $args['submitted'][ $key ]; } else {
if ( isset( $userinfo[ $key ] ) && $args['submitted'][ $key ] != $userinfo[ $key ] ) {
$to_update[ $key ] = $args['submitted'][ $key ];
} elseif ( $args['submitted'][ $key ] ) {
$to_update[ $key ] = $args['submitted'][ $key ];
}
} }
} }
@@ -1368,40 +1377,46 @@ function um_profile_menu( $args ) {
<div class="um-profile-nav-item um-profile-nav-<?php echo $id . ' ' . $profile_nav_class; ?>"> <div class="um-profile-nav-item um-profile-nav-<?php echo $id . ' ' . $profile_nav_class; ?>">
<?php if ( UM()->options()->get( 'profile_menu_icons' ) ) { ?> <?php if ( UM()->options()->get( 'profile_menu_icons' ) ) { ?>
<a href="<?php echo $nav_link; ?>" class="um-tip-n uimob500-show uimob340-show uimob800-show" <a href="<?php echo $nav_link; ?>" class="uimob800-show uimob500-show uimob340-show um-tip-n"
title="<?php echo esc_attr( $tab['name'] ); ?>" original-title="<?php echo esc_attr( $tab['name'] ); ?>"> title="<?php echo esc_attr( $tab['name'] ); ?>" original-title="<?php echo esc_attr( $tab['name'] ); ?>">
<i class="<?php echo $tab['icon']; ?>"></i> <i class="<?php echo $tab['icon']; ?>"></i>
<?php if ( isset( $tab['notifier'] ) && $tab['notifier'] > 0 ) { ?> <?php if ( isset( $tab['notifier'] ) && $tab['notifier'] > 0 ) { ?>
<span class="um-tab-notifier uimob500-show uimob340-show uimob800-show"><?php echo $tab['notifier']; ?></span> <span class="um-tab-notifier uimob800-show uimob500-show uimob340-show"><?php echo $tab['notifier']; ?></span>
<?php } ?> <?php } ?>
<span class="uimob500-hide uimob340-hide uimob800-hide title"><?php echo $tab['name']; ?></span> <span class="uimob800-hide uimob500-hide uimob340-hide title"><?php echo $tab['name']; ?></span>
</a> </a>
<a href="<?php echo $nav_link; ?>" class="uimob500-hide uimob340-hide uimob800-hide" <a href="<?php echo $nav_link; ?>" class="uimob800-hide uimob500-hide uimob340-hide"
title="<?php echo esc_attr( $tab['name'] ); ?>" original-title="<?php echo esc_attr( $tab['name'] ); ?>"> title="<?php echo esc_attr( $tab['name'] ); ?>">
<i class="<?php echo $tab['icon']; ?>"></i> <i class="<?php echo $tab['icon']; ?>"></i>
<?php if ( isset( $tab['notifier'] ) && $tab['notifier'] > 0 ) { ?> <?php if ( isset( $tab['notifier'] ) && $tab['notifier'] > 0 ) { ?>
<span class="um-tab-notifier uimob500-show uimob340-show uimob800-show"><?php echo $tab['notifier']; ?></span> <span class="um-tab-notifier uimob800-show uimob500-show uimob340-show"><?php echo $tab['notifier']; ?></span>
<?php } ?> <?php } ?>
<span class="uimob500-hide uimob340-hide uimob800-hide title"><?php echo $tab['name']; ?></span> <span class="title"><?php echo $tab['name']; ?></span>
</a> </a>
<?php } else { ?> <?php } else { ?>
<a href="<?php echo $nav_link; ?>" title="<?php echo esc_attr( $tab['name'] ); ?>" <a href="<?php echo $nav_link; ?>" class="uimob800-show uimob500-show uimob340-show um-tip-n"
original-title="<?php echo esc_attr( $tab['name'] ); ?>"> title="<?php echo esc_attr( $tab['name'] ); ?>" original-title="<?php echo esc_attr( $tab['name'] ); ?>">
<i class="<?php echo $tab['icon']; ?>"></i>
<?php if ( isset( $tab['notifier'] ) && $tab['notifier'] > 0 ) { ?>
<span class="um-tab-notifier uimob800-show uimob500-show uimob340-show"><?php echo $tab['notifier']; ?></span>
<?php } ?>
</a>
<a href="<?php echo $nav_link; ?>" class="uimob800-hide uimob500-hide uimob340-hide"
title="<?php echo esc_attr( $tab['name'] ); ?>">
<?php if ( isset( $tab['notifier'] ) && $tab['notifier'] > 0) { ?> <?php if ( isset( $tab['notifier'] ) && $tab['notifier'] > 0) { ?>
<span class="um-tab-notifier uimob500-show uimob340-show uimob800-show"><?php echo $tab['notifier']; ?></span> <span class="um-tab-notifier uimob800-show uimob500-show uimob340-show"><?php echo $tab['notifier']; ?></span>
<?php } ?> <?php } ?>
<span class="uimob500-hide uimob340-hide uimob800-hide title"><?php echo $tab['name']; ?></span> <span class="title"><?php echo $tab['name']; ?></span>
</a> </a>
<?php } ?> <?php } ?>
</div> </div>
+45 -6
View File
@@ -54,8 +54,9 @@ function um_after_insert_user( $user_id, $args ) {
//clear Users cached queue //clear Users cached queue
UM()->user()->remove_cached_queue(); UM()->user()->remove_cached_queue();
um_fetch_user( $user_id );
UM()->user()->set_status( um_user( 'status' ) );
if ( ! empty( $args['submitted'] ) ) { if ( ! empty( $args['submitted'] ) ) {
um_fetch_user( $user_id );
UM()->user()->set_registration_details( $args['submitted'] ); 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 ); 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(); $emails = um_multi_admin_email();
if ( ! empty( $emails ) ) { if ( ! empty( $emails ) ) {
foreach ( $emails as $email ) { 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 ) ); UM()->mail()->send( $email, 'notification_new_user', array( 'admin' => true ) );
} else { } else {
UM()->mail()->send( $email, 'notification_review', array( 'admin' => true ) ); 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 * @param $args
*/ */
function um_check_user_status( $user_id, $args ) { function um_check_user_status( $user_id, $args ) {
$status = um_user( 'status' ); $status = um_user( 'account_status' );
/** /**
* UM hook * UM hook
@@ -368,6 +369,30 @@ function um_submit_form_register( $args ) {
$args['submitted'] = array_merge( $args['submitted'], $credentials ); $args['submitted'] = array_merge( $args['submitted'], $credentials );
$args = array_merge( $args, $credentials ); $args = array_merge( $args, $credentials );
//get user role from global or form's settings
$user_role = UM()->form()->assigned_role( UM()->form()->form_id );
//get user role from field Role dropdown or radio
if ( isset( $args['role'] ) ) {
global $wp_roles;
$um_roles = get_option( 'um_roles' );
if ( ! empty( $um_roles ) ) {
$role_keys = array_map( function( $item ) {
return 'um_' . $item;
}, get_option( 'um_roles' ) );
} else {
$role_keys = array();
}
$exclude_roles = array_diff( array_keys( $wp_roles->roles ), array_merge( $role_keys, array( 'subscriber' ) ) );
//if role is properly set it
if ( ! in_array( $args['role'], $exclude_roles ) ) {
$user_role = $args['role'];
}
}
/** /**
* UM hook * UM hook
* *
@@ -390,7 +415,7 @@ function um_submit_form_register( $args ) {
* } * }
* ?> * ?>
*/ */
$user_role = apply_filters( 'um_registration_user_role', UM()->form()->assigned_role( UM()->form()->form_id ), $args ); $user_role = apply_filters( 'um_registration_user_role', $user_role, $args );
$userdata = array( $userdata = array(
'user_login' => $user_login, 'user_login' => $user_login,
@@ -725,4 +750,18 @@ function um_registration_set_profile_full_name( $user_id, $args ) {
*/ */
do_action( 'um_update_profile_full_name', $user_id, $args ); do_action( 'um_update_profile_full_name', $user_id, $args );
} }
add_action( 'um_registration_set_extra_data', 'um_registration_set_profile_full_name', 10, 2 ); add_action( 'um_registration_set_extra_data', 'um_registration_set_profile_full_name', 10, 2 );
/**
* Redirect from default registration to UM registration page
*/
function um_form_register_redirect() {
$page_id = UM()->options()->get( UM()->options()->get_core_page_id( 'register' ) );
$register_post = get_post( $page_id );
if ( ! empty( $register_post ) ) {
wp_safe_redirect( get_permalink( $page_id ) );
exit();
}
}
add_action( 'login_form_register', 'um_form_register_redirect', 10 );
+62 -10
View File
@@ -367,18 +367,70 @@ add_filter( 'um_get_form_fields', 'um_get_form_fields', 99 );
*/ */
function um_get_custom_field_array( $array, $fields ) { function um_get_custom_field_array( $array, $fields ) {
if ( isset( $array['conditions'] ) ) { if ( ! empty( $array['conditions'] ) ) {
for ( $a = 0; $a < count( $array['conditions'] ); $a++ ) { foreach ( $array['conditions'] as $key => $value ) {
if ( isset( $array['conditional_value'] ) || isset( $array['conditional_value' . $a] ) ) { $condition_metakey = $fields[ $value[1] ]['metakey'];
foreach ( $array['conditions'] as $key => $value ) { if ( isset( $_POST[ $condition_metakey ] ) ) {
$condition_metakey = $fields[ $value[1] ]['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 ] ) ) { if ( $visibility == 'hide' ) {
$cond_value = ( $fields[ $value[1] ]['type'] == 'radio' ) ? $_POST[ $condition_metakey ][0] : $_POST[ $condition_metakey ]; if ( $op == 'empty' ) {
if ( empty( $cond_value ) ) {
if ( isset( $array['conditional_value'] ) && $cond_value !== $array['conditional_value'] ) {
$array['required'] = 0; $array['required'] = 0;
} elseif ( isset( $array['conditional_value'.$a] ) && $cond_value !== $array['conditional_value'.$a] ) { }
} elseif ( $op == 'not empty' ) {
if ( ! empty( $cond_value ) ) {
$array['required'] = 0;
}
} elseif ( $op == 'equals to' ) {
if ( $cond_value == $parent_value ) {
$array['required'] = 0;
}
} elseif ( $op == 'not equals' ) {
if ( $cond_value != $parent_value ) {
$array['required'] = 0;
}
} elseif ( $op == 'greater than' ) {
if ( $cond_value > $parent_value ) {
$array['required'] = 0;
}
} elseif ( $op == 'less than' ) {
if ( $cond_value < $parent_value ) {
$array['required'] = 0;
}
} elseif ( $op == 'contains' ) {
if ( strstr( $cond_value, $parent_value ) ) {
$array['required'] = 0;
}
}
} elseif ( $visibility == 'show' ) {
if ( $op == 'empty' ) {
if ( ! empty( $cond_value ) ) {
$array['required'] = 0;
}
} elseif ( $op == 'not empty' ) {
if ( empty( $cond_value ) ) {
$array['required'] = 0;
}
} elseif ( $op == 'equals to' ) {
if ( $cond_value != $parent_value ) {
$array['required'] = 0;
}
} elseif ( $op == 'not equals' ) {
if ( $cond_value == $parent_value ) {
$array['required'] = 0;
}
} elseif ( $op == 'greater than' ) {
if ( $cond_value <= $parent_value ) {
$array['required'] = 0;
}
} elseif ( $op == 'less than' ) {
if ( $cond_value >= $parent_value ) {
$array['required'] = 0;
}
} elseif ( $op == 'contains' ) {
if ( ! strstr( $cond_value, $parent_value ) ) {
$array['required'] = 0; $array['required'] = 0;
} }
} }
+1 -1
View File
@@ -211,7 +211,7 @@ function um_add_search_to_query( $query_args, $args ){
*/ */
$query_args = apply_filters( 'um_query_args_filter', $query_args ); $query_args = apply_filters( 'um_query_args_filter', $query_args );
if ( count( $query_args['meta_query'] ) == 1 ) if ( isset( $query_args['meta_query'] ) && count( $query_args['meta_query'] ) == 1 )
unset( $query_args['meta_query'] ); unset( $query_args['meta_query'] );
return $query_args; return $query_args;
+3 -2
View File
@@ -55,7 +55,8 @@ if ( ! class_exists( 'UM_Menu_Item_Custom_Fields_Editor' ) ) {
// Sanitize // Sanitize
if ( ! empty( $_POST[ $key ][ $menu_item_db_id ] ) ) { if ( ! empty( $_POST[ $key ][ $menu_item_db_id ] ) ) {
// Do some checks here... // 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 { } else {
$value = null; $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 . '" '; $id_attr = ' id="edit-menu-item-um_nav_roles-{{data.menuItemID}}_' . $k . '" ';
$for_attr = ' for="edit-menu-item-um_nav_roles-{{data.menuItemID}}_' . $k . '" '; $for_attr = ' for="edit-menu-item-um_nav_roles-{{data.menuItemID}}_' . $k . '" ';
$html .= "<label $for_attr> $html .= "<label $for_attr>
<input type='checkbox' {$id_attr} name='menu-item-um_nav_roles[{{data.menuItemID}}][]' value='{$k}' <# if( _.contains( data.restriction_data.um_nav_roles,'{$k}' ) ){ #>checked='checked'<# } #> /> <input type='checkbox' {$id_attr} name='menu-item-um_nav_roles[{{data.menuItemID}}][{$k}]' value='1' <# if( _.contains( data.restriction_data.um_nav_roles,'{$k}' ) ){ #>checked='checked'<# } #> />
<span>{$title}</span> <span>{$title}</span>
</label>"; </label>";
} }
+37 -23
View File
@@ -508,10 +508,11 @@ function um_user_submitted_registration( $style = false ) {
$data = um_user( 'submitted' ); $data = um_user( 'submitted' );
if ($style) if ( $style ) {
$output .= '<div class="um-admin-infobox">'; $output .= '<div class="um-admin-infobox">';
}
if (isset( $data ) && is_array( $data )) { if ( isset( $data ) && is_array( $data ) ) {
/** /**
* UM hook * UM hook
@@ -535,38 +536,51 @@ function um_user_submitted_registration( $style = false ) {
*/ */
$data = apply_filters( 'um_email_registration_data', $data ); $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 ); $file = basename( $v );
$v = um_user_uploads_uri() . $file; $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 (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 .= "<p><label>$k</label><span>$v</span></p>";
} else {
$output .= "$k: $v" . "<br />";
}
} }
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 .= "<p><label>$k</label><span>$v</span></p>";
} else {
$output .= "$k: $v" . "<br />";
}
} }
} }
if ($style) if ( $style ) {
$output .= '</div>'; $output .= '</div>';
}
return $output; return $output;
} }
+42 -1
View File
@@ -6,7 +6,7 @@ Donate link:
Tags: community, member, membership, user-profile, user-registration Tags: community, member, membership, user-profile, user-registration
Requires at least: 4.1 Requires at least: 4.1
Tested up to: 4.9 Tested up to: 4.9
Stable tag: 2.0.13 Stable tag: 2.0.17
License: GNU Version 2 or Any Later Version License: GNU Version 2 or Any Later Version
License URI: http://www.gnu.org/licenses/gpl-3.0.txt License URI: http://www.gnu.org/licenses/gpl-3.0.txt
@@ -131,6 +131,47 @@ The plugin works with popular caching plugins by automatically excluding Ultimat
= Important: UM2.0+ is a significant update to the code base from 1.3.88. Please make sure you take a full-site backup with restore point before updating the plugin = = Important: UM2.0+ is a significant update to the code base from 1.3.88. Please make sure you take a full-site backup with restore point before updating the plugin =
= 2.0.17: May 30, 2018 =
* Enhancements:
- Added UM dashboard widget for getting latest extension's upgrades
* Bugfixes:
- Fixed User Profile restriction when the user isn't logged in
- Fixed Profile Tabs displaying on desktop/mobile
- Fixed set user status after registration on some installs
- Fixed PHP memory limit issue on some installs with small PHP memory limit
- Fixed PHP validation on submit UM Forms with conditional fields logic
= 2.0.16: May 23, 2018 =
* Bugfixes:
- Fixed Profile Tabs issues
= 2.0.15: May 22, 2018 =
* Bugfixes:
- Fixed GDPR min.js script
= 2.0.14: May 22, 2018 =
* Enhancements:
- Added support for GDPR Personal Data Exporter
- Added support for GDPR Personal Data Eraser
- Added new privacy field to form builder for GDPR consent collection
- Added GDPR privacy policy guide text
- Added GDPR compatibility on delete user process
- Added security to Restricted posts comments
- Added security to custom field type `Password`
- Deprecated time checking spam bot
* Bugfixes:
- Fixed settings tabs for PHP7.1
- Fixed issues with Profile Tabs
- Fixed User Avatars
- Fixed set user status on Registration process
- Fixed Account Privacy tab content
= 2.0.13: May 2, 2018 = = 2.0.13: May 2, 2018 =
* Bugfixes: * Bugfixes:
+44
View File
@@ -0,0 +1,44 @@
<?php ?>
<!-- This file should primarily consist of HTML with a little bit of PHP. -->
<div class="um-field um-field-type_terms_conditions" data-key="use_terms_conditions_agreement" style="display:block;padding:0;">
<div class="um-field-area">
<div class='um-gdpr-content' style="display:none;">
<?php if ( ! empty( $args['use_gdpr_content_id'] ) ) {
$um_content_query = get_post( $args['use_gdpr_content_id'] );
if ( isset( $um_content_query ) ) {
echo apply_filters( 'um_gdpr_policies_page_content', $um_content_query->post_content, $args );
}
} ?>
</div>
<a href="javascript:;" class="um-toggle-gdpr" data-toggle-state="hidden"
data-toggle-show="<?php echo ! empty( $args['use_gdpr_toggle_show'] ) ? $args['use_gdpr_toggle_show'] : __( 'Show privacy policy', 'ultimate-member' ); ?>"
data-toggle-hide="<?php echo ! empty( $args['use_gdpr_toggle_hide'] ) ? $args['use_gdpr_toggle_hide'] : __( 'Hide privacy policy', 'ultimate-member' ); ?>">
<?php echo ! empty( $args['use_gdpr_toggle_show'] ) ? $args['use_gdpr_toggle_show'] : __( 'Show privacy policy', 'ultimate-member' ); ?>
</a>
</div>
<div class="um-field-area">
<label class="um-field-checkbox">
<input type="checkbox" name="use_gdpr_agreement" value="1">
<span class="um-field-checkbox-state">
<i class="um-icon-android-checkbox-outline-blank"></i>
</span>
<span class="um-field-checkbox-option">
<?php echo ! empty( $args['use_gdpr_agreement'] ) ? $args['use_gdpr_agreement'] : __( 'Please confirm that you agree to our privacy policy', 'ultimate-member' ); ?>
</span>
</label>
<div class="um-clear"></div>
<?php $errors = UM()->form()->errors;
if ( isset( $errors['use_gdpr_agreement'] ) ) {
$error_message = ! empty( $args['use_gdpr_error_text'] ) ? $args['use_gdpr_error_text'] : __( 'Please confirm your acceptance of our privacy policy', 'ultimate-member' );
echo '<p class="um-notice err"><i class="um-icon-ios-close-empty" onclick="jQuery(this).parent().fadeOut();"></i>' . $error_message . '</p><br/>';
} ?>
<div class="um-clear"></div>
</div>
</div>
+1 -1
View File
@@ -3,7 +3,7 @@
Plugin Name: Ultimate Member Plugin Name: Ultimate Member
Plugin URI: http://ultimatemember.com/ Plugin URI: http://ultimatemember.com/
Description: The easiest way to create powerful online communities and beautiful user profiles with WordPress Description: The easiest way to create powerful online communities and beautiful user profiles with WordPress
Version: 2.0.13 Version: 2.0.17
Author: Ultimate Member Author: Ultimate Member
Author URI: http://ultimatemember.com/ Author URI: http://ultimatemember.com/
Text Domain: ultimate-member Text Domain: ultimate-member