Merge branch 'development/2.8.x' into feature/search_exclude_fields

This commit is contained in:
Mykyta Synelnikov
2024-04-09 01:09:13 +03:00
committed by GitHub
101 changed files with 11230 additions and 8921 deletions
+100 -34
View File
@@ -1,6 +1,8 @@
<?php
namespace um\admin;
use WP_Query;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
@@ -69,6 +71,7 @@ if ( ! class_exists( 'um\admin\Admin' ) ) {
add_action( 'um_admin_do_action__check_templates_version', array( &$this, 'check_templates_version' ) );
add_action( 'um_admin_do_action__install_core_pages', array( &$this, 'install_core_pages' ) );
add_action( 'um_admin_do_action__install_predefined_page', array( &$this, 'install_predefined_page' ) );
add_action( 'parent_file', array( &$this, 'parent_file' ), 9 );
add_filter( 'gettext', array( &$this, 'gettext' ), 10, 4 );
@@ -1617,33 +1620,108 @@ if ( ! class_exists( 'um\admin\Admin' ) ) {
public function install_core_pages() {
UM()->setup()->install_default_pages();
//check empty pages in settings
$empty_pages = array();
$pages = UM()->config()->permalinks;
if ( $pages && is_array( $pages ) ) {
foreach ( $pages as $slug => $page_id ) {
$page = get_post( $page_id );
if ( ! isset( $page->ID ) && array_key_exists( $slug, UM()->config()->core_pages ) ) {
$empty_pages[] = $slug;
}
}
}
//if there aren't empty pages - then hide pages notice
if ( empty( $empty_pages ) ) {
$hidden_notices = get_option( 'um_hidden_admin_notices', array() );
$hidden_notices[] = 'wrong_pages';
update_option( 'um_hidden_admin_notices', $hidden_notices );
}
// Auto dismiss 'wrong_pages' notice if it's visible
$this->dismiss_wrong_pages();
$url = add_query_arg( array( 'page' => 'um_options' ), admin_url( 'admin.php' ) );
wp_safe_redirect( $url );
exit;
}
/**
* Install predefined page based on $_REQUEST['um_page_slug'] argument.
*/
public function install_predefined_page() {
if ( ! current_user_can( 'manage_options' ) ) {
$url = add_query_arg( array( 'page' => 'um_options' ), admin_url( 'admin.php' ) );
wp_safe_redirect( $url );
exit;
}
$predefined_pages = array_keys( UM()->config()->get( 'predefined_pages' ) );
// phpcs:ignore WordPress.Security.NonceVerification -- early nonce verification based on `um_adm_action`
$page_slug = array_key_exists( 'um_page_slug', $_REQUEST ) ? sanitize_key( $_REQUEST['um_page_slug'] ) : '';
if ( empty( $page_slug ) || ! in_array( $page_slug, $predefined_pages, true ) ) {
$url = add_query_arg( array( 'page' => 'um_options' ), admin_url( 'admin.php' ) );
wp_safe_redirect( $url );
exit;
}
$post_ids = new WP_Query(
array(
'post_type' => 'page',
'meta_query' => array(
array(
'key' => '_um_core',
'value' => $page_slug,
),
),
'posts_per_page' => -1,
'fields' => 'ids',
)
);
$post_ids = $post_ids->get_posts();
if ( ! empty( $post_ids ) ) {
foreach ( $post_ids as $post_id ) {
delete_post_meta( $post_id, '_um_core' );
}
}
UM()->setup()->predefined_page( $page_slug );
// Auto dismiss 'wrong_pages' notice if it's visible
$this->dismiss_wrong_pages();
$url = add_query_arg(
array(
'page' => 'um_options',
'update' => 'um_settings_updated',
),
admin_url( 'admin.php' )
);
wp_safe_redirect( $url );
exit;
}
/**
* Dismiss 'wrong_pages' notice if it's visible.
*/
public function dismiss_wrong_pages() {
// Check empty pages in settings.
$empty_pages = array();
$predefined_pages = array_keys( UM()->config()->get( 'predefined_pages' ) );
foreach ( $predefined_pages as $slug ) {
$page_id = um_get_predefined_page_id( $slug );
if ( ! $page_id ) {
$empty_pages[] = $slug;
continue;
}
$page = get_post( $page_id );
if ( ! $page ) {
$empty_pages[] = $slug;
continue;
}
}
// If there aren't empty pages - then hide pages notice
if ( empty( $empty_pages ) ) {
$hidden_notices = get_option( 'um_hidden_admin_notices', array() );
if ( ! is_array( $hidden_notices ) ) {
$hidden_notices = array();
}
$hidden_notices[] = 'wrong_pages';
update_option( 'um_hidden_admin_notices', $hidden_notices );
}
}
/**
* Clear all users cache.
*/
@@ -1826,19 +1904,7 @@ if ( ! class_exists( 'um\admin\Admin' ) ) {
* Manual check templates versions.
*/
public function check_templates_version() {
$templates = UM()->admin_settings()->get_override_templates( true );
$out_date = false;
foreach ( $templates as $template ) {
if ( 0 === $template['status_code'] ) {
$out_date = true;
break;
}
}
if ( false === $out_date ) {
delete_option( 'um_override_templates_outdated' );
}
UM()->common()->theme()->flush_transient_templates_data();
$url = add_query_arg(
array(
+18 -10
View File
@@ -95,16 +95,17 @@ final class Enqueue extends \um\common\Enqueue {
* @since 2.6.1
*/
public function block_editor() {
$suffix = self::get_suffix();
$js_url = self::get_url( 'js' );
$css_url = self::get_url( 'css' );
$suffix = self::get_suffix();
$js_url = self::get_url( 'js' );
$css_url = self::get_url( 'css' );
$libs_url = self::get_url( 'libs' );
$this->load_gutenberg_js();
wp_register_script( 'um_admin_blocks_shortcodes', $js_url . 'admin/block-renderer' . $suffix . '.js', array( 'wp-i18n', 'wp-blocks', 'wp-components' ), UM_VERSION, true );
wp_set_script_translations( 'um_admin_blocks_shortcodes', 'ultimate-member' );
$notifications_enabled = 0;
$notifications_enabled = false;
if ( false !== UM()->account()->is_notifications_tab_visible() ) {
$notifications_enabled = UM()->options()->get( 'account_tab_notifications' );
}
@@ -112,7 +113,7 @@ final class Enqueue extends \um\common\Enqueue {
$um_account_settings = array(
'general' => array(
'label' => __( 'General', 'ultimate-member' ),
'enabled' => 1,
'enabled' => true,
),
'password' => array(
'label' => __( 'Password', 'ultimate-member' ),
@@ -192,10 +193,14 @@ final class Enqueue extends \um\common\Enqueue {
wp_register_style( 'um_styles', $css_url . 'um-styles' . $suffix . '.css', array( 'um_ui', 'um_tipsy', 'um_raty', 'um_fonticons_ii', 'um_fonticons_fa', 'select2' ), UM_VERSION );
wp_register_style( 'um_profile', $css_url . 'um-profile' . $suffix . '.css', array(), UM_VERSION );
wp_register_style( 'um_responsive', $css_url . 'um-responsive' . $suffix . '.css', array( 'um_profile', 'um_crop' ), UM_VERSION );
wp_register_style( 'um_responsive', $css_url . 'um-responsive' . $suffix . '.css', array( 'um_profile' ), UM_VERSION );
wp_register_style( 'um_account', $css_url . 'um-account' . $suffix . '.css', array(), UM_VERSION );
wp_register_style( 'um_default_css', $css_url . 'um-old-default' . $suffix . '.css', array(), UM_VERSION );
wp_register_style( 'um_datetime', $libs_url . 'pickadate/default' . $suffix . '.css', array(), '3.6.2' );
wp_register_style( 'um_datetime_date', $libs_url . 'pickadate/default.date' . $suffix . '.css', array( 'um_datetime' ), '3.6.2' );
wp_register_style( 'um_datetime_time', $libs_url . 'pickadate/default.time' . $suffix . '.css', array( 'um_datetime' ), '3.6.2' );
wp_enqueue_style( 'um_default_css' );
wp_enqueue_style( 'um_members' );
wp_enqueue_style( 'um_styles' );
@@ -203,6 +208,9 @@ final class Enqueue extends \um\common\Enqueue {
wp_enqueue_style( 'um_responsive' );
wp_enqueue_style( 'um_account' );
wp_enqueue_style( 'um_datetime_date' );
wp_enqueue_style( 'um_datetime_time' );
$custom_css = '.wp-block .um{opacity: 1;}.um_request_name {display: none !important;}';
wp_add_inline_style( 'um_styles', $custom_css );
@@ -584,10 +592,10 @@ final class Enqueue extends \um\common\Enqueue {
wp_enqueue_style( 'um_admin_roles' );
} elseif ( 'ultimate-member_page_um_options' === $hook ) {
// phpcs:ignore WordPress.Security.NonceVerification
if ( isset( $_GET['tab'], $_GET['section'] ) && 'advanced' === $_GET['tab'] && 'secure' === $_GET['section'] ) {
wp_register_script( 'um_admin_secure', $js_url . 'admin/secure' . $suffix . '.js', array( 'jquery', 'wp-i18n' ), UM_VERSION, true );
wp_set_script_translations( 'um_admin_secure', 'ultimate-member' );
wp_enqueue_script( 'um_admin_secure' );
if ( isset( $_GET['tab'], $_GET['section'] ) && 'advanced' === $_GET['tab'] && 'security' === $_GET['section'] ) {
wp_register_script( 'um_admin_security', $js_url . 'admin/security' . $suffix . '.js', array( 'jquery', 'wp-i18n' ), UM_VERSION, true );
wp_set_script_translations( 'um_admin_security', 'ultimate-member' );
wp_enqueue_script( 'um_admin_security' );
}
// phpcs:ignore WordPress.Security.NonceVerification
+11 -10
View File
@@ -90,11 +90,6 @@ if ( ! class_exists( 'um\admin\Secure' ) ) {
*/
public function admin_init() {
global $wpdb;
// Dismiss admin notice after the first visit to Secure settings page.
if ( isset( $_REQUEST['page'], $_REQUEST['tab'], $_REQUEST['section'] ) && 'um_options' === sanitize_key( $_REQUEST['page'] ) && 'advanced' === sanitize_key( $_REQUEST['tab'] ) && 'secure' === sanitize_key( $_REQUEST['section'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification
UM()->admin()->notices()->dismiss( 'secure_settings' );
}
if ( isset( $_REQUEST['um_secure_expire_all_sessions'] ) && ! wp_doing_ajax() ) {
if ( ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'um-secure-expire-session-nonce' ) || ! current_user_can( 'manage_options' ) ) {
// This nonce is not valid or current logged-in user has no administrative rights.
@@ -300,10 +295,16 @@ if ( ! class_exists( 'um\admin\Secure' ) ) {
)
);
$settings['advanced']['sections']['secure'] = array(
'title' => __( 'Secure', 'ultimate-member' ),
'description' => __( 'This feature scans for suspicious registered accounts, bans the usage of administrative capabilities to site subscribers/members, allows the website administrators to force all users to reset their passwords, preventing users from logging-in using their old passwords that may have been exposed.', 'ultimate-member' ),
'fields' => $secure_fields,
$settings['advanced']['sections'] = UM()->array_insert_before(
$settings['advanced']['sections'],
'developers',
array(
'security' => array(
'title' => __( 'Security', 'ultimate-member' ),
'description' => __( 'This feature scans for suspicious registered accounts, bans the usage of administrative capabilities to site subscribers/members, allows the website administrators to force all users to reset their passwords, preventing users from logging-in using their old passwords that may have been exposed.', 'ultimate-member' ),
'fields' => $secure_fields,
),
)
);
return $settings;
@@ -330,7 +331,7 @@ if ( ! class_exists( 'um\admin\Secure' ) ) {
$val .= '<div><small>' . esc_html__( 'Blocked Due to Suspicious Activity', 'ultimate-member' ) . '</small></div>';
$nonce = wp_create_nonce( 'um-security-restore-account-nonce-' . $user_id );
$restore_account_url = admin_url( 'users.php?user_id=' . $user_id . '&um_secure_restore_account=1&_wpnonce=' . $nonce );
$action = ' &#183; <a href=" ' . esc_attr( $restore_account_url ) . ' " onclick=\'return confirm("' . esc_js( __( 'Are you sure that you want to restore this account after getting flagged for suspicious activity?', 'ultimate-member' ) ) . '");\'><small>' . esc_html__( 'Restore Account', 'ultimate-member' ) . '</small></a>';
$action = ' &#183; <a href=" ' . esc_url( $restore_account_url ) . ' " onclick=\'return confirm("' . esc_js( __( 'Are you sure that you want to restore this account after getting flagged for suspicious activity?', 'ultimate-member' ) ) . '");\'><small>' . esc_html__( 'Restore Account', 'ultimate-member' ) . '</small></a>';
if ( ! empty( $datetime ) ) {
$val .= '<div><small>' . human_time_diff( strtotime( $datetime ) ) . ' ' . __( 'ago', 'ultimate-member' ) . '</small>' . $action . '</div>';
}
+65 -7
View File
@@ -12,11 +12,69 @@ if ( ! defined( 'ABSPATH' ) ) {
*/
class Site_Health {
/**
* String of a badge color.
* Options: blue, green, red, orange, purple and gray.
*
* @see https://make.wordpress.org/core/2019/04/25/site-health-check-in-5-2/
*
* @since 2.8.3
*/
const BADGE_COLOR = 'blue';
/**
* Site_Health constructor.
*/
public function __construct() {
add_filter( 'debug_information', array( $this, 'debug_information' ), 20 );
add_filter( 'site_status_tests', array( $this, 'register_site_status_tests' ) );
}
public function register_site_status_tests( $tests ) {
$custom_templates = UM()->common()->theme()->get_custom_templates_list();
if ( ! empty( $custom_templates ) ) {
$tests['direct']['um_override_templates'] = array(
'label' => esc_html__( 'Are the Ultimate Member templates out of date?', 'ultimate-member' ),
'test' => array( $this, 'override_templates_test' ),
);
}
return $tests;
}
public function override_templates_test() {
$result = array(
'label' => __( 'You have the most recent version of custom Ultimate Member templates', 'ultimate-member' ),
'status' => 'good',
'badge' => array(
'label' => UM_PLUGIN_NAME,
'color' => self::BADGE_COLOR,
),
'description' => sprintf(
'<p>%s</p>',
__( 'Your custom Ultimate Member templates that are situated in the theme have the most recent version and are ready to use.', 'ultimate-member' )
),
'actions' => '',
'test' => 'um_override_templates',
);
if ( UM()->common()->theme()->is_outdated_template_exist() ) {
$result['label'] = __( 'Your custom templates are out of date', 'ultimate-member' );
$result['status'] = 'critical';
$result['badge']['color'] = 'red';
$result['description'] = sprintf(
'<p>%s</p>',
__( 'Your custom Ultimate Member templates that are situated in the theme are out of date and may break the website\'s functionality.', 'ultimate-member' )
);
$result['actions'] = sprintf(
'<p><a href="%s">%s</a></p>',
admin_url( 'admin.php?page=um_options&tab=advanced&section=override_templates' ),
esc_html__( 'Check status and update', 'ultimate-member' )
);
}
return $result;
}
private function get_roles() {
@@ -107,7 +165,7 @@ class Site_Health {
$pages = array();
$predefined_pages = UM()->config()->core_pages;
foreach ( $predefined_pages as $page_s => $page ) {
$page_id = UM()->options()->get_core_page_id( $page_s );
$page_id = UM()->options()->get_predefined_page_option_key( $page_s );
$page_title = ! empty( $page['title'] ) ? $page['title'] : '';
if ( empty( $page_title ) ) {
continue;
@@ -290,7 +348,7 @@ class Site_Health {
}
$account_settings['um-account_email'] = array(
'label' => __( 'Allow users to change e-mail', 'ultimate-member' ),
'label' => __( 'Allow users to change email', 'ultimate-member' ),
'value' => UM()->options()->get( 'account_email' ) ? $labels['yes'] : $labels['no'],
);
@@ -455,7 +513,7 @@ class Site_Health {
'value' => UM()->options()->get( 'enable_reset_password_limit' ) ? $labels['yes'] : $labels['no'],
),
);
if ( 1 === absint( UM()->options()->get( 'enable_reset_password_limit' ) ) ) {
if ( UM()->options()->get( 'enable_reset_password_limit' ) ) {
$access_other_settings['um-reset_password_limit_number'] = array(
'label' => __( 'Reset Password Limit ', 'ultimate-member' ),
'value' => UM()->options()->get( 'reset_password_limit_number' ),
@@ -485,7 +543,7 @@ class Site_Health {
// Email settings
$email_settings = array(
'um-admin_email' => array(
'label' => __( 'Admin E-mail Address', 'ultimate-member' ),
'label' => __( 'Admin Email Address', 'ultimate-member' ),
'value' => UM()->options()->get( 'admin_email' ),
),
'um-mail_from' => array(
@@ -497,7 +555,7 @@ class Site_Health {
'value' => UM()->options()->get( 'mail_from_addr' ),
),
'um-email_html' => array(
'label' => __( 'Use HTML for E-mails?', 'ultimate-member' ),
'label' => __( 'Use HTML for Emails?', 'ultimate-member' ),
'value' => UM()->options()->get( 'email_html' ) ? $labels['yes'] : $labels['no'],
),
);
@@ -1362,7 +1420,7 @@ class Site_Health {
$info[ 'ultimate-member-' . $key ]['fields'],
array(
'um-url_email_activate' => array(
'label' => __( 'URL redirect after e-mail activation', 'ultimate-member' ),
'label' => __( 'URL redirect after email activation', 'ultimate-member' ),
'value' => $rolemeta['_um_url_email_activate'],
),
)
@@ -1788,7 +1846,7 @@ class Site_Health {
'first_name' => __( 'First Name', 'ultimate-member' ),
'last_name' => __( 'Last Name', 'ultimate-member' ),
'nickname' => __( 'Nickname', 'ultimate-member' ),
'secondary_user_email' => __( 'Secondary E-mail Address', 'ultimate-member' ),
'secondary_user_email' => __( 'Secondary Email Address', 'ultimate-member' ),
'description' => __( 'Biography', 'ultimate-member' ),
'phone_number' => __( 'Phone Number', 'ultimate-member' ),
'mobile_number' => __( 'Mobile Number', 'ultimate-member' ),
+1 -1
View File
@@ -244,7 +244,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Columns' ) ) {
public function add_display_post_states( $post_states, $post ) {
foreach ( UM()->config()->core_pages as $page_key => $page_value ) {
$page_id = UM()->options()->get( UM()->options()->get_core_page_id( $page_key ) );
$page_id = UM()->options()->get( UM()->options()->get_predefined_page_option_key( $page_key ) );
if ( $page_id == $post->ID ) {
$post_states[ 'um_core_page_' . $page_key ] = sprintf( 'UM %s', $page_value['title'] );
+20 -1
View File
@@ -1159,7 +1159,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) {
$button = '';
$slug = str_replace( 'core_', '', $field_data['id'] );
if ( ! um_get_predefined_page_id( $slug ) || 'publish' !== get_post_status( um_get_predefined_page_id( $slug ) ) ) {
$button = '&nbsp;<a href="' . esc_url( add_query_arg( array( 'um_adm_action' => 'install_predefined_page', 'um_page_slug' => $slug ) ) ) . '" class="button button-primary">' . esc_html__( 'Create Default', 'ultimate-member' ) . '</a>';
$button = '&nbsp;<a href="' . esc_url( add_query_arg( array( 'um_adm_action' => 'install_predefined_page', 'um_page_slug' => $slug, '_wpnonce' => wp_create_nonce( 'install_predefined_page' ), ) ) ) . '" class="button button-primary">' . esc_html__( 'Create Default', 'ultimate-member' ) . '</a>';
}
$html = "$hidden<select $multiple $id_attr $name_attr $class_attr $data_attr>$options</select>$button";
@@ -1852,5 +1852,24 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) {
return $value;
}
public function render_external_link( $data ) {
$defaults = array(
'url' => '',
'html' => '',
);
$data = wp_parse_args( $data, $defaults );
if ( empty( $data['url'] ) || empty( $data['html'] ) ) {
return '';
}
ob_start();
?>
<a target="_blank" href="<?php echo esc_url( $data['url'] ); ?>">
<?php echo esc_html( $data['html'] ); ?>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" class="um-external-link-icon" aria-hidden="true" focusable="false"><path d="M19.5 4.5h-7V6h4.44l-5.97 5.97 1.06 1.06L18 7.06v4.44h1.5v-7Zm-13 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-3H17v3a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h3V5.5h-3Z"></path></svg>
</a>
<?php
return ob_get_clean();
}
}
}
+1 -1
View File
@@ -1496,7 +1496,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
break;
case '_validate':
if ( array_key_exists( 'mode', $form_data ) && 'login' === $form_data['mode'] && in_array( $field_args['metakey'], array( 'username', 'user_login', 'user_email' ), true ) ) {
if ( array_key_exists( 'mode', $form_data ) && 'login' === $form_data['mode'] && array_key_exists( 'metakey', $field_args ) && in_array( $field_args['metakey'], array( 'username', 'user_login', 'user_email' ), true ) ) {
return;
}
?>
+20 -80
View File
@@ -31,8 +31,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
add_action( 'wp_ajax_um_dismiss_notice', array( &$this, 'dismiss_notice' ) );
add_action( 'admin_init', array( &$this, 'force_dismiss_notice' ) );
add_action( 'current_screen', array( &$this, 'create_list_for_screen' ) );
}
/**
@@ -51,8 +49,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
$this->extensions_page();
$this->template_version();
$this->child_theme_required();
// Removed for now to avoid the bad reviews.
@@ -82,13 +78,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
do_action( 'um_admin_create_notices' );
}
public function create_list_for_screen() {
if ( UM()->admin()->screen()->is_own_screen() ) {
$this->secure_settings();
}
}
/**
* @return array
*/
@@ -587,9 +576,8 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
}
}
function check_wrong_licenses() {
$invalid_license = 0;
public function check_wrong_licenses() {
$invalid_license = 0;
$arr_inactive_license_keys = array();
if ( empty( UM()->admin_settings()->settings_structure['licenses']['fields'] ) ) {
@@ -599,10 +587,11 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
foreach ( UM()->admin_settings()->settings_structure['licenses']['fields'] as $field_data ) {
$license = get_option( "{$field_data['id']}_edd_answer" );
if ( ( is_object( $license ) && 'valid' == $license->license ) || 'valid' == $license )
if ( ( is_object( $license ) && isset( $license->license ) && 'valid' === $license->license ) || 'valid' === $license ) {
continue;
}
if ( ( is_object( $license ) && 'inactive' == $license->license ) || 'inactive' == $license ) {
if ( ( is_object( $license ) && isset( $license->license ) && 'inactive' === $license->license ) || 'inactive' === $license ) {
$arr_inactive_license_keys[] = $license->item_name;
}
@@ -614,7 +603,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
'license_key',
array(
'class' => 'error',
// translators: %1$s is a inactive license number; %2$s is a plugin name; %3$s is a store link.
// translators: %1$s is an inactive license number; %2$s is a plugin name; %3$s is a store link.
'message' => '<p>' . sprintf( __( 'There are %1$s inactive %2$s license keys for this site. This site is not authorized to get plugin updates. You can active this site on <a href="%3$s">www.ultimatemember.com</a>.', 'ultimate-member' ), count( $arr_inactive_license_keys ), UM_PLUGIN_NAME, UM()->store_url ) . '</p>',
),
3
@@ -622,12 +611,20 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
}
if ( $invalid_license ) {
$licenses_page_url = add_query_arg(
array(
'page' => 'um_options',
'tab' => 'licenses',
),
admin_url( 'admin.php' )
);
$this->add_notice(
'license_key',
array(
'class' => 'error',
// translators: %1$s is a invalid license; %2$s is a plugin name; %3$s is a license link.
'message' => '<p>' . sprintf( __( 'You have %1$s invalid or expired license keys for %2$s. Please go to the <a href="%3$s">Licenses page</a> to correct this issue.', 'ultimate-member' ), $invalid_license, UM_PLUGIN_NAME, add_query_arg( array( 'page' => 'um_options', 'tab' => 'licenses' ), admin_url( 'admin.php' ) ) ) . '</p>',
// translators: %1$s is an invalid license; %2$s is a plugin name; %3$s is a license link.
'message' => '<p>' . sprintf( __( 'You have %1$s invalid or expired license keys for %2$s. Please go to the <a href="%3$s">Licenses page</a> to correct this issue.', 'ultimate-member' ), $invalid_license, UM_PLUGIN_NAME, $licenses_page_url ) . '</p>',
),
3
);
@@ -775,36 +772,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
), 2 );
}
/**
* Check Templates Versions notice
*/
public function template_version() {
if ( true === (bool) get_option( 'um_override_templates_outdated' ) ) {
$link = admin_url( 'admin.php?page=um_options&tab=advanced&section=override_templates' );
ob_start();
?>
<p>
<?php
// translators: %s override templates page link.
echo wp_kses( sprintf( __( 'Your templates are out of date. Please visit <a href="%s">override templates status page</a> and update templates.', 'ultimate-member' ), $link ), UM()->get_allowed_html( 'admin_notice' ) );
?>
</p>
<?php
$message = ob_get_clean();
UM()->admin()->notices()->add_notice(
'um_override_templates_notice',
array(
'class' => 'error',
'message' => $message,
'dismissible' => false,
),
10
);
}
}
/**
* Check if there isn't installed child-theme. Child theme is required for safely saved customizations.
*/
@@ -820,7 +787,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
<p>
<?php
// translators: %s child-theme article link.
echo wp_kses( sprintf( __( 'We highly recommend using a <a href="%s">child-theme</a> for Ultimate Member customization, which hasn\'t dependencies with the official themes repo, so your custom files cannot be rewritten after a theme upgrade.<br />Otherwise, the customization files may be deleted after every theme upgrade.', 'ultimate-member' ), 'https://developer.wordpress.org/themes/advanced-topics/child-themes/' ), UM()->get_allowed_html( 'admin_notice' ) );
echo wp_kses( sprintf( __( 'We recommend using a <a href="%s">child-theme</a> for Ultimate Member customization. Unlike official theme repositories, child themes don\'t have dependencies that could lead to your custom files being overwritten during a theme upgrade.<br />Without a child theme, your customization files may be deleted after every theme update.', 'ultimate-member' ), 'https://developer.wordpress.org/themes/advanced-topics/child-themes/' ), UM()->get_allowed_html( 'admin_notice' ) );
?>
</p>
@@ -838,39 +805,12 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
}
}
/**
* First time installed Secure settings.
*/
public function secure_settings() {
ob_start();
?>
<p>
<strong><?php esc_html_e( 'Important Update', 'ultimate-member' ); ?></strong><br/>
<?php esc_html_e( 'Ultimate Member has a new additional feature to secure your Ultimate Member forms to prevent attacks from injecting accounts with administrative roles &amp; capabilities.', 'ultimate-member' ); ?>
</p>
<p>
<a class="button button-primary" href="<?php echo esc_attr( admin_url( 'admin.php?page=um_options&tab=advanced&section=secure&um_dismiss_notice=secure_settings&um_admin_nonce=' . wp_create_nonce( 'um-admin-nonce' ) ) ); ?>"><?php esc_html_e( 'Manage Security Settings', 'ultimate-member' ); ?></a>
<a class="button" target="_blank" href="https://docs.ultimatemember.com/article/1869-security-feature"><?php esc_html_e( 'Read the documentation', 'ultimate-member' ); ?></a>
</p>
<?php
$message = ob_get_clean();
$this->add_notice(
'secure_settings',
array(
'class' => 'warning',
'message' => $message,
'dismissible' => true,
),
1
);
}
public function common_secure() {
if ( UM()->options()->get( 'lock_register_forms' ) ) {
ob_start();
?>
<p>
<?php esc_html_e( 'Your Register forms are now locked. You can unlock them in Ultimate Member > Settings > Secure > Lock All Register Forms.', 'ultimate-member' ); ?>
<?php esc_html_e( 'Your Register forms are now locked. You can unlock them in Ultimate Member > Settings > Advanced > Security > Lock All Register Forms.', 'ultimate-member' ); ?>
</p>
<?php
$message = ob_get_clean();
@@ -889,7 +829,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
ob_start();
?>
<p>
<?php esc_html_e( 'Mandatory password changes has been enabled. You can disable them in Ultimate Member > Settings > Secure > Display Login form notice to reset passwords.', 'ultimate-member' ); ?>
<?php esc_html_e( 'Mandatory password changes has been enabled. You can disable them in Ultimate Member > Settings > Advanced > Security > Display Login form notice to reset passwords.', 'ultimate-member' ); ?>
</p>
<?php
$message = ob_get_clean();
@@ -908,7 +848,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
ob_start();
?>
<p>
<?php esc_html_e( 'Ban for administrative capabilities is enabled. You can disable them in Ultimate Member > Settings > Secure > Enable ban for administrative capabilities.', 'ultimate-member' ); ?>
<?php esc_html_e( 'Ban for administrative capabilities is enabled. You can disable them in Ultimate Member > Settings > Advanced > Security > Enable ban for administrative capabilities.', 'ultimate-member' ); ?>
</p>
<?php
$message = ob_get_clean();
File diff suppressed because it is too large Load Diff
@@ -85,7 +85,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Theme_Updater' ) ) {
}
$old_version = get_option( 'theme_version ' . $theme->get( 'Name' ) );
$version = $theme->get( 'Version' );
$version = $theme->get( 'Version' );
if ( $old_version === $version ) {
return;
}
@@ -98,14 +98,14 @@ if ( ! class_exists( 'um\admin\core\Admin_Theme_Updater' ) ) {
$um_dir = $theme->get_stylesheet_directory() . DIRECTORY_SEPARATOR . 'ultimate-member';
@mkdir( $um_dir, 0777, true );
$src = realpath( $temp_dir );
$src = realpath( $temp_dir );
$dest = realpath( $um_dir );
if ( $src && $dest ) {
self::recurse_copy( $src, $dest );
error_log( "UM Log. Theme '" . $theme->get( 'template' ) . "' templates restored." );
error_log( "UM Log. Theme '" . $theme->get( 'Name' ) . "' templates restored." );
UM()->files()->remove_dir( $src );
} else {
error_log( "UM Error. Can not restore theme templates." );
error_log( 'UM Error. Can not restore theme templates.' );
}
delete_option( 'theme_version ' . $theme->get( 'Name' ) );
@@ -140,13 +140,13 @@ if ( ! class_exists( 'um\admin\core\Admin_Theme_Updater' ) ) {
$temp_dir = UM()->uploader()->get_core_temp_dir() . DIRECTORY_SEPARATOR . 'themes' . DIRECTORY_SEPARATOR . $theme->get( 'template' );
@mkdir( $temp_dir, 0777, true );
$src = realpath( $um_dir );
$src = realpath( $um_dir );
$dest = realpath( $temp_dir );
if ( $src && $dest ) {
self::recurse_copy( $src, $dest );
error_log( "UM Log. Theme '" . $theme->get( 'template' ) . "' templates saved." );
error_log( "UM Log. Theme '" . $theme->get( 'Name' ) . "' templates saved." );
} else {
error_log( "UM Error. Can not save theme templates." );
error_log( 'UM Error. Can not save theme templates.' );
}
update_option( 'theme_version ' . $theme->get( 'Name' ), $theme->get( 'Version' ) );
@@ -156,7 +156,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Theme_Updater' ) ) {
/**
* Filter: upgrader_package_options
*
*
* @param array $options
* @return array
*/
@@ -170,7 +170,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Theme_Updater' ) ) {
/**
* Action: upgrader_process_complete
*
*
* @param \WP_Upgrader $WP_Upgrader
* @param array $options
*/
@@ -184,4 +184,4 @@ if ( ! class_exists( 'um\admin\core\Admin_Theme_Updater' ) ) {
}
}
}
+3 -3
View File
@@ -247,7 +247,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Users' ) ) {
'label' => __( 'Put as Pending Review', 'ultimate-member' )
),
'um_resend_activation' => array(
'label' => __( 'Resend Activation E-mail', 'ultimate-member' )
'label' => __( 'Resend Activation Email', 'ultimate-member' )
),
'um_deactivate' => array(
'label' => __( 'Deactivate', 'ultimate-member' )
@@ -274,7 +274,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Users' ) ) {
public function user_row_actions( $actions, $user_object ) {
$user_id = $user_object->ID;
$actions['frontend_profile'] = '<a href="' . um_user_profile_url( $user_id ) . '">' . __( 'View profile', 'ultimate-member' ) . '</a>';
$actions['frontend_profile'] = '<a href="' . esc_url( um_user_profile_url( $user_id ) ) . '">' . __( 'View profile', 'ultimate-member' ) . '</a>';
$submitted = get_user_meta( $user_id, 'submitted', true );
if ( ! empty( $submitted ) ) {
@@ -407,7 +407,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Users' ) ) {
$status = array(
'approved' => __( 'Approved', 'ultimate-member' ),
'awaiting_admin_review' => __( 'Pending review', 'ultimate-member' ),
'awaiting_email_confirmation' => __( 'Waiting e-mail confirmation', 'ultimate-member' ),
'awaiting_email_confirmation' => __( 'Waiting email confirmation', 'ultimate-member' ),
'inactive' => __( 'Inactive', 'ultimate-member' ),
'rejected' => __( 'Rejected', 'ultimate-member' ),
);
@@ -336,8 +336,8 @@ $ListTable->wpc_set_pagination_args( array( 'total_items' => count( $emails ), '
<p>
<?php esc_html_e( 'Email notifications sent from Ultimate Member are listed below. Click on an email to configure it.', 'ultimate-member' ); ?>
<br />
<?php esc_html_e( 'To ensure your website\'s notifications arrive in your and your customers\' inboxes, we recommend connecting your email address to your domain and setting up a dedicated SMTP server.', 'ultimate-member' ); ?>
<?php echo wp_kses( sprintf( __( 'You may get more details about email notifications customization <a href="%s">here</a>.', 'ultimate-member' ), 'https://docs.ultimatemember.com/article/1335-email-templates' ), UM()->get_allowed_html( 'admin_notice' ) ); ?>
<?php esc_html_e( 'Emails should be sent from an email using your website\'s domain name. We highly recommend using a SMTP service email delivery.', 'ultimate-member' ); ?>
<?php echo wp_kses( sprintf( __( 'Please see this <a href="%s" target="_blank">doc</a> for more information.', 'ultimate-member' ), 'https://docs.ultimatemember.com/article/116-not-receiving-user-emails-or-admin-notifications' ), UM()->get_allowed_html( 'admin_notice' ) ); ?>
</p>
<div class="clear"></div>
<form action="" method="get" name="um-settings-emails" id="um-settings-emails">
@@ -58,8 +58,7 @@ class UM_Versions_List_Table extends WP_List_Table {
$sortable = $this->get_sortable_columns();
$this->_column_headers = array( $columns, array(), $sortable );
$templates = get_option( 'um_template_statuses', array() );
$templates = is_array( $templates ) ? $templates : array();
$templates = UM()->common()->theme()->build_templates_data();
@uasort(
$templates,
+67 -86
View File
@@ -1,93 +1,74 @@
<?php if ( ! defined( 'ABSPATH' ) ) exit; ?>
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<div class="table">
<table>
<tr class="first">
<td class="first b">
<a href="<?php echo esc_url( admin_url( 'users.php' ) ); ?>">
<table id="um-users-overview-table">
<tr>
<td>
<span>
<a class="count" href="<?php echo esc_url( admin_url( 'users.php' ) ); ?>">
<?php echo UM()->query()->count_users(); ?>
</a>
</td>
<td class="t">
<a href="<?php echo esc_url( admin_url( 'users.php' ) ); ?>">
<?php _e( 'Users', 'ultimate-member' ); ?>
</a>
</td>
</tr>
<tr>
<td class="first b">
<a href="<?php echo esc_url( admin_url( 'users.php?um_status=approved' ) ); ?>">
<?php echo UM()->query()->count_users_by_status( 'approved' ); ?>
</a>
</td>
<td class="t">
<a href="<?php echo esc_url( admin_url( 'users.php?um_status=approved' ) ); ?>">
<?php _e( 'Approved', 'ultimate-member' ); ?>
</a>
</td>
</tr>
<tr>
<td class="first b">
<a href="<?php echo esc_url( admin_url( 'users.php?um_status=rejected' ) ); ?>">
<?php echo UM()->query()->count_users_by_status( 'rejected' ); ?>
</a>
</td>
<td class="t">
<a href="<?php echo esc_url( admin_url( 'users.php?um_status=rejected' ) ); ?>">
<?php _e( 'Rejected', 'ultimate-member' ); ?>
</a>
</td>
</tr>
</table>
</div>
<div class="table table_right">
<table>
<tr class="first">
<td class="b">
<a href="<?php echo esc_url( admin_url( 'users.php?um_status=awaiting_admin_review' ) ); ?>">
<?php echo UM()->query()->count_users_by_status( 'awaiting_admin_review' ); ?>
</a>
</td>
<td class="last t">
<a href="<?php echo esc_url( admin_url( 'users.php?um_status=awaiting_admin_review' ) ); ?>" class="warning">
<?php _e( 'Pending Review', 'ultimate-member' ); ?>
</a>
</td>
</tr>
<tr>
<td class="b">
<a href="<?php echo esc_url( admin_url( 'users.php?um_status=awaiting_email_confirmation' ) ); ?>">
<?php echo UM()->query()->count_users_by_status( 'awaiting_email_confirmation' ); ?>
</a>
</td>
<td class="last t">
<a href="<?php echo esc_url( admin_url( 'users.php?um_status=awaiting_email_confirmation' ) ); ?>" class="warning">
<?php _e( 'Awaiting E-mail Confirmation', 'ultimate-member' ); ?>
</a>
</td>
</tr>
<tr>
<td class="first b">
<a href="<?php echo esc_url( admin_url( 'users.php?um_status=inactive' ) ); ?>">
<?php echo UM()->query()->count_users_by_status( 'inactive' ); ?>
</a>
</td>
<td class="t">
<a href="<?php echo esc_url( admin_url( 'users.php?um_status=inactive' ) ); ?>">
<?php _e( 'Inactive', 'ultimate-member' ); ?>
</a>
</td>
</tr>
</table>
</div>
</span>
</td>
<td>
<span>
<a class="count" href="<?php echo esc_url( admin_url( 'users.php?um_status=awaiting_admin_review' ) ); ?>">
<?php echo UM()->query()->count_users_by_status( 'awaiting_admin_review' ); ?>
</a>
<a href="<?php echo esc_url( admin_url( 'users.php?um_status=awaiting_admin_review' ) ); ?>" class="warning">
<?php _e( 'Pending Review', 'ultimate-member' ); ?>
</a>
</span>
</td>
</tr>
<tr>
<td>
<span>
<a class="count" href="<?php echo esc_url( admin_url( 'users.php?um_status=approved' ) ); ?>">
<?php echo UM()->query()->count_users_by_status( 'approved' ); ?>
</a>
<a href="<?php echo esc_url( admin_url( 'users.php?um_status=approved' ) ); ?>">
<?php _e( 'Approved', 'ultimate-member' ); ?>
</a>
</span>
</td>
<td>
<span>
<a class="count" href="<?php echo esc_url( admin_url( 'users.php?um_status=awaiting_email_confirmation' ) ); ?>">
<?php echo UM()->query()->count_users_by_status( 'awaiting_email_confirmation' ); ?>
</a>
<a href="<?php echo esc_url( admin_url( 'users.php?um_status=awaiting_email_confirmation' ) ); ?>" class="warning">
<?php _e( 'Awaiting Email Confirmation', 'ultimate-member' ); ?>
</a>
</span>
</td>
</tr>
<tr>
<td>
<span>
<a class="count" href="<?php echo esc_url( admin_url( 'users.php?um_status=rejected' ) ); ?>">
<?php echo UM()->query()->count_users_by_status( 'rejected' ); ?>
</a>
<a href="<?php echo esc_url( admin_url( 'users.php?um_status=rejected' ) ); ?>">
<?php _e( 'Rejected', 'ultimate-member' ); ?>
</a></span>
</td>
<td>
<span>
<a class="count" href="<?php echo esc_url( admin_url( 'users.php?um_status=inactive' ) ); ?>">
<?php echo UM()->query()->count_users_by_status( 'inactive' ); ?>
</a>
<a href="<?php echo esc_url( admin_url( 'users.php?um_status=inactive' ) ); ?>">
<?php _e( 'Inactive', 'ultimate-member' ); ?>
</a>
</span>
</td>
</tr>
</table>
<div class="clear"></div>
+6 -6
View File
@@ -166,12 +166,12 @@ $premium['profile-tabs'] = array(
'desc' => 'Add custom tabs to profiles',
);
//$premium['stripe'] = array(
// 'url' => 'https://ultimatemember.com/extensions/stripe/',
// 'img' => 'stripe.png',
// 'name' => 'Stripe',
// 'desc' => 'Sell paid memberships to access your website via Stripe subscriptions',
//);
$premium['stripe'] = array(
'url' => 'https://ultimatemember.com/extensions/stripe/',
'img' => 'stripe.png',
'name' => 'Stripe',
'desc' => 'Sell paid memberships to access your website via Stripe subscriptions',
);
$free['jobboardwp'] = array(
'url' => 'https://wordpress.org/plugins/um-jobboardwp',
@@ -43,7 +43,7 @@
'id' => '_um_can_delete_everyone',
'type' => 'checkbox',
'label' => __( 'Can delete other member accounts?', 'ultimate-member' ),
'tooltip' => __( 'Allow this role to edit accounts of other members', 'ultimate-member' ),
'tooltip' => __( 'Allow this role to delete other user accounts.', 'ultimate-member' ),
'value' => ! empty( $role['_um_can_delete_everyone'] ) ? $role['_um_can_delete_everyone'] : 0,
),
array(
@@ -58,4 +58,4 @@
)
)
) )->render_form(); ?>
</div>
</div>
+14 -4
View File
@@ -1,12 +1,14 @@
<?php if ( ! defined( 'ABSPATH' ) ) {
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
$role = $object['data']; ?>
$role = $object['data'];
?>
<div class="um-admin-metabox">
<?php
UM()->admin_forms(
$form = UM()->admin_forms(
array(
'class' => 'um-role-publish um-top-label',
'prefix_id' => 'role',
@@ -20,7 +22,8 @@ $role = $object['data']; ?>
),
),
)
)->render_form();
);
$form->render_form();
?>
</div>
@@ -31,3 +34,10 @@ $role = $object['data']; ?>
<div class="clear"></div>
</div>
</div>
<?php
echo $form->render_external_link(
array(
'html' => __( 'Learn more about role priorities', 'ultimate-member' ),
'url' => 'https://docs.ultimatemember.com/article/1494-how-to-set-role-priority-for-user-roles',
)
);
+2 -2
View File
@@ -76,8 +76,8 @@
array(
'id' => '_um_url_email_activate',
'type' => 'text',
'label' => __( 'URL redirect after e-mail activation', 'ultimate-member' ),
'tooltip' => __( 'If you want users to go to a specific page other than login page after e-mail activation, enter the URL here.', 'ultimate-member' ),
'label' => __( 'URL redirect after email activation', 'ultimate-member' ),
'tooltip' => __( 'If you want users to go to a specific page other than login page after email activation, enter the URL here.', 'ultimate-member' ),
'value' => ! empty( $role['_um_url_email_activate'] ) ? __( $role['_um_url_email_activate'], 'ultimate-member' ) : '',
'conditional' => array( '_um_status', '=', 'checkmail' ),
),