mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
Merge branch 'development/2.8.x' into feature/search_exclude_fields
This commit is contained in:
+100
-34
@@ -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(
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 = ' · <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 = ' · <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>';
|
||||
}
|
||||
|
||||
@@ -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§ion=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' ),
|
||||
|
||||
@@ -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'] );
|
||||
|
||||
@@ -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 = ' <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 = ' <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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -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§ion=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 & capabilities.', 'ultimate-member' ); ?>
|
||||
</p>
|
||||
<p>
|
||||
<a class="button button-primary" href="<?php echo esc_attr( admin_url( 'admin.php?page=um_options&tab=advanced§ion=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' ) ) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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',
|
||||
)
|
||||
);
|
||||
|
||||
@@ -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' ),
|
||||
),
|
||||
|
||||
@@ -284,8 +284,8 @@ class Secure {
|
||||
if ( $suspicious_accounts_count > 0 ) {
|
||||
$lock_register_forms_url = admin_url( 'admin.php?page=um_options&tab=advanced§ion=secure&um_secure_lock_register_forms=1&_wpnonce=' . wp_create_nonce( 'um_secure_lock_register_forms' ) );
|
||||
$content .= $br . esc_html__( '1. Please temporarily lock all your active Register forms.', 'ultimate-member' );
|
||||
$content .= ' <a href="' . esc_attr( $lock_register_forms_url ) . '" target="_blank">' . esc_html__( 'Click here to lock them now.', 'ultimate-member' ) . '</a>';
|
||||
$content .= ' ' . esc_html__( 'You can unblock the Register forms later. Just go to Ultimate Member > Settings > Secure > uncheck the option "Lock All Register Forms".', 'ultimate-member' );
|
||||
$content .= ' <a href="' . esc_url( $lock_register_forms_url ) . '" target="_blank">' . esc_html__( 'Click here to lock them now.', 'ultimate-member' ) . '</a>';
|
||||
$content .= ' ' . esc_html__( 'You can unblock the Register forms later. Just go to Ultimate Member > Settings > Advanced > Security and uncheck the option "Lock All Register Forms".', 'ultimate-member' );
|
||||
$content .= $br . $br;
|
||||
$suspicious_accounts_url = admin_url( 'users.php?um_status=inactive' );
|
||||
|
||||
@@ -300,24 +300,24 @@ class Secure {
|
||||
}
|
||||
|
||||
$content .= esc_html__( '2. Review all suspicious accounts and delete them completely.', 'ultimate-member' );
|
||||
$content .= ' <a href="' . esc_attr( $suspicious_accounts_url ) . '" target="_blank">' . esc_html__( 'Click here to review accounts.', 'ultimate-member' ) . '</a>';
|
||||
$content .= ' <a href="' . esc_url( $suspicious_accounts_url ) . '" target="_blank">' . esc_html__( 'Click here to review accounts.', 'ultimate-member' ) . '</a>';
|
||||
$content .= $br . $br;
|
||||
|
||||
$nonce = wp_create_nonce( 'um-secure-expire-session-nonce' );
|
||||
$destroy_all_sessions_url = admin_url( '?um_secure_expire_all_sessions=1&_wpnonce=' . esc_attr( $nonce ) . '&except_me=1' );
|
||||
$content .= esc_html__( '3. If accounts are suspicious to you, please destroy all user sessions to logout active users on your site.', 'ultimate-member' );
|
||||
$content .= ' <a href="' . esc_attr( $destroy_all_sessions_url ) . '" target="_blank">' . esc_html__( 'Click here to Destroy Sessions now', 'ultimate-member' ) . '</a>';
|
||||
$content .= ' <a href="' . esc_url( $destroy_all_sessions_url ) . '" target="_blank">' . esc_html__( 'Click here to Destroy Sessions now', 'ultimate-member' ) . '</a>';
|
||||
|
||||
$content .= $br . $br;
|
||||
$content .= esc_html__( '4. Run a complete scan on your site using third-party Security plugins such as', 'ultimate-member' );
|
||||
$content .= ' <a target="_blank" href="' . esc_attr( admin_url( 'plugin-install.php?s=Jetpack%2520Protect%2520WP%2520Scan&tab=search&type=term' ) ) . '">' . esc_html__( 'WPScan/Jetpack Protect or WordFence Security', 'ultimate-member' ) . '</a>.';
|
||||
$content .= ' <a target="_blank" href="' . esc_url( admin_url( 'plugin-install.php?s=Jetpack%2520Protect%2520WP%2520Scan&tab=search&type=term' ) ) . '">' . esc_html__( 'WPScan/Jetpack Protect or WordFence Security', 'ultimate-member' ) . '</a>.';
|
||||
|
||||
$content .= $br . $br;
|
||||
$nonce = wp_create_nonce( 'um-secure-enable-reset-pass-nonce' );
|
||||
$reset_pass_sessions_url = admin_url( '?um_secure_enable_reset_password=1&_wpnonce=' . esc_attr( $nonce ) . '&except_me=1' );
|
||||
|
||||
$content .= esc_html__( '5. Force users to Reset their Passwords.', 'ultimate-member' );
|
||||
$content .= ' <a target="_blank" href="' . esc_attr( $reset_pass_sessions_url ) . '">' . esc_html__( 'Click here to enable this option', 'ultimate-member' ) . '</a>.';
|
||||
$content .= ' <a target="_blank" href="' . esc_url( $reset_pass_sessions_url ) . '">' . esc_html__( 'Click here to enable this option', 'ultimate-member' ) . '</a>.';
|
||||
$content .= ' ' . esc_html__( 'When this option is enabled, users will be asked to reset their passwords(one-time) on the next login in the UM Login form.', 'ultimate-member' );
|
||||
$content .= $br . $br;
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-server-side-render'), 'version' => 'a7aefdd7c81b99d7d5e3');
|
||||
<?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-server-side-render'), 'version' => '5b1a8ec016836a5c26cd');
|
||||
|
||||
@@ -1 +1 @@
|
||||
!function(){"use strict";var e={n:function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,{a:r}),r},d:function(t,r){for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},t=window.wp.element,r=window.wp.data,n=window.wp.components,i=window.wp.blockEditor,o=window.wp.serverSideRender,l=e.n(o);(0,window.wp.blocks.registerBlockType)("um-block/um-member-directories",{edit:function(e){let{member_id:o,setAttributes:u}=e.attributes;const c=(0,i.useBlockProps)(),a=(0,r.useSelect)((e=>e("core").getEntityRecords("postType","um_directory",{per_page:-1,_fields:["id","title"]})));if(!a)return(0,t.createElement)("p",null,(0,t.createElement)(n.Spinner,null),wp.i18n.__("Loading...","ultimate-member"));if(0===a.length)return"No posts found.";let d=[{id:"",title:""}].concat(a).map((e=>({label:e.title.rendered,value:e.id})));return(0,t.createElement)("div",{...c},(0,t.createElement)(l(),{block:"um-block/um-member-directories",attributes:e.attributes}),(0,t.createElement)(i.InspectorControls,null,(0,t.createElement)(n.PanelBody,{title:wp.i18n.__("Select Directories","ultimate-member")},(0,t.createElement)(n.SelectControl,{label:wp.i18n.__("Select Directories","ultimate-member"),className:"um_select_directory",value:o,options:d,style:{height:"35px",lineHeight:"20px",padding:"0 7px"},onChange:t=>{e.setAttributes({member_id:t})}}))))},save:function(e){return null}}),jQuery(window).on("load",(function(e){new MutationObserver((function(e){e.forEach((function(e){jQuery(e.addedNodes).find(".um.um-directory").each((function(){var e=jQuery(this);um_ajax_get_members(e),um_slider_filter_init(e),um_datepicker_filter_init(e),um_timepicker_filter_init(e)}))}))})).observe(document,{attributes:!1,childList:!0,characterData:!1,subtree:!0})}))}();
|
||||
(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var i in r)e.o(r,i)&&!e.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:r[i]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.React,r=window.wp.data,i=window.wp.components,n=window.wp.blockEditor,o=window.wp.serverSideRender;var l=e.n(o);(0,window.wp.blocks.registerBlockType)("um-block/um-member-directories",{edit:function(e){let{member_id:o,setAttributes:a}=e.attributes;const c=(0,n.useBlockProps)(),u=(0,r.useSelect)((e=>e("core").getEntityRecords("postType","um_directory",{per_page:-1,_fields:["id","title"]})));if(!u)return(0,t.createElement)("p",null,(0,t.createElement)(i.Spinner,null),wp.i18n.__("Loading...","ultimate-member"));if(0===u.length)return"No posts found.";let d=[{id:"",title:""}].concat(u).map((e=>({label:e.title.rendered,value:e.id})));return(0,t.createElement)("div",{...c},(0,t.createElement)(l(),{block:"um-block/um-member-directories",attributes:e.attributes}),(0,t.createElement)(n.InspectorControls,null,(0,t.createElement)(i.PanelBody,{title:wp.i18n.__("Select Directories","ultimate-member")},(0,t.createElement)(i.SelectControl,{label:wp.i18n.__("Select Directories","ultimate-member"),className:"um_select_directory",value:o,options:d,style:{height:"35px",lineHeight:"20px",padding:"0 7px"},onChange:t=>{e.setAttributes({member_id:t})}}))))},save:function(e){return null}}),jQuery(window).on("load",(function(e){new MutationObserver((function(e){e.forEach((function(e){jQuery(e.addedNodes).find(".um.um-directory").each((function(){var e=jQuery(this);um_ajax_get_members(e),um_slider_filter_init(e),um_datepicker_filter_init(e),um_timepicker_filter_init(e)})),jQuery(e.addedNodes).find(".um-member").each((function(){var e=jQuery(this).parent();UM_Member_Grid(e)}))}))})).observe(document,{attributes:!1,childList:!0,characterData:!1,subtree:!0})}))})();
|
||||
@@ -101,6 +101,10 @@ jQuery(window).on( 'load', function($) {
|
||||
um_datepicker_filter_init( directory );
|
||||
um_timepicker_filter_init( directory );
|
||||
});
|
||||
jQuery(mutation.addedNodes).find('.um-member').each(function() {
|
||||
var directory = jQuery(this).parent();
|
||||
UM_Member_Grid(directory);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
+217
-242
@@ -204,29 +204,7 @@ if ( ! class_exists( 'um\Config' ) ) {
|
||||
'_um_secondary_color',
|
||||
);
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_core_form_meta_all
|
||||
* @description Extend UM forms meta keys
|
||||
* @input_vars
|
||||
* [{"var":"$meta","type":"array","desc":"UM forms meta"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_core_form_meta_all', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_core_form_meta_all', 'my_core_form_meta', 10, 1 );
|
||||
* function my_core_form_meta( $meta ) {
|
||||
* // your code here
|
||||
* $meta['my_meta_key'] = 'my_meta_value';
|
||||
* return $meta;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$this->core_form_meta_all = apply_filters( 'um_core_form_meta_all', array(
|
||||
$this->core_form_meta_all = array(
|
||||
/*Profile Form*/
|
||||
'_um_profile_show_name' => 1,
|
||||
'_um_profile_show_social_links' => 0,
|
||||
@@ -279,62 +257,49 @@ if ( ! class_exists( 'um\Config' ) ) {
|
||||
'_um_directory_template' => 'members',
|
||||
'_um_directory_header' => __( '{total_users} Members', 'ultimate-member' ),
|
||||
'_um_directory_header_single' => __( '{total_users} Member', 'ultimate-member' ),
|
||||
) );
|
||||
);
|
||||
/**
|
||||
* Filters the list of Ultimate Member forms meta.
|
||||
*
|
||||
* @param {array} $form_meta UM Forms meta.
|
||||
*
|
||||
* @return {array} Forms meta.
|
||||
*
|
||||
* @since 1.3.x
|
||||
* @hook um_core_form_meta_all
|
||||
*
|
||||
* @example <caption>Add custom admin notice after {custom_update_key} action.</caption>
|
||||
* function my_um_core_form_meta_all( $form_meta ) {
|
||||
* // your code here
|
||||
* $meta['my_meta_key'] = 'my_meta_value';
|
||||
* return $meta;
|
||||
* }
|
||||
* add_filter( 'um_core_form_meta_all', 'my_um_core_form_meta_all' );
|
||||
*/
|
||||
$this->core_form_meta_all = apply_filters( 'um_core_form_meta_all', $this->core_form_meta_all );
|
||||
|
||||
$this->core_form_meta['register'] = array(
|
||||
'_um_custom_fields' => 'a:6:{s:10:"user_login";a:15:{s:5:"title";s:8:"Username";s:7:"metakey";s:10:"user_login";s:4:"type";s:4:"text";s:5:"label";s:8:"Username";s:8:"required";i:1;s:6:"public";i:1;s:8:"editable";b:0;s:8:"validate";s:15:"unique_username";s:9:"min_chars";i:3;s:9:"max_chars";i:24;s:8:"position";s:1:"1";s:6:"in_row";s:9:"_um_row_1";s:10:"in_sub_row";s:1:"0";s:9:"in_column";s:1:"1";s:8:"in_group";s:0:"";}s:10:"user_email";a:13:{s:5:"title";s:14:"E-mail Address";s:7:"metakey";s:10:"user_email";s:4:"type";s:4:"text";s:5:"label";s:14:"E-mail Address";s:8:"required";i:0;s:6:"public";i:1;s:8:"editable";b:1;s:8:"validate";s:12:"unique_email";s:8:"position";s:1:"4";s:6:"in_row";s:9:"_um_row_1";s:10:"in_sub_row";s:1:"0";s:9:"in_column";s:1:"1";s:8:"in_group";s:0:"";}s:13:"user_password";a:16:{s:5:"title";s:8:"Password";s:7:"metakey";s:13:"user_password";s:4:"type";s:8:"password";s:5:"label";s:8:"Password";s:8:"required";i:1;s:6:"public";i:1;s:8:"editable";b:1;s:9:"min_chars";i:8;s:9:"max_chars";i:30;s:15:"force_good_pass";i:1;s:18:"force_confirm_pass";i:1;s:8:"position";s:1:"5";s:6:"in_row";s:9:"_um_row_1";s:10:"in_sub_row";s:1:"0";s:9:"in_column";s:1:"1";s:8:"in_group";s:0:"";}s:10:"first_name";a:12:{s:5:"title";s:10:"First Name";s:7:"metakey";s:10:"first_name";s:4:"type";s:4:"text";s:5:"label";s:10:"First Name";s:8:"required";i:0;s:6:"public";i:1;s:8:"editable";b:1;s:8:"position";s:1:"2";s:6:"in_row";s:9:"_um_row_1";s:10:"in_sub_row";s:1:"0";s:9:"in_column";s:1:"1";s:8:"in_group";s:0:"";}s:9:"last_name";a:12:{s:5:"title";s:9:"Last Name";s:7:"metakey";s:9:"last_name";s:4:"type";s:4:"text";s:5:"label";s:9:"Last Name";s:8:"required";i:0;s:6:"public";i:1;s:8:"editable";b:1;s:8:"position";s:1:"3";s:6:"in_row";s:9:"_um_row_1";s:10:"in_sub_row";s:1:"0";s:9:"in_column";s:1:"1";s:8:"in_group";s:0:"";}s:9:"_um_row_1";a:4:{s:4:"type";s:3:"row";s:2:"id";s:9:"_um_row_1";s:8:"sub_rows";s:1:"1";s:4:"cols";s:1:"1";}}',
|
||||
'_um_mode' => 'register',
|
||||
'_um_core' => 'register',
|
||||
'_um_custom_fields' => 'a:6:{s:10:"user_login";a:15:{s:5:"title";s:8:"Username";s:7:"metakey";s:10:"user_login";s:4:"type";s:4:"text";s:5:"label";s:8:"Username";s:8:"required";i:1;s:6:"public";i:1;s:8:"editable";b:0;s:8:"validate";s:15:"unique_username";s:9:"min_chars";i:3;s:9:"max_chars";i:24;s:8:"position";s:1:"1";s:6:"in_row";s:9:"_um_row_1";s:10:"in_sub_row";s:1:"0";s:9:"in_column";s:1:"1";s:8:"in_group";s:0:"";}s:10:"user_email";a:13:{s:5:"title";s:14:"Email Address";s:7:"metakey";s:10:"user_email";s:4:"type";s:4:"text";s:5:"label";s:14:"E-mail Address";s:8:"required";i:0;s:6:"public";i:1;s:8:"editable";b:1;s:8:"validate";s:12:"unique_email";s:8:"position";s:1:"4";s:6:"in_row";s:9:"_um_row_1";s:10:"in_sub_row";s:1:"0";s:9:"in_column";s:1:"1";s:8:"in_group";s:0:"";}s:13:"user_password";a:16:{s:5:"title";s:8:"Password";s:7:"metakey";s:13:"user_password";s:4:"type";s:8:"password";s:5:"label";s:8:"Password";s:8:"required";i:1;s:6:"public";i:1;s:8:"editable";b:1;s:9:"min_chars";i:8;s:9:"max_chars";i:30;s:15:"force_good_pass";i:1;s:18:"force_confirm_pass";i:1;s:8:"position";s:1:"5";s:6:"in_row";s:9:"_um_row_1";s:10:"in_sub_row";s:1:"0";s:9:"in_column";s:1:"1";s:8:"in_group";s:0:"";}s:10:"first_name";a:12:{s:5:"title";s:10:"First Name";s:7:"metakey";s:10:"first_name";s:4:"type";s:4:"text";s:5:"label";s:10:"First Name";s:8:"required";i:0;s:6:"public";i:1;s:8:"editable";b:1;s:8:"position";s:1:"2";s:6:"in_row";s:9:"_um_row_1";s:10:"in_sub_row";s:1:"0";s:9:"in_column";s:1:"1";s:8:"in_group";s:0:"";}s:9:"last_name";a:12:{s:5:"title";s:9:"Last Name";s:7:"metakey";s:9:"last_name";s:4:"type";s:4:"text";s:5:"label";s:9:"Last Name";s:8:"required";i:0;s:6:"public";i:1;s:8:"editable";b:1;s:8:"position";s:1:"3";s:6:"in_row";s:9:"_um_row_1";s:10:"in_sub_row";s:1:"0";s:9:"in_column";s:1:"1";s:8:"in_group";s:0:"";}s:9:"_um_row_1";a:4:{s:4:"type";s:3:"row";s:2:"id";s:9:"_um_row_1";s:8:"sub_rows";s:1:"1";s:4:"cols";s:1:"1";}}',
|
||||
'_um_mode' => 'register',
|
||||
'_um_core' => 'register',
|
||||
'_um_register_use_custom_settings' => 0,
|
||||
);
|
||||
|
||||
$this->core_form_meta['login'] = array(
|
||||
'_um_custom_fields' => 'a:3:{s:8:"username";a:13:{s:5:"title";s:18:"Username or E-mail";s:7:"metakey";s:8:"username";s:4:"type";s:4:"text";s:5:"label";s:18:"Username or E-mail";s:8:"required";i:1;s:6:"public";i:1;s:8:"editable";b:0;s:8:"validate";s:24:"unique_username_or_email";s:8:"position";s:1:"1";s:6:"in_row";s:9:"_um_row_1";s:10:"in_sub_row";s:1:"0";s:9:"in_column";s:1:"1";s:8:"in_group";s:0:"";}s:13:"user_password";a:16:{s:5:"title";s:8:"Password";s:7:"metakey";s:13:"user_password";s:4:"type";s:8:"password";s:5:"label";s:8:"Password";s:8:"required";i:1;s:6:"public";i:1;s:8:"editable";b:1;s:9:"min_chars";i:8;s:9:"max_chars";i:30;s:15:"force_good_pass";i:1;s:18:"force_confirm_pass";i:1;s:8:"position";s:1:"2";s:6:"in_row";s:9:"_um_row_1";s:10:"in_sub_row";s:1:"0";s:9:"in_column";s:1:"1";s:8:"in_group";s:0:"";}s:9:"_um_row_1";a:4:{s:4:"type";s:3:"row";s:2:"id";s:9:"_um_row_1";s:8:"sub_rows";s:1:"1";s:4:"cols";s:1:"1";}}',
|
||||
'_um_mode' => 'login',
|
||||
'_um_core' => 'login',
|
||||
'_um_custom_fields' => 'a:3:{s:8:"username";a:13:{s:5:"title";s:18:"Username or Email";s:7:"metakey";s:8:"username";s:4:"type";s:4:"text";s:5:"label";s:18:"Username or E-mail";s:8:"required";i:1;s:6:"public";i:1;s:8:"editable";b:0;s:8:"validate";s:24:"unique_username_or_email";s:8:"position";s:1:"1";s:6:"in_row";s:9:"_um_row_1";s:10:"in_sub_row";s:1:"0";s:9:"in_column";s:1:"1";s:8:"in_group";s:0:"";}s:13:"user_password";a:16:{s:5:"title";s:8:"Password";s:7:"metakey";s:13:"user_password";s:4:"type";s:8:"password";s:5:"label";s:8:"Password";s:8:"required";i:1;s:6:"public";i:1;s:8:"editable";b:1;s:9:"min_chars";i:8;s:9:"max_chars";i:30;s:15:"force_good_pass";i:1;s:18:"force_confirm_pass";i:1;s:8:"position";s:1:"2";s:6:"in_row";s:9:"_um_row_1";s:10:"in_sub_row";s:1:"0";s:9:"in_column";s:1:"1";s:8:"in_group";s:0:"";}s:9:"_um_row_1";a:4:{s:4:"type";s:3:"row";s:2:"id";s:9:"_um_row_1";s:8:"sub_rows";s:1:"1";s:4:"cols";s:1:"1";}}',
|
||||
'_um_mode' => 'login',
|
||||
'_um_core' => 'login',
|
||||
'_um_login_use_custom_settings' => 0,
|
||||
);
|
||||
|
||||
$this->core_form_meta['profile'] = array(
|
||||
'_um_custom_fields' => 'a:1:{s:9:"_um_row_1";a:4:{s:4:"type";s:3:"row";s:2:"id";s:9:"_um_row_1";s:8:"sub_rows";s:1:"1";s:4:"cols";s:1:"1";}}',
|
||||
'_um_mode' => 'profile',
|
||||
'_um_core' => 'profile',
|
||||
'_um_custom_fields' => 'a:1:{s:9:"_um_row_1";a:4:{s:4:"type";s:3:"row";s:2:"id";s:9:"_um_row_1";s:8:"sub_rows";s:1:"1";s:4:"cols";s:1:"1";}}',
|
||||
'_um_mode' => 'profile',
|
||||
'_um_core' => 'profile',
|
||||
'_um_profile_use_custom_settings' => 0,
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_email_notifications
|
||||
* @description Extend UM email notifications
|
||||
* @input_vars
|
||||
* [{"var":"$emails","type":"array","desc":"UM email notifications"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_email_notifications', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_email_notifications', 'my_email_notifications', 10, 1 );
|
||||
* function my_email_notifications( $emails ) {
|
||||
* // your code here
|
||||
* $emails['my_email'] = array(
|
||||
* 'key' => 'my_email',
|
||||
* 'title' => __( 'my_email_title','ultimate-member' ),
|
||||
* 'subject' => 'my_email_subject',
|
||||
* 'body' => 'my_email_body',
|
||||
* 'description' => 'my_email_description',
|
||||
* 'recipient' => 'user', // set 'admin' for make administrator as recipient
|
||||
* 'default_active' => true // can be false for make disabled by default
|
||||
* );
|
||||
*
|
||||
* return $emails;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$this->email_notifications = apply_filters( 'um_email_notifications', array(
|
||||
$this->email_notifications = array(
|
||||
'welcome_email' => array(
|
||||
'key' => 'welcome_email',
|
||||
'title' => __( 'Account Welcome Email','ultimate-member' ),
|
||||
@@ -343,7 +308,7 @@ if ( ! class_exists( 'um\Config' ) ) {
|
||||
'Thank you for signing up with {site_name}! Your account is now active.<br /><br />' .
|
||||
'{action_title}:<br /><br />' .
|
||||
'{action_url} <br /><br />' .
|
||||
'Your account e-mail: {email} <br />' .
|
||||
'Your account email: {email} <br />' .
|
||||
'Your account username: {username} <br /><br />' .
|
||||
'If you have any problems, please contact us at {admin_email}<br /><br />' .
|
||||
'Thanks,<br />' .
|
||||
@@ -362,7 +327,7 @@ if ( ! class_exists( 'um\Config' ) ) {
|
||||
'If you have any problems, please contact us at {admin_email}<br /><br />' .
|
||||
'Thanks, <br />' .
|
||||
'{site_name}',
|
||||
'description' => __('Whether to send the user an email when his account needs e-mail activation','ultimate-member'),
|
||||
'description' => __('Whether to send the user an email when his account needs email activation','ultimate-member'),
|
||||
'recipient' => 'user'
|
||||
),
|
||||
'pending_email' => array(
|
||||
@@ -386,7 +351,7 @@ if ( ! class_exists( 'um\Config' ) ) {
|
||||
'Thank you for signing up with {site_name}! Your account has been approved and is now active.<br /><br />' .
|
||||
'To login please visit the following url:<br /><br />' .
|
||||
'{login_url}<br /><br />' .
|
||||
'Your account e-mail: {email}<br />' .
|
||||
'Your account email: {email}<br />' .
|
||||
'Your account username: {username}<br />' .
|
||||
'Set your account password: {password_reset_link}<br /><br />' .
|
||||
'If you have any problems, please contact us at {admin_email}<br /><br />' .
|
||||
@@ -507,92 +472,123 @@ if ( ! class_exists( 'um\Config' ) ) {
|
||||
),
|
||||
'suspicious-activity' => array(
|
||||
'key' => 'suspicious-activity',
|
||||
'title' => __( 'Secure: Suspicious Account Activity', 'ultimate-member' ),
|
||||
'title' => __( 'Security: Suspicious Account Activity', 'ultimate-member' ),
|
||||
'subject' => __( '[{site_name}] Suspicious Account Activity', 'ultimate-member' ),
|
||||
'body' => 'This is to inform you that there are suspicious activities with the following accounts: {user_profile_link}',
|
||||
'description' => __( 'Whether to receive notification when suspicious account activity is detected.', 'ultimate-member' ),
|
||||
'recipient' => 'admin',
|
||||
'default_active' => true,
|
||||
),
|
||||
) );
|
||||
);
|
||||
/**
|
||||
* Filters the list of Ultimate Member email notifications.
|
||||
*
|
||||
* @param {array} $email_notifications Email notifications.
|
||||
*
|
||||
* @return {array} Email notifications.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @hook um_email_notifications
|
||||
*
|
||||
* @example <caption>Add custom admin notice after {custom_update_key} action.</caption>
|
||||
* function my_um_email_notifications( $notifications ) {
|
||||
* // your code here
|
||||
* $emails['my_email'] = array(
|
||||
* 'key' => 'my_email',
|
||||
* 'title' => __( 'my_email_title','ultimate-member' ),
|
||||
* 'subject' => 'my_email_subject',
|
||||
* 'body' => 'my_email_body',
|
||||
* 'description' => 'my_email_description',
|
||||
* 'recipient' => 'user', // set 'admin' for make administrator as recipient
|
||||
* 'default_active' => true // can be false for make disabled by default
|
||||
* );
|
||||
*
|
||||
* return $emails;
|
||||
* }
|
||||
* add_filter( 'um_email_notifications', 'my_um_email_notifications' );
|
||||
*/
|
||||
$this->email_notifications = apply_filters( 'um_email_notifications', $this->email_notifications );
|
||||
|
||||
//settings defaults
|
||||
// Settings defaults.
|
||||
$this->settings_defaults = array(
|
||||
'restricted_access_post_metabox' => array( 'post' => 1, 'page' => 1 ),
|
||||
'disable_restriction_pre_queries' => 0,
|
||||
'uninstall_on_delete' => 0,
|
||||
'restricted_access_post_metabox' => array(
|
||||
'post' => 1,
|
||||
'page' => 1,
|
||||
),
|
||||
'disable_restriction_pre_queries' => false,
|
||||
'uninstall_on_delete' => false,
|
||||
'permalink_base' => 'user_login',
|
||||
'permalink_base_custom_meta' => '',
|
||||
'display_name' => 'full_name',
|
||||
'display_name_field' => '',
|
||||
'author_redirect' => 1,
|
||||
'author_redirect' => true,
|
||||
'members_page' => true,
|
||||
'use_gravatars' => 0,
|
||||
'use_gravatars' => false,
|
||||
'use_um_gravatar_default_builtin_image' => 'default',
|
||||
'use_um_gravatar_default_image' => 0,
|
||||
'use_um_gravatar_default_image' => false,
|
||||
'toggle_password' => false,
|
||||
'require_strongpass' => 0,
|
||||
'require_strongpass' => false,
|
||||
'password_min_chars' => 8,
|
||||
'password_max_chars' => 30,
|
||||
'account_tab_password' => 1,
|
||||
'account_tab_privacy' => 1,
|
||||
'account_tab_notifications' => 1,
|
||||
'account_tab_delete' => 1,
|
||||
'account_tab_password' => true,
|
||||
'account_tab_privacy' => true,
|
||||
'account_tab_notifications' => true,
|
||||
'account_tab_delete' => true,
|
||||
'delete_account_text' => __( 'Are you sure you want to delete your account? This will erase all of your account data from the site. To delete your account enter your password below.', 'ultimate-member' ),
|
||||
'delete_account_no_pass_required_text' => __( 'Are you sure you want to delete your account? This will erase all of your account data from the site. To delete your account, click on the button below.', 'ultimate-member' ),
|
||||
'account_name' => 1,
|
||||
'account_name_disable' => 0,
|
||||
'account_name_require' => 1,
|
||||
'account_email' => 1,
|
||||
'account_general_password' => 0,
|
||||
'account_hide_in_directory' => 1,
|
||||
'account_name' => true,
|
||||
'account_name_disable' => false,
|
||||
'account_name_require' => true,
|
||||
'account_email' => true,
|
||||
'account_general_password' => false,
|
||||
'account_hide_in_directory' => true,
|
||||
'account_hide_in_directory_default' => 'No',
|
||||
'photo_thumb_sizes' => array( 40, 80, 190 ),
|
||||
'cover_thumb_sizes' => array( 300, 600 ),
|
||||
'accessible' => 0,
|
||||
'access_redirect' => '',
|
||||
'access_exclude_uris' => array(),
|
||||
'home_page_accessible' => 1,
|
||||
'category_page_accessible' => 1,
|
||||
'restricted_post_title_replace' => 1,
|
||||
'home_page_accessible' => true,
|
||||
'category_page_accessible' => true,
|
||||
'restricted_post_title_replace' => true,
|
||||
'restricted_access_post_title' => __( 'Restricted content', 'ultimate-member' ),
|
||||
'restricted_access_message' => '',
|
||||
'restricted_blocks' => 0,
|
||||
'enable_blocks' => 0,
|
||||
'restricted_blocks' => false,
|
||||
'enable_blocks' => false,
|
||||
'restricted_block_message' => '',
|
||||
'enable_reset_password_limit' => 1,
|
||||
'enable_reset_password_limit' => true,
|
||||
'reset_password_limit_number' => 3,
|
||||
'change_password_request_limit' => false,
|
||||
'blocked_emails' => '',
|
||||
'blocked_words' => 'admin' . "\r\n" . 'administrator' . "\r\n" . 'webmaster' . "\r\n" . 'support' . "\r\n" . 'staff',
|
||||
'allowed_choice_callbacks' => '',
|
||||
'allow_url_redirect_confirm' => 1,
|
||||
'allow_url_redirect_confirm' => true,
|
||||
'default_avatar' => '',
|
||||
'default_cover' => '',
|
||||
'disable_profile_photo_upload' => 0,
|
||||
'profile_show_metaicon' => 0,
|
||||
'profile_menu' => 1,
|
||||
'disable_profile_photo_upload' => false,
|
||||
'profile_show_metaicon' => false,
|
||||
'profile_menu' => true,
|
||||
'profile_menu_default_tab' => 'main',
|
||||
'profile_menu_icons' => 1,
|
||||
'form_asterisk' => 0,
|
||||
'profile_menu_icons' => true,
|
||||
'form_asterisk' => false,
|
||||
'profile_title' => '{display_name} | {site_name}',
|
||||
'profile_desc' => '{display_name} is on {site_name}. Join {site_name} to view {display_name}\'s profile',
|
||||
'admin_email' => get_bloginfo( 'admin_email' ),
|
||||
'mail_from' => get_bloginfo( 'name' ),
|
||||
'mail_from_addr' => get_bloginfo( 'admin_email' ),
|
||||
'email_html' => 1,
|
||||
'image_orientation_by_exif' => 0,
|
||||
'email_html' => true,
|
||||
'image_orientation_by_exif' => false,
|
||||
'image_compression' => 60,
|
||||
'image_max_width' => 1000,
|
||||
'cover_min_width' => 1000,
|
||||
'profile_photo_max_size' => 999999999,
|
||||
'cover_photo_max_size' => 999999999,
|
||||
'custom_roles_increment' => 1,
|
||||
'um_profile_object_cache_stop' => 0,
|
||||
'um_profile_object_cache_stop' => false,
|
||||
'rest_api_version' => '2.0',
|
||||
'member_directory_own_table' => 0,
|
||||
'member_directory_own_table' => false,
|
||||
'profile_show_bio' => false,
|
||||
'profile_show_html_bio' => 0,
|
||||
'profile_show_html_bio' => false,
|
||||
'profile_bio_maxchars' => 180,
|
||||
'profile_noindex' => 0,
|
||||
'activation_link_expiry_time' => '',
|
||||
@@ -603,7 +599,7 @@ if ( ! class_exists( 'um\Config' ) ) {
|
||||
'secure_notify_admins_banned_accounts' => false,
|
||||
'secure_notify_admins_banned_accounts__interval' => 'instant',
|
||||
'secure_allowed_redirect_hosts' => '',
|
||||
'delete_comments' => 0,
|
||||
'delete_comments' => false,
|
||||
);
|
||||
|
||||
add_filter( 'um_get_tabs_from_config', '__return_true' );
|
||||
@@ -620,26 +616,26 @@ if ( ! class_exists( 'um\Config' ) ) {
|
||||
|
||||
if ( ! isset( $tab['default_privacy'] ) ) {
|
||||
$this->settings_defaults[ 'profile_tab_' . $id . '_privacy' ] = 0;
|
||||
$this->settings_defaults[ 'profile_tab_' . $id . '_roles' ] = '';
|
||||
$this->settings_defaults[ 'profile_tab_' . $id . '_roles' ] = '';
|
||||
}
|
||||
}
|
||||
|
||||
foreach ( $this->email_notifications as $key => $notification ) {
|
||||
$this->settings_defaults[ $key . '_on' ] = ! empty( $notification['default_active'] );
|
||||
$this->settings_defaults[ $key . '_on' ] = ! empty( $notification['default_active'] );
|
||||
$this->settings_defaults[ $key . '_sub' ] = $notification['subject'];
|
||||
$this->settings_defaults[ $key ] = $notification['body'];
|
||||
$this->settings_defaults[ $key ] = $notification['body'];
|
||||
}
|
||||
|
||||
foreach ( $this->core_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 );
|
||||
|
||||
$this->settings_defaults[ $page_id ] = '';
|
||||
}
|
||||
|
||||
foreach( $this->core_form_meta_all as $key => $value ) {
|
||||
foreach ( $this->core_form_meta_all as $key => $value ) {
|
||||
$this->settings_defaults[ str_replace( '_um_', '', $key ) ] = $value;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
@@ -665,126 +661,86 @@ if ( ! class_exists( 'um\Config' ) ) {
|
||||
|
||||
$this->permalinks = $this->get_core_pages();
|
||||
|
||||
|
||||
|
||||
$this->default_roles_metadata = array(
|
||||
/*
|
||||
* All caps map
|
||||
*
|
||||
* '_um_can_access_wpadmin' => 1,
|
||||
'_um_can_not_see_adminbar' => 0,
|
||||
'_um_can_edit_everyone' => 1,
|
||||
'_um_can_edit_roles' => '',
|
||||
'_um_can_delete_everyone' => 1,
|
||||
'_um_can_delete_roles' => '',
|
||||
'_um_after_delete' => '',
|
||||
'_um_delete_redirect_url' => '',
|
||||
'_um_can_edit_profile' => 1,
|
||||
'_um_can_delete_profile' => 1,
|
||||
'_um_default_homepage' => 1,
|
||||
'_um_redirect_homepage' => '',
|
||||
'_um_after_login' => 'redirect_admin',
|
||||
'_um_login_redirect_url' => '',
|
||||
'_um_after_logout' => 'redirect_home',
|
||||
'_um_logout_redirect_url' => '',
|
||||
'_um_can_view_all' => 1,
|
||||
'_um_can_view_roles' => '',
|
||||
'_um_can_make_private_profile' => 1,
|
||||
'_um_can_access_private_profile' => 1,
|
||||
'_um_status' => 'approved',
|
||||
'_um_auto_approve_act' => 'redirect_profile',
|
||||
'_um_auto_approve_url' => '',
|
||||
'_um_login_email_activate' => '',
|
||||
'_um_checkmail_action' => '',
|
||||
'_um_checkmail_message' => '',
|
||||
'_um_checkmail_url' => '',
|
||||
'_um_url_email_activate' => '',
|
||||
'_um_pending_action' => '',
|
||||
'_um_pending_message' => '',
|
||||
'_um_pending_url' => '',
|
||||
*
|
||||
* */
|
||||
|
||||
|
||||
'subscriber' => array(
|
||||
'_um_can_access_wpadmin' => 0,
|
||||
'_um_can_not_see_adminbar' => 1,
|
||||
'_um_can_edit_everyone' => 0,
|
||||
'_um_can_delete_everyone' => 0,
|
||||
'_um_can_edit_profile' => 1,
|
||||
'_um_can_delete_profile' => 1,
|
||||
'_um_after_login' => 'redirect_profile',
|
||||
'_um_after_logout' => 'redirect_home',
|
||||
'_um_default_homepage' => 1,
|
||||
'_um_can_view_all' => 1,
|
||||
'_um_can_make_private_profile' => 0,
|
||||
'_um_can_access_private_profile' => 0,
|
||||
'_um_status' => 'approved',
|
||||
'_um_auto_approve_act' => 'redirect_profile',
|
||||
'subscriber' => array(
|
||||
'_um_can_access_wpadmin' => 0,
|
||||
'_um_can_not_see_adminbar' => 1,
|
||||
'_um_can_edit_everyone' => 0,
|
||||
'_um_can_delete_everyone' => 0,
|
||||
'_um_can_edit_profile' => 1,
|
||||
'_um_can_delete_profile' => 1,
|
||||
'_um_after_login' => 'redirect_profile',
|
||||
'_um_after_logout' => 'redirect_home',
|
||||
'_um_default_homepage' => 1,
|
||||
'_um_can_view_all' => 1,
|
||||
'_um_can_make_private_profile' => 0,
|
||||
'_um_can_access_private_profile' => 0,
|
||||
'_um_status' => 'approved',
|
||||
'_um_auto_approve_act' => 'redirect_profile',
|
||||
),
|
||||
'author' => array(
|
||||
'_um_can_access_wpadmin' => 0,
|
||||
'_um_can_not_see_adminbar' => 1,
|
||||
'_um_can_edit_everyone' => 0,
|
||||
'_um_can_delete_everyone' => 0,
|
||||
'_um_can_edit_profile' => 1,
|
||||
'_um_can_delete_profile' => 1,
|
||||
'_um_after_login' => 'redirect_profile',
|
||||
'_um_after_logout' => 'redirect_home',
|
||||
'_um_default_homepage' => 1,
|
||||
'_um_can_view_all' => 1,
|
||||
'_um_can_make_private_profile' => 0,
|
||||
'_um_can_access_private_profile' => 0,
|
||||
'_um_status' => 'approved',
|
||||
'_um_auto_approve_act' => 'redirect_profile',
|
||||
'author' => array(
|
||||
'_um_can_access_wpadmin' => 0,
|
||||
'_um_can_not_see_adminbar' => 1,
|
||||
'_um_can_edit_everyone' => 0,
|
||||
'_um_can_delete_everyone' => 0,
|
||||
'_um_can_edit_profile' => 1,
|
||||
'_um_can_delete_profile' => 1,
|
||||
'_um_after_login' => 'redirect_profile',
|
||||
'_um_after_logout' => 'redirect_home',
|
||||
'_um_default_homepage' => 1,
|
||||
'_um_can_view_all' => 1,
|
||||
'_um_can_make_private_profile' => 0,
|
||||
'_um_can_access_private_profile' => 0,
|
||||
'_um_status' => 'approved',
|
||||
'_um_auto_approve_act' => 'redirect_profile',
|
||||
),
|
||||
'contributor' => array(
|
||||
'_um_can_access_wpadmin' => 0,
|
||||
'_um_can_not_see_adminbar' => 1,
|
||||
'_um_can_edit_everyone' => 0,
|
||||
'_um_can_delete_everyone' => 0,
|
||||
'_um_can_edit_profile' => 1,
|
||||
'_um_can_delete_profile' => 1,
|
||||
'_um_after_login' => 'redirect_profile',
|
||||
'_um_after_logout' => 'redirect_home',
|
||||
'_um_default_homepage' => 1,
|
||||
'_um_can_view_all' => 1,
|
||||
'_um_can_make_private_profile' => 0,
|
||||
'_um_can_access_private_profile' => 0,
|
||||
'_um_status' => 'approved',
|
||||
'_um_auto_approve_act' => 'redirect_profile',
|
||||
'contributor' => array(
|
||||
'_um_can_access_wpadmin' => 0,
|
||||
'_um_can_not_see_adminbar' => 1,
|
||||
'_um_can_edit_everyone' => 0,
|
||||
'_um_can_delete_everyone' => 0,
|
||||
'_um_can_edit_profile' => 1,
|
||||
'_um_can_delete_profile' => 1,
|
||||
'_um_after_login' => 'redirect_profile',
|
||||
'_um_after_logout' => 'redirect_home',
|
||||
'_um_default_homepage' => 1,
|
||||
'_um_can_view_all' => 1,
|
||||
'_um_can_make_private_profile' => 0,
|
||||
'_um_can_access_private_profile' => 0,
|
||||
'_um_status' => 'approved',
|
||||
'_um_auto_approve_act' => 'redirect_profile',
|
||||
),
|
||||
'editor' => array(
|
||||
'_um_can_access_wpadmin' => 0,
|
||||
'_um_can_not_see_adminbar' => 1,
|
||||
'_um_can_edit_everyone' => 0,
|
||||
'_um_can_delete_everyone' => 0,
|
||||
'_um_can_edit_profile' => 1,
|
||||
'_um_can_delete_profile' => 1,
|
||||
'_um_after_login' => 'redirect_profile',
|
||||
'_um_after_logout' => 'redirect_home',
|
||||
'_um_default_homepage' => 1,
|
||||
'_um_can_view_all' => 1,
|
||||
'_um_can_make_private_profile' => 0,
|
||||
'_um_can_access_private_profile' => 0,
|
||||
'_um_status' => 'approved',
|
||||
'_um_auto_approve_act' => 'redirect_profile',
|
||||
'editor' => array(
|
||||
'_um_can_access_wpadmin' => 0,
|
||||
'_um_can_not_see_adminbar' => 1,
|
||||
'_um_can_edit_everyone' => 0,
|
||||
'_um_can_delete_everyone' => 0,
|
||||
'_um_can_edit_profile' => 1,
|
||||
'_um_can_delete_profile' => 1,
|
||||
'_um_after_login' => 'redirect_profile',
|
||||
'_um_after_logout' => 'redirect_home',
|
||||
'_um_default_homepage' => 1,
|
||||
'_um_can_view_all' => 1,
|
||||
'_um_can_make_private_profile' => 0,
|
||||
'_um_can_access_private_profile' => 0,
|
||||
'_um_status' => 'approved',
|
||||
'_um_auto_approve_act' => 'redirect_profile',
|
||||
),
|
||||
'administrator' => array(
|
||||
'_um_can_access_wpadmin' => 1,
|
||||
'_um_can_not_see_adminbar' => 0,
|
||||
'_um_can_edit_everyone' => 1,
|
||||
'_um_can_delete_everyone' => 1,
|
||||
'_um_can_edit_profile' => 1,
|
||||
'_um_can_delete_profile' => 1,
|
||||
'_um_default_homepage' => 1,
|
||||
'_um_after_login' => 'redirect_admin',
|
||||
'_um_after_logout' => 'redirect_home',
|
||||
'_um_can_view_all' => 1,
|
||||
'_um_can_make_private_profile' => 1,
|
||||
'_um_can_access_private_profile' => 1,
|
||||
'_um_status' => 'approved',
|
||||
'_um_auto_approve_act' => 'redirect_profile',
|
||||
'_um_can_access_wpadmin' => 1,
|
||||
'_um_can_not_see_adminbar' => 0,
|
||||
'_um_can_edit_everyone' => 1,
|
||||
'_um_can_delete_everyone' => 1,
|
||||
'_um_can_edit_profile' => 1,
|
||||
'_um_can_delete_profile' => 1,
|
||||
'_um_default_homepage' => 1,
|
||||
'_um_after_login' => 'redirect_admin',
|
||||
'_um_after_logout' => 'redirect_home',
|
||||
'_um_can_view_all' => 1,
|
||||
'_um_can_make_private_profile' => 1,
|
||||
'_um_can_access_private_profile' => 1,
|
||||
'_um_status' => 'approved',
|
||||
'_um_auto_approve_act' => 'redirect_profile',
|
||||
),
|
||||
);
|
||||
|
||||
@@ -812,7 +768,6 @@ if ( ! class_exists( 'um\Config' ) ) {
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get UM Pages
|
||||
*
|
||||
@@ -826,27 +781,41 @@ if ( ! class_exists( 'um\Config' ) ) {
|
||||
}
|
||||
|
||||
foreach ( $core_pages as $page_key ) {
|
||||
$page_option_key = UM()->options()->get_core_page_id( $page_key );
|
||||
$page_option_key = UM()->options()->get_predefined_page_option_key( $page_key );
|
||||
$permalink[ $page_key ] = UM()->options()->get( $page_option_key );
|
||||
}
|
||||
|
||||
return $permalink;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @todo make config class not cycled
|
||||
*/
|
||||
function set_core_page() {
|
||||
$this->core_pages = apply_filters( 'um_core_pages', array(
|
||||
'user' => array( 'title' => __( 'User', 'ultimate-member' ) ),
|
||||
'login' => array( 'title' => __( 'Login', 'ultimate-member' ) ),
|
||||
'register' => array( 'title' => __( 'Register', 'ultimate-member' ) ),
|
||||
'members' => array( 'title' => __( 'Members', 'ultimate-member' ) ),
|
||||
'logout' => array( 'title' => __( 'Logout', 'ultimate-member' ) ),
|
||||
'account' => array( 'title' => __( 'Account', 'ultimate-member' ) ),
|
||||
'password-reset' => array( 'title' => __( 'Password Reset', 'ultimate-member' ) ),
|
||||
) );
|
||||
public function set_core_page() {
|
||||
$this->core_pages = array(
|
||||
'user' => array(
|
||||
'title' => __( 'User', 'ultimate-member' ),
|
||||
),
|
||||
'login' => array(
|
||||
'title' => __( 'Login', 'ultimate-member' ),
|
||||
),
|
||||
'register' => array(
|
||||
'title' => __( 'Register', 'ultimate-member' ),
|
||||
),
|
||||
'members' => array(
|
||||
'title' => __( 'Members', 'ultimate-member' ),
|
||||
),
|
||||
'logout' => array(
|
||||
'title' => __( 'Logout', 'ultimate-member' ),
|
||||
),
|
||||
'account' => array(
|
||||
'title' => __( 'Account', 'ultimate-member' ),
|
||||
),
|
||||
'password-reset' => array(
|
||||
'title' => __( 'Password Reset', 'ultimate-member' ),
|
||||
),
|
||||
);
|
||||
$this->core_pages = apply_filters( 'um_core_pages', $this->core_pages );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -872,13 +841,15 @@ if ( ! class_exists( 'um\Config' ) ) {
|
||||
*/
|
||||
public function init_predefined_pages() {
|
||||
$core_forms = get_option( 'um_core_forms', array() );
|
||||
$core_directories = get_option( 'um_core_directories', array() );
|
||||
$setup_shortcodes = array_merge(
|
||||
array(
|
||||
'profile' => '',
|
||||
'login' => '',
|
||||
'register' => '',
|
||||
'members' => '',
|
||||
),
|
||||
$core_forms
|
||||
array_merge( $core_forms, $core_directories )
|
||||
);
|
||||
|
||||
$this->predefined_pages = array(
|
||||
@@ -894,6 +865,10 @@ if ( ! class_exists( 'um\Config' ) ) {
|
||||
'title' => __( 'Register', 'ultimate-member' ),
|
||||
'content' => ! empty( $setup_shortcodes['register'] ) ? '[ultimatemember form_id="' . $setup_shortcodes['register'] . '"]' : '',
|
||||
),
|
||||
'members' => array(
|
||||
'title' => __( 'Members', 'ultimate-member' ),
|
||||
'content' => ! empty( $setup_shortcodes['members'] ) ? '[ultimatemember form_id="' . $setup_shortcodes['members'] . '"]' : '',
|
||||
),
|
||||
'logout' => array(
|
||||
'title' => __( 'Logout', 'ultimate-member' ),
|
||||
'content' => '',
|
||||
@@ -921,7 +896,7 @@ if ( ! class_exists( 'um\Config' ) ) {
|
||||
* @example <caption>Extend UM core pages.</caption>
|
||||
* function my_predefined_pages( $pages ) {
|
||||
* // your code here
|
||||
* $pages['my_page_key'] = array( 'title' => __( 'My Page Title', 'my-translate-key' ) );
|
||||
* $pages['my_page_key'] = array( 'title' => __( 'My Page Title', 'my-translate-key' ), 'content' => 'my-page-predefined-content' );
|
||||
* return $pages;
|
||||
* }
|
||||
* add_filter( 'um_predefined_pages', 'my_predefined_pages' );
|
||||
|
||||
+20
-72
@@ -235,93 +235,41 @@ if ( ! class_exists( 'UM' ) ) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Loading UM textdomain
|
||||
* Loading UM textdomain.
|
||||
*
|
||||
* 'ultimate-member' by default
|
||||
* Note: 'ultimate-member' is a default textdomain.
|
||||
*
|
||||
* @since 2.8.5 WordPress native functions are used to make this function clear.
|
||||
*/
|
||||
public function localize() {
|
||||
// The function `get_user_locale()` will return `get_locale()` result by default if user or its locale is empty.
|
||||
$language_locale = get_user_locale();
|
||||
|
||||
$default_domain = dirname( plugin_basename( UM_PLUGIN ) );
|
||||
/**
|
||||
* UM hook
|
||||
* Filters the plugin's textdomain.
|
||||
*
|
||||
* @type filter
|
||||
* @title um_language_locale
|
||||
* @description Change UM language locale
|
||||
* @input_vars
|
||||
* [{"var":"$locale","type":"string","desc":"UM language locale"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_language_locale', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_language_locale', 'my_language_locale', 10, 1 );
|
||||
* function my_language_locale( $locale ) {
|
||||
* // your code here
|
||||
* return $locale;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$language_locale = apply_filters( 'um_language_locale', $language_locale );
|
||||
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
* @param {string} $domain Plugin's textdomain.
|
||||
*
|
||||
* @type filter
|
||||
* @title um_language_textdomain
|
||||
* @description Change UM textdomain
|
||||
* @input_vars
|
||||
* [{"var":"$domain","type":"string","desc":"UM Textdomain"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_language_textdomain', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_language_textdomain', 'my_textdomain', 10, 1 );
|
||||
* function my_textdomain( $domain ) {
|
||||
* // your code here
|
||||
* @return {string} Maybe changed plugin's textdomain.
|
||||
*
|
||||
* @since 1.3.x
|
||||
* @hook um_language_textdomain
|
||||
*
|
||||
* @example <caption>Change UM language locale.</caption>
|
||||
* function my_um_language_textdomain( $domain ) {
|
||||
* $domain = 'ultimate-member-custom';
|
||||
* return $domain;
|
||||
* }
|
||||
* ?>
|
||||
* add_filter( 'um_language_textdomain', 'my_um_language_textdomain' );
|
||||
*/
|
||||
$language_domain = apply_filters( 'um_language_textdomain', 'ultimate-member' );
|
||||
|
||||
$language_file = WP_LANG_DIR . '/plugins/' . $language_domain . '-' . $language_locale . '.mo';
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
* @type filter
|
||||
* @title um_language_file
|
||||
* @description Change UM language file path
|
||||
* @input_vars
|
||||
* [{"var":"$language_file","type":"string","desc":"UM language file path"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage add_filter( 'um_language_file', 'function_name', 10, 1 );
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_language_file', 'my_language_file', 10, 1 );
|
||||
* function my_language_file( $language_file ) {
|
||||
* // your code here
|
||||
* return $language_file;
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
$language_file = apply_filters( 'um_language_file', $language_file );
|
||||
$domain = apply_filters( 'um_language_textdomain', $default_domain );
|
||||
|
||||
// Unload textdomain if it has already loaded.
|
||||
if ( is_textdomain_loaded( $language_domain ) ) {
|
||||
unload_textdomain( $language_domain, true );
|
||||
if ( is_textdomain_loaded( $domain ) ) {
|
||||
unload_textdomain( $domain, true );
|
||||
}
|
||||
load_textdomain( $language_domain, $language_file );
|
||||
load_plugin_textdomain( $domain, false, $default_domain . '/languages' );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 1.3.x active extensions deactivate for properly running 2.0.x AJAX upgrades
|
||||
*/
|
||||
|
||||
@@ -24,6 +24,7 @@ if ( ! class_exists( 'um\common\Init' ) ) {
|
||||
$this->screen();
|
||||
$this->secure()->hooks();
|
||||
$this->site_health();
|
||||
$this->theme()->hooks();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -73,5 +74,17 @@ if ( ! class_exists( 'um\common\Init' ) ) {
|
||||
}
|
||||
return UM()->classes['um\common\site_health'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 2.8.3
|
||||
*
|
||||
* @return Theme
|
||||
*/
|
||||
public function theme() {
|
||||
if ( empty( UM()->classes['um\common\theme'] ) ) {
|
||||
UM()->classes['um\common\theme'] = new Theme();
|
||||
}
|
||||
return UM()->classes['um\common\theme'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ if ( ! class_exists( 'um\common\Screen' ) ) {
|
||||
* Screen constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
add_filter( 'body_class', array( &$this, 'remove_admin_bar' ), 1000, 1 );
|
||||
add_filter( 'body_class', array( &$this, 'remove_admin_bar' ), 1000 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,242 @@
|
||||
<?php
|
||||
namespace um\common;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Class Theme
|
||||
*
|
||||
* @package um\common
|
||||
*/
|
||||
class Theme {
|
||||
|
||||
public function hooks() {
|
||||
add_action( 'after_switch_theme', array( &$this, 'flush_transient_templates_data' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Find outdated UM templates and notify Administrator.
|
||||
*
|
||||
*/
|
||||
public function flush_transient_templates_data() {
|
||||
// Flush transient with the custom templates list.
|
||||
delete_transient( 'um_custom_templates_list' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Scan the template files.
|
||||
*
|
||||
* @param string $template_path Path to the template directory.
|
||||
* @return array
|
||||
*/
|
||||
public static function scan_template_files( $template_path ) {
|
||||
$files = @scandir( $template_path ); // @codingStandardsIgnoreLine.
|
||||
$result = array();
|
||||
|
||||
if ( ! empty( $files ) ) {
|
||||
|
||||
foreach ( $files as $value ) {
|
||||
|
||||
if ( ! in_array( $value, array( '.', '..' ), true ) ) {
|
||||
|
||||
if ( is_dir( $template_path . DIRECTORY_SEPARATOR . $value ) ) {
|
||||
$sub_files = self::scan_template_files( $template_path . DIRECTORY_SEPARATOR . $value );
|
||||
foreach ( $sub_files as $sub_file ) {
|
||||
$result[] = $value . DIRECTORY_SEPARATOR . $sub_file;
|
||||
}
|
||||
} else {
|
||||
$result[] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
public static function get_all_templates() {
|
||||
$scan_files['um'] = self::scan_template_files( UM_PATH . '/templates/' );
|
||||
/**
|
||||
* Filters an array of the template files for scanning versions.
|
||||
*
|
||||
* @since 2.6.1
|
||||
* @hook um_override_templates_scan_files
|
||||
*
|
||||
* @param {array} $scan_files Template files for scanning versions.
|
||||
*
|
||||
* @return {array} Template files for scanning versions.
|
||||
*/
|
||||
return apply_filters( 'um_override_templates_scan_files', $scan_files );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $file string
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_file_version( $file ) {
|
||||
// Avoid notices if file does not exist.
|
||||
if ( ! file_exists( $file ) ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
// We don't need to write to the file, so just open for reading.
|
||||
$fp = fopen( $file, 'r' ); // @codingStandardsIgnoreLine.
|
||||
|
||||
// Pull only the first 8kiB of the file in.
|
||||
$file_data = fread( $fp, 8192 ); // @codingStandardsIgnoreLine.
|
||||
|
||||
// PHP will close a file handle, but we are good citizens.
|
||||
fclose( $fp ); // @codingStandardsIgnoreLine.
|
||||
|
||||
// Make sure we catch CR-only line endings.
|
||||
$file_data = str_replace( "\r", "\n", $file_data );
|
||||
$version = '';
|
||||
|
||||
if ( preg_match( '/^[ \t\/*#@]*' . preg_quote( '@version', '/' ) . '(.*)$/mi', $file_data, $match ) && $match[1] ) {
|
||||
$version = _cleanup_header_comment( $match[1] );
|
||||
}
|
||||
|
||||
return $version;
|
||||
}
|
||||
|
||||
public function get_custom_templates_list() {
|
||||
$files_in_theme = array();
|
||||
$scan_files = self::get_all_templates();
|
||||
foreach ( $scan_files as $key => $files ) {
|
||||
foreach ( $files as $file ) {
|
||||
if ( false === strpos( $file, 'email/' ) ) {
|
||||
/**
|
||||
* Filters an array of the template files for scanning versions based on $key.
|
||||
*
|
||||
* Note: $key - means um or extension key.
|
||||
*
|
||||
* @since 2.6.1
|
||||
* @hook um_override_templates_get_template_path__{$key}
|
||||
*
|
||||
* @param {array} $located Template file paths for scanning versions.
|
||||
* @param {string} $file Template file name.
|
||||
*
|
||||
* @return {array} Template file paths for scanning versions.
|
||||
*/
|
||||
$located = apply_filters( "um_override_templates_get_template_path__{$key}", array(), $file );
|
||||
|
||||
$exceptions = array(
|
||||
'members-grid.php',
|
||||
'members-header.php',
|
||||
'members-list.php',
|
||||
'members-pagination.php',
|
||||
'searchform.php',
|
||||
'login-to-view.php',
|
||||
'profile/comments.php',
|
||||
'profile/comments-single.php',
|
||||
'profile/posts.php',
|
||||
'profile/posts-single.php',
|
||||
'modal/um_upload_single.php',
|
||||
'modal/um_view_photo.php',
|
||||
);
|
||||
|
||||
$theme_file = false;
|
||||
if ( ! empty( $located ) ) {
|
||||
$theme_file = $located['theme'];
|
||||
} elseif ( in_array( $file, $exceptions, true ) && file_exists( get_stylesheet_directory() . '/ultimate-member/' . $file ) ) {
|
||||
$theme_file = get_stylesheet_directory() . '/ultimate-member/' . $file;
|
||||
} elseif ( file_exists( get_stylesheet_directory() . '/ultimate-member/templates/' . $file ) ) {
|
||||
$theme_file = get_stylesheet_directory() . '/ultimate-member/templates/' . $file;
|
||||
}
|
||||
|
||||
if ( ! empty( $theme_file ) ) {
|
||||
if ( ! empty( $located ) ) {
|
||||
$core_path = $located['core'];
|
||||
} else {
|
||||
$core_path = UM_PATH . 'templates/' . $file;
|
||||
}
|
||||
|
||||
$files_in_theme[] = array(
|
||||
'core' => $core_path,
|
||||
'theme' => $theme_file,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $files_in_theme;
|
||||
}
|
||||
|
||||
public function is_outdated_template_exist() {
|
||||
$outdated_exists = false;
|
||||
$templates = $this->get_custom_templates_list();
|
||||
foreach ( $templates as $files ) {
|
||||
if ( ! array_key_exists( 'core', $files ) || ! array_key_exists( 'theme', $files ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$core_path = $files['core'];
|
||||
$theme_file = $files['theme'];
|
||||
|
||||
$core_version = self::get_file_version( $core_path );
|
||||
$theme_version = self::get_file_version( $theme_file );
|
||||
|
||||
if ( '' === $theme_version || version_compare( $theme_version, $core_version, '<' ) ) {
|
||||
$outdated_exists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $outdated_exists;
|
||||
}
|
||||
|
||||
public function build_templates_data() {
|
||||
$templates_data = array();
|
||||
|
||||
// Get from cache if isn't empty and request isn't force.
|
||||
$transient = get_transient( 'um_custom_templates_list' );
|
||||
if ( false !== $transient && array_key_exists( 'data', $transient ) ) {
|
||||
return $transient['data'];
|
||||
}
|
||||
|
||||
$templates = $this->get_custom_templates_list();
|
||||
foreach ( $templates as $files ) {
|
||||
if ( ! array_key_exists( 'core', $files ) || ! array_key_exists( 'theme', $files ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$core_path = $files['core'];
|
||||
$theme_file = $files['theme'];
|
||||
|
||||
$core_version = self::get_file_version( $core_path );
|
||||
$theme_version = self::get_file_version( $theme_file );
|
||||
|
||||
$status = esc_html__( 'Theme version up to date', 'ultimate-member' );
|
||||
$status_code = 1;
|
||||
|
||||
if ( '' === $theme_version ) {
|
||||
$status = esc_html__( 'Theme version is empty', 'ultimate-member' );
|
||||
$status_code = 0;
|
||||
} elseif ( version_compare( $theme_version, $core_version, '<' ) ) {
|
||||
$status = esc_html__( 'Theme version is out of date', 'ultimate-member' );
|
||||
$status_code = 0;
|
||||
}
|
||||
|
||||
$templates_data[] = array(
|
||||
'core_version' => $core_version,
|
||||
'theme_version' => $theme_version,
|
||||
'core_file' => stristr( $core_path, 'wp-content' ),
|
||||
'theme_file' => stristr( $theme_file, 'wp-content' ),
|
||||
'status' => $status,
|
||||
'status_code' => $status_code,
|
||||
);
|
||||
}
|
||||
|
||||
// Cache results via transient setting.
|
||||
$transient = array(
|
||||
'data' => $templates_data,
|
||||
'time' => time(),
|
||||
);
|
||||
set_transient( 'um_custom_templates_list', $transient, 5 * MINUTE_IN_SECONDS );
|
||||
|
||||
return $templates_data;
|
||||
}
|
||||
}
|
||||
@@ -1772,10 +1772,10 @@ if ( ! class_exists( 'um\core\Access' ) ) {
|
||||
$access = UM()->options()->get( 'accessible' );
|
||||
|
||||
if ( $access == 2 ) {
|
||||
//global settings for accessible home page
|
||||
// Global settings for accessible home page
|
||||
$home_page_accessible = UM()->options()->get( 'home_page_accessible' );
|
||||
|
||||
if ( $home_page_accessible == 0 ) {
|
||||
if ( ! $home_page_accessible ) {
|
||||
//get redirect URL if not set get login page by default
|
||||
$redirect = UM()->options()->get( 'access_redirect' );
|
||||
if ( ! $redirect ) {
|
||||
@@ -1795,9 +1795,9 @@ if ( ! class_exists( 'um\core\Access' ) ) {
|
||||
$access = UM()->options()->get( 'accessible' );
|
||||
|
||||
if ( $access == 2 ) {
|
||||
//global settings for accessible home page
|
||||
// Global settings for accessible home page
|
||||
$category_page_accessible = UM()->options()->get( 'category_page_accessible' );
|
||||
if ( $category_page_accessible == 0 ) {
|
||||
if ( ! $category_page_accessible ) {
|
||||
//get redirect URL if not set get login page by default
|
||||
$redirect = UM()->options()->get( 'access_redirect' );
|
||||
if ( ! $redirect ) {
|
||||
|
||||
@@ -576,7 +576,7 @@ if ( ! class_exists( 'um\core\Account' ) ) {
|
||||
|
||||
case 'privacy':
|
||||
|
||||
$args = 'profile_privacy,profile_noindex,hide_in_members';
|
||||
$args = 'profile_privacy,profile_noindex,hide_in_members,um_show_last_login';
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
|
||||
@@ -273,7 +273,7 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
|
||||
),
|
||||
|
||||
'tel' => array(
|
||||
'name' => __( 'Telephone Box', 'ultimate-member' ),
|
||||
'name' => __( 'Telephone', 'ultimate-member' ),
|
||||
'col1' => array('_title','_metakey','_help','_default','_min_chars','_visibility'),
|
||||
'col2' => array('_label','_placeholder','_public','_roles','_validate','_custom_validate','_max_chars'),
|
||||
'col3' => array('_required','_editable','_icon'),
|
||||
@@ -782,10 +782,10 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
|
||||
),
|
||||
|
||||
'username' => array(
|
||||
'title' => __('Username or E-mail','ultimate-member'),
|
||||
'title' => __('Username or Email','ultimate-member'),
|
||||
'metakey' => 'username',
|
||||
'type' => 'text',
|
||||
'label' => __('Username or E-mail','ultimate-member'),
|
||||
'label' => __('Username or Email','ultimate-member'),
|
||||
'required' => 1,
|
||||
'public' => 1,
|
||||
'editable' => false,
|
||||
@@ -871,10 +871,10 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
|
||||
),
|
||||
|
||||
'user_email' => array(
|
||||
'title' => __('E-mail Address','ultimate-member'),
|
||||
'title' => __('Email Address','ultimate-member'),
|
||||
'metakey' => 'user_email',
|
||||
'type' => 'text',
|
||||
'label' => __('E-mail Address','ultimate-member'),
|
||||
'label' => __('Email Address','ultimate-member'),
|
||||
'required' => 0,
|
||||
'public' => 1,
|
||||
'validate' => 'unique_email',
|
||||
@@ -882,10 +882,10 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
|
||||
),
|
||||
|
||||
'secondary_user_email' => array(
|
||||
'title' => __('Secondary E-mail Address','ultimate-member'),
|
||||
'title' => __('Secondary Email Address','ultimate-member'),
|
||||
'metakey' => 'secondary_user_email',
|
||||
'type' => 'text',
|
||||
'label' => __('Secondary E-mail Address','ultimate-member'),
|
||||
'label' => __('Secondary Email Address','ultimate-member'),
|
||||
'required' => 0,
|
||||
'public' => 1,
|
||||
'editable' => true,
|
||||
@@ -1271,7 +1271,7 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
|
||||
),
|
||||
|
||||
'username_b' => array(
|
||||
'title' => __('Username or E-mail','ultimate-member'),
|
||||
'title' => __('Username or Email','ultimate-member'),
|
||||
'metakey' => 'username_b',
|
||||
'type' => 'text',
|
||||
'placeholder' => __('Enter your username or email','ultimate-member'),
|
||||
@@ -1336,6 +1336,23 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
|
||||
'required_opt' => array( 'members_page', true ),
|
||||
),
|
||||
|
||||
'um_show_last_login' => array(
|
||||
'title' => __( 'Show my last login?', 'ultimate-member' ),
|
||||
'metakey' => 'um_show_last_login',
|
||||
'type' => 'radio',
|
||||
'label' => __( 'Show my last login?', 'ultimate-member' ),
|
||||
'help' => __( 'Here you can hide last login field on profile page and card in member directory', 'ultimate-member' ),
|
||||
'required' => 0,
|
||||
'public' => 1,
|
||||
'editable' => true,
|
||||
'default' => 'yes',
|
||||
'options' => array(
|
||||
'no' => __( 'No', 'ultimate-member' ),
|
||||
'yes' => __( 'Yes', 'ultimate-member' ),
|
||||
),
|
||||
'account_only' => true,
|
||||
),
|
||||
|
||||
'delete_account' => array(
|
||||
'title' => __( 'Delete Account', 'ultimate-member' ),
|
||||
'metakey' => 'delete_account',
|
||||
@@ -1558,11 +1575,11 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
|
||||
$array['skype'] = __('Skype ID','ultimate-member');
|
||||
$array['soundcloud'] = __( 'SoundCloud Profile', 'ultimate-member' );
|
||||
$array['twitter_url'] = __( 'X (formerly Twitter) URL', 'ultimate-member' );
|
||||
$array['is_email'] = __('E-mail( Not Unique )','ultimate-member');
|
||||
$array['unique_email'] = __('Unique E-mail','ultimate-member');
|
||||
$array['is_email'] = __('Email( Not Unique )','ultimate-member');
|
||||
$array['unique_email'] = __('Unique Email','ultimate-member');
|
||||
$array['unique_value'] = __('Unique Metakey value','ultimate-member');
|
||||
$array['unique_username'] = __('Unique Username','ultimate-member');
|
||||
$array['unique_username_or_email'] = __('Unique Username/E-mail','ultimate-member');
|
||||
$array['unique_username_or_email'] = __('Unique Username/Email','ultimate-member');
|
||||
$array['url'] = __('Website URL','ultimate-member');
|
||||
$array['youtube_url'] = __('YouTube Profile','ultimate-member');
|
||||
$array['youtube_video'] = __('YouTube Video','ultimate-member');
|
||||
|
||||
@@ -604,7 +604,7 @@ if ( ! class_exists( 'um\core\External_Integrations' ) ) {
|
||||
*/
|
||||
function render_status_icon( $link, $text, $img ) {
|
||||
|
||||
$icon_html = '<a href="' . $link . '" title="' . $text . '">';
|
||||
$icon_html = '<a href="' . esc_url( $link ) . '" title="' . esc_attr( $text ) . '">';
|
||||
$icon_html .= '<img style="padding:1px;margin:2px;" border="0" src="'
|
||||
. ICL_PLUGIN_URL . '/res/img/'
|
||||
. $img . '" alt="'
|
||||
|
||||
@@ -623,7 +623,10 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
* @return string
|
||||
*/
|
||||
public function show_error( $key ) {
|
||||
return UM()->form()->errors[ $key ];
|
||||
if ( empty( UM()->form()->errors ) ) {
|
||||
return '';
|
||||
}
|
||||
return array_key_exists( $key, UM()->form()->errors ) ? UM()->form()->errors[ $key ] : '';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -634,7 +637,10 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
* @return string
|
||||
*/
|
||||
public function show_notice( $key ) {
|
||||
return UM()->form()->notices[ $key ];
|
||||
if ( empty( UM()->form()->notices ) ) {
|
||||
return '';
|
||||
}
|
||||
return array_key_exists( $key, UM()->form()->notices ) ? UM()->form()->notices[ $key ] : '';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -647,13 +653,6 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
* @return string
|
||||
*/
|
||||
public function field_label( $label, $key, $data ) {
|
||||
$output = null;
|
||||
$output .= '<div class="um-field-label">';
|
||||
|
||||
if ( ! empty( $data['icon'] ) && isset( $this->field_icons ) && 'off' !== $this->field_icons && ( 'label' === $this->field_icons || true === $this->viewing ) ) {
|
||||
$output .= '<div class="um-field-label-icon"><i class="' . esc_attr( $data['icon'] ) . '" aria-label="' . esc_attr( $label ) . '"></i></div>';
|
||||
}
|
||||
|
||||
if ( true === $this->viewing ) {
|
||||
/**
|
||||
* Filters Ultimate Member field label on the Profile form: View mode.
|
||||
@@ -724,13 +723,26 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
$label = apply_filters( 'um_edit_label_all_fields', $label, $data );
|
||||
}
|
||||
|
||||
$output = null;
|
||||
$output .= '<div class="um-field-label">';
|
||||
|
||||
if ( ! empty( $data['icon'] ) && isset( $this->field_icons ) && 'off' !== $this->field_icons && ( 'label' === $this->field_icons || true === $this->viewing ) ) {
|
||||
$output .= '<div class="um-field-label-icon"><i class="' . esc_attr( $data['icon'] ) . '" aria-label="' . esc_attr( $label ) . '"></i></div>';
|
||||
}
|
||||
|
||||
$fields_without_metakey = UM()->builtin()->get_fields_without_metakey();
|
||||
$for_attr = '';
|
||||
if ( ! in_array( $data['type'], $fields_without_metakey, true ) ) {
|
||||
$for_attr = ' for="' . esc_attr( $key . UM()->form()->form_suffix ) . '"';
|
||||
}
|
||||
|
||||
$output .= '<label' . $for_attr . '>' . __( $label, 'ultimate-member' ) . '</label>';
|
||||
$output .= '<label' . $for_attr . '>' . esc_html__( $label, 'ultimate-member' );
|
||||
|
||||
if ( ! empty( $data['required'] ) && UM()->options()->get( 'form_asterisk' ) ) {
|
||||
$output .= '<span class="um-req" title="' . esc_attr__( 'Required', 'ultimate-member' ) . '">*</span>';
|
||||
}
|
||||
|
||||
$output .= '</label>';
|
||||
|
||||
if ( ! empty( $data['help'] ) && false === $this->viewing && false === strpos( $key, 'confirm_user_pass' ) ) {
|
||||
if ( ! UM()->mobile()->isMobile() ) {
|
||||
@@ -3086,7 +3098,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
$fonticon = UM()->files()->get_fonticon_by_ext( $file_type['ext'] );
|
||||
|
||||
$output .= '<div class="um-single-fileinfo">';
|
||||
$output .= '<a href="' . esc_attr( $file_url ) . '" target="_blank">';
|
||||
$output .= '<a href="' . esc_url( $file_url ) . '" target="_blank">';
|
||||
$output .= '<span class="icon" style="background:' . esc_attr( $fonticon_bg ) . '"><i class="' . esc_attr( $fonticon ) . '"></i></span>';
|
||||
$output .= '<span class="filename">' . esc_html( $file_field_name ) . '</span>';
|
||||
$output .= '</a></div></div>';
|
||||
@@ -4272,6 +4284,14 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function view_field( $key, $data, $rule = false ) {
|
||||
if ( '_um_last_login' === $key ) {
|
||||
$profile_id = um_user( 'ID' );
|
||||
$show_last_login = get_user_meta( $profile_id, 'um_show_last_login', true );
|
||||
if ( ! empty( $show_last_login ) && 'no' === $show_last_login[0] ) {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
$output = '';
|
||||
|
||||
// Get whole field data.
|
||||
|
||||
@@ -351,8 +351,8 @@ if ( ! class_exists( 'um\core\Mail' ) ) {
|
||||
*/
|
||||
$message = apply_filters( 'um_email_send_message_content', $message, $slug, $args );
|
||||
|
||||
add_filter( 'um_template_tags_patterns_hook', array( &$this, 'add_placeholder' ) );
|
||||
add_filter( 'um_template_tags_replaces_hook', array( &$this, 'add_replace_placeholder' ) );
|
||||
// add_filter( 'um_template_tags_patterns_hook', array( &$this, 'add_placeholder' ) );
|
||||
// add_filter( 'um_template_tags_replaces_hook', array( &$this, 'add_replace_placeholder' ) );
|
||||
|
||||
// Convert tags in email template.
|
||||
return um_convert_tags( $message, $args );
|
||||
@@ -421,8 +421,8 @@ if ( ! class_exists( 'um\core\Mail' ) ) {
|
||||
$mail_from_addr = UM()->options()->get( 'mail_from_addr' ) ? UM()->options()->get( 'mail_from_addr' ) : get_bloginfo( 'admin_email' );
|
||||
$this->headers = 'From: ' . stripslashes( $mail_from ) . ' <' . $mail_from_addr . '>' . "\r\n";
|
||||
|
||||
add_filter( 'um_template_tags_patterns_hook', array( UM()->mail(), 'add_placeholder' ) );
|
||||
add_filter( 'um_template_tags_replaces_hook', array( UM()->mail(), 'add_replace_placeholder' ) );
|
||||
add_filter( 'um_template_tags_patterns_hook', array( $this, 'add_placeholder' ) );
|
||||
add_filter( 'um_template_tags_replaces_hook', array( $this, 'add_replace_placeholder' ) );
|
||||
|
||||
/**
|
||||
* Filters email notification subject.
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -58,7 +58,11 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
|
||||
|
||||
var $filter_types = array();
|
||||
|
||||
|
||||
/**
|
||||
* Fields used for searching from wp_users table.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
var $core_search_fields = array(
|
||||
'user_login',
|
||||
'user_url',
|
||||
@@ -67,6 +71,19 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
|
||||
'user_nicename',
|
||||
);
|
||||
|
||||
/**
|
||||
* Fields used for sorting from wp_users table.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
var $core_users_fields = array(
|
||||
'user_login',
|
||||
'user_url',
|
||||
'display_name',
|
||||
'user_email',
|
||||
'user_nicename',
|
||||
'user_registered',
|
||||
);
|
||||
|
||||
/**
|
||||
* @var
|
||||
@@ -408,7 +425,7 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
|
||||
'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' ),
|
||||
@@ -1314,24 +1331,24 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
|
||||
$this->query_args['paged'] = ! empty( $_POST['page'] ) ? absint( $_POST['page'] ) : 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add sorting attributes for \WP_Users_Query
|
||||
*
|
||||
* @param array $directory_data Member Directory options
|
||||
*/
|
||||
function sorting_query( $directory_data ) {
|
||||
public function sorting_query( $directory_data ) {
|
||||
// sort members by
|
||||
$this->query_args['order'] = 'ASC';
|
||||
|
||||
$sortby = ! empty( $_POST['sorting'] ) ? sanitize_text_field( $_POST['sorting'] ) : $directory_data['sortby'];
|
||||
$sortby = ( $sortby == 'other' ) ? $directory_data['sortby_custom'] : $sortby;
|
||||
$sortby = ( 'other' === $sortby ) ? $directory_data['sortby_custom'] : $sortby;
|
||||
|
||||
$custom_sort = array();
|
||||
if ( ! empty( $directory_data['sorting_fields'] ) ) {
|
||||
$sorting_fields = maybe_unserialize( $directory_data['sorting_fields'] );
|
||||
foreach ( $sorting_fields as $field ) {
|
||||
if ( is_array( $field ) ) {
|
||||
$field_keys = array_keys( $field );
|
||||
$field_keys = array_keys( $field );
|
||||
$custom_sort[] = $field_keys[0];
|
||||
}
|
||||
}
|
||||
@@ -1384,7 +1401,7 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
|
||||
$this->query_args['order'] = 'ASC';
|
||||
}
|
||||
|
||||
} elseif ( in_array( $sortby, array( 'last_name', 'first_name', 'nickname' ) ) ) {
|
||||
} elseif ( in_array( $sortby, array( 'last_name', 'first_name', 'nickname' ), true ) ) {
|
||||
|
||||
$this->query_args['meta_query'] = array_merge( $this->query_args['meta_query'], array( $sortby . '_c' => array(
|
||||
'key' => $sortby,
|
||||
@@ -1426,7 +1443,7 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
|
||||
$this->query_args['orderby'] = array( 'last_name_c' => 'ASC', 'first_name_c' => 'ASC' );
|
||||
unset( $this->query_args['order'] );
|
||||
|
||||
} elseif ( count( $numeric_sorting_keys ) && in_array( $sortby, $numeric_sorting_keys ) ) {
|
||||
} elseif ( count( $numeric_sorting_keys ) && in_array( $sortby, $numeric_sorting_keys, true ) ) {
|
||||
|
||||
$order = 'DESC';
|
||||
if ( strstr( $sortby, '_desc' ) ) {
|
||||
@@ -1458,18 +1475,23 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
|
||||
)
|
||||
);
|
||||
|
||||
$this->query_args['orderby'] = array( $sortby . '_ns' => $order, 'user_registered' => 'DESC' );
|
||||
$this->query_args['orderby'] = array(
|
||||
$sortby . '_ns' => $order,
|
||||
'user_registered' => 'DESC',
|
||||
);
|
||||
unset( $this->query_args['order'] );
|
||||
|
||||
} elseif ( ( ! empty( $directory_data['sortby_custom'] ) && $sortby == $directory_data['sortby_custom'] ) || in_array( $sortby, $custom_sort ) ) {
|
||||
} elseif ( ( ! empty( $directory_data['sortby_custom'] ) && $sortby === $directory_data['sortby_custom'] ) || in_array( $sortby, $custom_sort, true ) ) {
|
||||
$custom_sort_order = ! empty( $directory_data['sortby_custom_order'] ) ? $directory_data['sortby_custom_order'] : 'ASC';
|
||||
|
||||
$meta_query = new \WP_Meta_Query();
|
||||
$custom_sort_type = ! empty( $directory_data['sortby_custom_type'] ) ? $meta_query->get_cast_for_type( $directory_data['sortby_custom_type'] ) : 'CHAR';
|
||||
|
||||
if ( ! empty( $directory_data['sorting_fields'] ) ) {
|
||||
// phpcs:ignore WordPress.Security.NonceVerification -- already verified here
|
||||
$sorting = sanitize_text_field( $_POST['sorting'] );
|
||||
$sorting_fields = maybe_serialize( $directory_data['sorting_fields'] );
|
||||
$sorting_fields = maybe_unserialize( $directory_data['sorting_fields'] );
|
||||
|
||||
if ( ! empty( $sorting_fields ) && is_array( $sorting_fields ) ) {
|
||||
foreach ( $sorting_fields as $field ) {
|
||||
if ( isset( $field[ $sorting ] ) ) {
|
||||
@@ -1777,6 +1799,7 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
|
||||
* Handle filters request
|
||||
*/
|
||||
function filters( $directory_data ) {
|
||||
global $wpdb;
|
||||
//filters
|
||||
$filter_query = array();
|
||||
if ( ! empty( $directory_data['search_fields'] ) ) {
|
||||
@@ -1809,9 +1832,11 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/** This filter is documented in includes/core/class-member-directory-meta.php */
|
||||
$relation = apply_filters( 'um_members_directory_select_filter_relation', 'OR', $field );
|
||||
|
||||
switch ( $field ) {
|
||||
default:
|
||||
|
||||
$filter_type = $this->filter_types[ $field ];
|
||||
|
||||
/**
|
||||
@@ -1865,35 +1890,35 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
|
||||
|
||||
case 'select':
|
||||
if ( is_array( $value ) ) {
|
||||
$field_query = array( 'relation' => 'OR' );
|
||||
$field_query = array( 'relation' => esc_sql( $relation ) );
|
||||
|
||||
foreach ( $value as $single_val ) {
|
||||
$single_val = trim( stripslashes( $single_val ) );
|
||||
|
||||
$arr_meta_query = array(
|
||||
array(
|
||||
'key' => $field,
|
||||
'value' => $single_val,
|
||||
'compare' => '=',
|
||||
'key' => $field,
|
||||
'value' => $single_val,
|
||||
'compare' => '=',
|
||||
),
|
||||
array(
|
||||
'key' => $field,
|
||||
'value' => serialize( (string) $single_val ),
|
||||
'compare' => 'LIKE',
|
||||
'key' => $field,
|
||||
'value' => serialize( (string) $single_val ),
|
||||
'compare' => 'LIKE',
|
||||
),
|
||||
array(
|
||||
'key' => $field,
|
||||
'value' => '"' . $single_val . '"',
|
||||
'compare' => 'LIKE',
|
||||
)
|
||||
'key' => $field,
|
||||
'value' => '"' . $single_val . '"',
|
||||
'compare' => 'LIKE',
|
||||
),
|
||||
);
|
||||
|
||||
if ( is_numeric( $single_val ) ) {
|
||||
|
||||
$arr_meta_query[] = array(
|
||||
'key' => $field,
|
||||
'value' => serialize( (int) $single_val ),
|
||||
'compare' => 'LIKE',
|
||||
'key' => $field,
|
||||
'value' => serialize( absint( $single_val ) ),
|
||||
'compare' => 'LIKE',
|
||||
);
|
||||
|
||||
}
|
||||
@@ -1967,26 +1992,39 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
|
||||
if ( ! empty( $field_query ) && $field_query !== true ) {
|
||||
$this->query_args['meta_query'] = array_merge( $this->query_args['meta_query'], array( $field_query ) );
|
||||
}
|
||||
|
||||
break;
|
||||
case 'role':
|
||||
$value = array_map( 'strtolower', $value );
|
||||
|
||||
if ( ! empty( $this->query_args['role__in'] ) ) {
|
||||
$this->query_args['role__in'] = is_array( $this->query_args['role__in'] ) ? $this->query_args['role__in'] : array( $this->query_args['role__in'] );
|
||||
$default_role = array_intersect( $this->query_args['role__in'], $value );
|
||||
$um_role = array_diff( $value, $default_role );
|
||||
|
||||
foreach ( $um_role as $key => &$val ) {
|
||||
$val = 'um_' . str_replace( ' ', '-', $val );
|
||||
if ( 'OR' !== $relation ) {
|
||||
$role__in_clauses = array( 'relation' => $relation );
|
||||
foreach ( $value as $role ) {
|
||||
$role__in_clauses[] = array(
|
||||
'key' => $wpdb->get_blog_prefix() . 'capabilities',
|
||||
'value' => '"' . $role . '"',
|
||||
'compare' => 'LIKE',
|
||||
);
|
||||
}
|
||||
$this->query_args['role__in'] = array_merge( $default_role, $um_role );
|
||||
|
||||
$this->query_args['meta_query'] = array_merge( $this->query_args['meta_query'], array( $role__in_clauses ) );
|
||||
|
||||
$this->custom_filters_in_query[ $field ] = $value;
|
||||
} else {
|
||||
$this->query_args['role__in'] = $value;
|
||||
};
|
||||
if ( ! empty( $this->query_args['role__in'] ) ) {
|
||||
$this->query_args['role__in'] = is_array( $this->query_args['role__in'] ) ? $this->query_args['role__in'] : array( $this->query_args['role__in'] );
|
||||
$default_role = array_intersect( $this->query_args['role__in'], $value );
|
||||
$um_role = array_diff( $value, $default_role );
|
||||
|
||||
$this->custom_filters_in_query[ $field ] = $this->query_args['role__in'];
|
||||
foreach ( $um_role as $key => &$val ) {
|
||||
$val = 'um_' . str_replace( ' ', '-', $val );
|
||||
}
|
||||
$this->query_args['role__in'] = array_merge( $default_role, $um_role );
|
||||
} else {
|
||||
$this->query_args['role__in'] = $value;
|
||||
}
|
||||
|
||||
$this->custom_filters_in_query[ $field ] = $this->query_args['role__in'];
|
||||
}
|
||||
break;
|
||||
case 'birth_date':
|
||||
$from_date = date( 'Y/m/d', mktime( 0,0,0, date( 'm', time() ), date( 'd', time() ), date( 'Y', time() - min( $value ) * YEAR_IN_SECONDS ) ) );
|
||||
@@ -2008,7 +2046,6 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
|
||||
|
||||
break;
|
||||
case 'user_registered':
|
||||
|
||||
$offset = 0;
|
||||
if ( isset( $_POST['gmt_offset'] ) && is_numeric( $_POST['gmt_offset'] ) ) {
|
||||
$offset = (int) $_POST['gmt_offset'];
|
||||
@@ -2044,6 +2081,7 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
|
||||
$from_date = (int) min( $value ) + ( $offset * HOUR_IN_SECONDS ); // client time zone offset
|
||||
$to_date = (int) max( $value ) + ( $offset * HOUR_IN_SECONDS ) + DAY_IN_SECONDS - 1; // time 23:59
|
||||
$meta_query = array(
|
||||
'relation' => 'AND',
|
||||
array(
|
||||
'key' => '_um_last_login',
|
||||
'value' => array( gmdate( 'Y-m-d H:i:s', $from_date ), gmdate( 'Y-m-d H:i:s', $to_date ) ),
|
||||
@@ -2051,12 +2089,54 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
|
||||
'inclusive' => true,
|
||||
'type' => 'DATETIME',
|
||||
),
|
||||
array(
|
||||
'relation' => 'OR',
|
||||
array(
|
||||
'key' => 'um_show_last_login',
|
||||
'compare' => 'NOT EXISTS',
|
||||
),
|
||||
array(
|
||||
'key' => 'um_show_last_login',
|
||||
'value' => 'a:1:{i:0;s:2:"no";}',
|
||||
'compare' => '!=',
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
$this->custom_filters_in_query[ $field ] = $value;
|
||||
|
||||
$this->query_args['meta_query'] = array_merge( $this->query_args['meta_query'], array( $meta_query ) );
|
||||
break;
|
||||
case 'gender':
|
||||
if ( is_array( $value ) ) {
|
||||
$field_query = array( 'relation' => $relation );
|
||||
|
||||
foreach ( $value as $single_val ) {
|
||||
$single_val = trim( stripslashes( $single_val ) );
|
||||
|
||||
$arr_meta_query = array(
|
||||
array(
|
||||
'key' => $field,
|
||||
'value' => $single_val,
|
||||
'compare' => '=',
|
||||
),
|
||||
array(
|
||||
'key' => $field,
|
||||
'value' => '"' . $single_val . '"',
|
||||
'compare' => 'LIKE',
|
||||
),
|
||||
);
|
||||
|
||||
$field_query = array_merge( $field_query, $arr_meta_query );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! empty( $field_query ) ) {
|
||||
$this->query_args['meta_query'] = array_merge( $this->query_args['meta_query'], array( $field_query ) );
|
||||
|
||||
$this->custom_filters_in_query[ $field ] = $value;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2133,35 +2213,36 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
|
||||
$value = array( $value );
|
||||
}
|
||||
|
||||
$field_query = array( 'relation' => 'OR' );
|
||||
/** This filter is documented in includes/core/class-member-directory.php */
|
||||
$field_query = apply_filters( 'um_members_directory_filter_select', array( 'relation' => 'OR' ), $field );
|
||||
|
||||
foreach ( $value as $single_val ) {
|
||||
$single_val = trim( $single_val );
|
||||
|
||||
$arr_meta_query = array(
|
||||
array(
|
||||
'key' => $field,
|
||||
'value' => $single_val,
|
||||
'compare' => '=',
|
||||
'key' => $field,
|
||||
'value' => $single_val,
|
||||
'compare' => '=',
|
||||
),
|
||||
array(
|
||||
'key' => $field,
|
||||
'value' => serialize( (string) $single_val ),
|
||||
'compare' => 'LIKE',
|
||||
'key' => $field,
|
||||
'value' => serialize( (string) $single_val ),
|
||||
'compare' => 'LIKE',
|
||||
),
|
||||
array(
|
||||
'key' => $field,
|
||||
'value' => '"' . $single_val . '"',
|
||||
'compare' => 'LIKE',
|
||||
)
|
||||
'key' => $field,
|
||||
'value' => '"' . $single_val . '"',
|
||||
'compare' => 'LIKE',
|
||||
),
|
||||
);
|
||||
|
||||
if ( is_numeric( $single_val ) ) {
|
||||
|
||||
$arr_meta_query[] = array(
|
||||
'key' => $field,
|
||||
'value' => serialize( (int) $single_val ),
|
||||
'compare' => 'LIKE',
|
||||
'key' => $field,
|
||||
'value' => serialize( absint( $single_val ) ),
|
||||
'compare' => 'LIKE',
|
||||
);
|
||||
|
||||
}
|
||||
@@ -2290,9 +2371,18 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
|
||||
$offset = $gmt_offset;
|
||||
}
|
||||
|
||||
$from_date = (int) min( $value ) + ( $offset * HOUR_IN_SECONDS ); // client time zone offset
|
||||
$to_date = (int) max( $value ) + ( $offset * HOUR_IN_SECONDS ) + DAY_IN_SECONDS - 1; // time 23:59
|
||||
$value = array_map(
|
||||
function( $date ) {
|
||||
return is_numeric( $date ) ? $date : strtotime( $date );
|
||||
},
|
||||
$value
|
||||
);
|
||||
|
||||
$from_date = gmdate( 'Y-m-d H:i:s', (int) min( $value ) + ( $offset * HOUR_IN_SECONDS ) ); // client time zone offset
|
||||
$to_date = gmdate( 'Y-m-d H:i:s', (int) max( $value ) + ( $offset * HOUR_IN_SECONDS ) + DAY_IN_SECONDS - 1 ); // time 23:59
|
||||
|
||||
$meta_query = array(
|
||||
'relation' => 'AND',
|
||||
array(
|
||||
'key' => '_um_last_login',
|
||||
'value' => array( $from_date, $to_date ),
|
||||
@@ -2300,6 +2390,18 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
|
||||
'inclusive' => true,
|
||||
'type' => 'DATETIME',
|
||||
),
|
||||
array(
|
||||
'relation' => 'OR',
|
||||
array(
|
||||
'key' => 'um_show_last_login',
|
||||
'compare' => 'NOT EXISTS',
|
||||
),
|
||||
array(
|
||||
'key' => 'um_show_last_login',
|
||||
'value' => 'a:1:{i:0;s:2:"no";}',
|
||||
'compare' => '!=',
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
$this->query_args['meta_query'] = array_merge( $this->query_args['meta_query'], array( $meta_query ) );
|
||||
@@ -2385,8 +2487,8 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
|
||||
|
||||
if ( UM()->roles()->um_current_user_can( 'edit', $user_id ) ) {
|
||||
$actions['um-editprofile'] = array(
|
||||
'title' => __( 'Edit Profile', 'ultimate-member' ),
|
||||
'url' => um_edit_profile_url(),
|
||||
'title' => esc_html__( 'Edit Profile', 'ultimate-member' ),
|
||||
'url' => um_edit_profile_url(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2417,8 +2519,8 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
|
||||
$url = add_query_arg( array( 'um_action' => $id, 'uid' => $user_id ), um_get_core_page( 'user' ) );
|
||||
|
||||
$actions[ $id ] = array(
|
||||
'title' => $arr['label'],
|
||||
'url' => $url,
|
||||
'title' => esc_html( $arr['label'] ),
|
||||
'url' => esc_url( $url ),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -2429,25 +2531,24 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
|
||||
|
||||
if ( empty( UM()->user()->cannot_edit ) ) {
|
||||
$actions['um-editprofile'] = array(
|
||||
'title' => __( 'Edit Profile', 'ultimate-member' ),
|
||||
'title' => esc_html__( 'Edit Profile', 'ultimate-member' ),
|
||||
'url' => um_edit_profile_url(),
|
||||
);
|
||||
}
|
||||
|
||||
$actions['um-myaccount'] = array(
|
||||
'title' => __( 'My Account', 'ultimate-member' ),
|
||||
'title' => esc_html__( 'My Account', 'ultimate-member' ),
|
||||
'url' => um_get_core_page( 'account' ),
|
||||
);
|
||||
|
||||
$actions['um-logout'] = array(
|
||||
'title' => __( 'Logout', 'ultimate-member' ),
|
||||
'title' => esc_html__( 'Logout', 'ultimate-member' ),
|
||||
'url' => um_get_core_page( 'logout' ),
|
||||
);
|
||||
|
||||
$actions = apply_filters( 'um_member_directory_my_user_card_actions', $actions, $user_id );
|
||||
}
|
||||
|
||||
|
||||
return $actions;
|
||||
}
|
||||
|
||||
@@ -2464,7 +2565,7 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
|
||||
|
||||
$dropdown_actions = $this->build_user_actions_list( $user_id );
|
||||
|
||||
$actions = array();
|
||||
$actions = array();
|
||||
$can_edit = UM()->roles()->um_current_user_can( 'edit', $user_id );
|
||||
|
||||
// Replace hook 'um_members_just_after_name'
|
||||
@@ -2478,21 +2579,21 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
|
||||
$hook_after_user_name = ob_get_clean();
|
||||
|
||||
$data_array = array(
|
||||
'card_anchor' => substr( md5( $user_id ), 10, 5 ),
|
||||
'id' => $user_id,
|
||||
'role' => um_user( 'role' ),
|
||||
'account_status' => um_user( 'account_status' ),
|
||||
'account_status_name' => um_user( 'account_status_name' ),
|
||||
'cover_photo' => um_user( 'cover_photo', $this->cover_size ),
|
||||
'display_name' => um_user( 'display_name' ),
|
||||
'profile_url' => um_user_profile_url(),
|
||||
'can_edit' => $can_edit,
|
||||
'edit_profile_url' => um_edit_profile_url(),
|
||||
'avatar' => get_avatar( $user_id, $this->avatar_size ),
|
||||
'display_name_html' => um_user( 'display_name', 'html' ),
|
||||
'dropdown_actions' => $dropdown_actions,
|
||||
'hook_just_after_name' => preg_replace( '/^\s+/im', '', $hook_just_after_name ),
|
||||
'hook_after_user_name' => preg_replace( '/^\s+/im', '', $hook_after_user_name ),
|
||||
'card_anchor' => esc_html( substr( md5( $user_id ), 10, 5 ) ),
|
||||
'id' => absint( $user_id ),
|
||||
'role' => esc_html( um_user( 'role' ) ),
|
||||
'account_status' => esc_html( um_user( 'account_status' ) ),
|
||||
'account_status_name' => esc_html( um_user( 'account_status_name' ) ),
|
||||
'cover_photo' => wp_kses( um_user( 'cover_photo', $this->cover_size ), UM()->get_allowed_html( 'templates' ) ),
|
||||
'display_name' => esc_html( um_user( 'display_name' ) ),
|
||||
'profile_url' => esc_url( um_user_profile_url() ),
|
||||
'can_edit' => (bool) $can_edit,
|
||||
'edit_profile_url' => esc_url( um_edit_profile_url() ),
|
||||
'avatar' => wp_kses( get_avatar( $user_id, $this->avatar_size ), UM()->get_allowed_html( 'templates' ) ),
|
||||
'display_name_html' => wp_kses( um_user( 'display_name', 'html' ), UM()->get_allowed_html( 'templates' ) ),
|
||||
'dropdown_actions' => $dropdown_actions,
|
||||
'hook_just_after_name' => wp_kses( preg_replace( '/^\s+/im', '', $hook_just_after_name ), UM()->get_allowed_html( 'templates' ) ),
|
||||
'hook_after_user_name' => wp_kses( preg_replace( '/^\s+/im', '', $hook_after_user_name ), UM()->get_allowed_html( 'templates' ) ),
|
||||
);
|
||||
|
||||
if ( ! empty( $directory_data['show_tagline'] ) ) {
|
||||
@@ -2506,13 +2607,20 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( '_um_last_login' === $key ) {
|
||||
$show_last_login = get_user_meta( $user_id, 'um_show_last_login', true );
|
||||
if ( ! empty( $show_last_login ) && 'no' === $show_last_login[0] ) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$value = um_filtered_value( $key );
|
||||
|
||||
if ( ! $value ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$data_array[ $key ] = $value;
|
||||
$data_array[ $key ] = wp_kses( $value, UM()->get_allowed_html( 'templates' ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2530,6 +2638,13 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( '_um_last_login' === $key ) {
|
||||
$show_last_login = get_user_meta( $user_id, 'um_show_last_login', true );
|
||||
if ( ! empty( $show_last_login ) && 'no' === $show_last_login[0] ) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$value = um_filtered_value( $key );
|
||||
if ( ! $value ) {
|
||||
continue;
|
||||
@@ -2543,8 +2658,8 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
|
||||
) );
|
||||
}
|
||||
|
||||
$data_array[ "label_{$key}" ] = __( $label, 'ultimate-member' );
|
||||
$data_array[ $key ] = $value;
|
||||
$data_array[ "label_{$key}" ] = esc_html__( $label, 'ultimate-member' );
|
||||
$data_array[ $key ] = wp_kses( $value, UM()->get_allowed_html( 'templates' ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2554,7 +2669,7 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
|
||||
UM()->fields()->show_social_urls();
|
||||
$social_urls = ob_get_clean();
|
||||
|
||||
$data_array['social_urls'] = $social_urls;
|
||||
$data_array['social_urls'] = wp_kses( $social_urls, UM()->get_allowed_html( 'templates' ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2643,14 +2758,13 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
|
||||
|
||||
// Prepare default user query values
|
||||
$this->query_args = array(
|
||||
'fields' => 'ids',
|
||||
'number' => 0,
|
||||
'meta_query' => array(
|
||||
'relation' => 'AND'
|
||||
'fields' => 'ids',
|
||||
'number' => 0,
|
||||
'meta_query' => array(
|
||||
'relation' => 'AND',
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
// handle different restrictions
|
||||
$this->restriction_options();
|
||||
|
||||
@@ -2784,7 +2898,7 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) {
|
||||
|
||||
$this->cover_size = apply_filters( 'um_member_directory_cover_image_size', $this->cover_size, $directory_data );
|
||||
|
||||
$avatar_size = UM()->options()->get( 'profile_photosize' );
|
||||
$avatar_size = UM()->options()->get( 'profile_photosize' );
|
||||
$this->avatar_size = str_replace( 'px', '', $avatar_size );
|
||||
$this->avatar_size = apply_filters( 'um_member_directory_avatar_image_size', $this->avatar_size, $directory_data );
|
||||
|
||||
|
||||
@@ -7,64 +7,56 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
|
||||
if ( ! class_exists( 'um\core\Options' ) ) {
|
||||
|
||||
|
||||
/**
|
||||
* Class Options
|
||||
* @package um\core
|
||||
*/
|
||||
class Options {
|
||||
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
var $options = array();
|
||||
|
||||
private $options = array();
|
||||
|
||||
/**
|
||||
* Options constructor.
|
||||
*/
|
||||
function __construct() {
|
||||
public function __construct() {
|
||||
$this->init_variables();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set variables
|
||||
*/
|
||||
function init_variables() {
|
||||
private function init_variables() {
|
||||
$this->options = get_option( 'um_options', array() );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get UM option value
|
||||
* Get UM option value.
|
||||
*
|
||||
* @param $option_id
|
||||
* @return mixed|string|void
|
||||
* @param string $option_id
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
function get( $option_id ) {
|
||||
public function get( $option_id ) {
|
||||
if ( isset( $this->options[ $option_id ] ) ) {
|
||||
/**
|
||||
* UM hook
|
||||
* Filters the plugin option.
|
||||
*
|
||||
* @type filter
|
||||
* @title um_get_option_filter__{$option_id}
|
||||
* @description Change UM option on get by $option_id
|
||||
* @input_vars
|
||||
* [{"var":"$option","type":"array","desc":"Option Value"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_get_option_filter__{$option_id}', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_get_option_filter__{$option_id}', 'my_get_option_filter', 10, 1 );
|
||||
* function my_get_option_filter( $option ) {
|
||||
* // your code here
|
||||
* return $option;
|
||||
* @param {mixed} $value Option value.
|
||||
*
|
||||
* @return {mixed} Option value.
|
||||
*
|
||||
* @since 1.3.67
|
||||
* @hook um_get_option_filter__{$option_id}
|
||||
*
|
||||
* @example <caption>Change `option_1` value.</caption>
|
||||
* function my_custom_option_1( $value ) {
|
||||
* $value = 'option_1_custom_value';
|
||||
* return $value;
|
||||
* }
|
||||
* ?>
|
||||
* add_filter( 'um_get_option_filter__option_1', 'my_custom_option_1' );
|
||||
*/
|
||||
return apply_filters( "um_get_option_filter__{$option_id}", $this->options[ $option_id ] );
|
||||
}
|
||||
@@ -72,35 +64,30 @@ if ( ! class_exists( 'um\core\Options' ) ) {
|
||||
switch ( $option_id ) {
|
||||
case 'site_name':
|
||||
return get_bloginfo( 'name' );
|
||||
break;
|
||||
case 'admin_email':
|
||||
return get_bloginfo( 'admin_email' );
|
||||
break;
|
||||
default:
|
||||
return '';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update UM option value
|
||||
*
|
||||
* @param $option_id
|
||||
* @param $value
|
||||
*/
|
||||
function update( $option_id, $value ) {
|
||||
public function update( $option_id, $value ) {
|
||||
$this->options[ $option_id ] = $value;
|
||||
update_option( 'um_options', $this->options );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete UM option
|
||||
*
|
||||
* @param $option_id
|
||||
*/
|
||||
function remove( $option_id ) {
|
||||
public function remove( $option_id ) {
|
||||
if ( ! empty( $this->options[ $option_id ] ) ) {
|
||||
unset( $this->options[ $option_id ] );
|
||||
}
|
||||
@@ -108,16 +95,15 @@ if ( ! class_exists( 'um\core\Options' ) ) {
|
||||
update_option( 'um_options', $this->options );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get UM option default value
|
||||
*
|
||||
* @use UM()->config()
|
||||
*
|
||||
* @param $option_id
|
||||
* @param string $option_id
|
||||
* @return mixed
|
||||
*/
|
||||
function get_default( $option_id ) {
|
||||
public function get_default( $option_id ) {
|
||||
$settings_defaults = UM()->config()->settings_defaults;
|
||||
if ( ! isset( $settings_defaults[ $option_id ] ) ) {
|
||||
return false;
|
||||
@@ -136,40 +122,58 @@ if ( ! class_exists( 'um\core\Options' ) ) {
|
||||
* @return string
|
||||
*/
|
||||
public function get_predefined_page_option_key( $slug ) {
|
||||
/**
|
||||
* Filters the predefined page option key.
|
||||
*
|
||||
* @param {string} $option_key Predefined page option key.
|
||||
*
|
||||
* @return {string} Predefined page option key.
|
||||
*
|
||||
* @since 2.8.3
|
||||
* @hook um_predefined_page_option_key
|
||||
*
|
||||
* @example <caption>Change option key for login predefined page.</caption>
|
||||
* function my_um_predefined_page_option_key( $option_key ) {
|
||||
* if ( 'core_login' === $option_key ) {
|
||||
* $option_key = 'core_login_custom';
|
||||
* }
|
||||
* return $option_key;
|
||||
* }
|
||||
* add_filter( 'um_predefined_page_option_key', 'my_um_predefined_page_option_key' );
|
||||
*/
|
||||
return apply_filters( 'um_predefined_page_option_key', "core_{$slug}" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get core page ID
|
||||
*
|
||||
* @todo Deprecate soon
|
||||
*
|
||||
* @param string $key
|
||||
*
|
||||
* @return mixed|void
|
||||
* @return string
|
||||
*/
|
||||
function get_core_page_id( $key ) {
|
||||
public function get_core_page_id( $key ) {
|
||||
/**
|
||||
* UM hook
|
||||
* Filters the predefined page option key.
|
||||
*
|
||||
* @type filter
|
||||
* @title um_core_page_id_filter
|
||||
* @description Change UM page slug
|
||||
* @input_vars
|
||||
* [{"var":"$slug","type":"array","desc":"UM page slug"}]
|
||||
* @change_log
|
||||
* ["Since: 2.0"]
|
||||
* @usage
|
||||
* <?php add_filter( 'um_core_page_id_filter', 'function_name', 10, 1 ); ?>
|
||||
* @example
|
||||
* <?php
|
||||
* add_filter( 'um_core_page_id_filter', 'my_core_page_id', 10, 1 );
|
||||
* function my_core_page_id( $slug ) {
|
||||
* // your code here
|
||||
* return $slug;
|
||||
* @param {string} $page_key Predefined page option key.
|
||||
*
|
||||
* @return {string} Predefined page option key.
|
||||
*
|
||||
* @since 1.3.x
|
||||
* @hook um_core_page_id_filter
|
||||
*
|
||||
* @example <caption>Change option key for login predefined page.</caption>
|
||||
* function my_um_core_page_id_filter( $page_key ) {
|
||||
* if ( 'core_login' === $page_key ) {
|
||||
* $page_key = 'core_login_custom';
|
||||
* }
|
||||
* return $page_key;
|
||||
* }
|
||||
* ?>
|
||||
* add_filter( 'um_core_page_id_filter', 'my_um_core_page_id_filter' );
|
||||
*/
|
||||
return apply_filters( 'um_core_page_id_filter', 'core_' . $key );
|
||||
return apply_filters( 'um_core_page_id_filter', $this->get_predefined_page_option_key( $key ) );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,21 +38,26 @@ if ( ! class_exists( 'um\core\Password' ) ) {
|
||||
*
|
||||
* @return bool|string
|
||||
*/
|
||||
function reset_url() {
|
||||
public function reset_url() {
|
||||
static $reset_key = null;
|
||||
|
||||
$user_id = um_user( 'ID' );
|
||||
|
||||
delete_option( "um_cache_userdata_{$user_id}" );
|
||||
|
||||
//new reset password key via WordPress native field. It maybe already exists here but generated twice to make sure that emailed with a proper and fresh hash
|
||||
// New reset password key via WordPress native field. It maybe already exists here but generated twice to make sure that emailed with a proper and fresh hash.
|
||||
// But doing that only once in 1 request using static variable. Different email placeholders can use reset_url() and we have to use 1 time generated to avoid invalid keys.
|
||||
$user_data = get_userdata( $user_id );
|
||||
$key = UM()->user()->maybe_generate_password_reset_key( $user_data );
|
||||
if ( empty( $reset_key ) ) {
|
||||
$reset_key = UM()->user()->maybe_generate_password_reset_key( $user_data );
|
||||
}
|
||||
|
||||
// this link looks like WordPress native link e.g. wp-login.php?action=rp&key={hash}&login={user_login}
|
||||
$url = add_query_arg(
|
||||
array(
|
||||
'act' => 'reset_password',
|
||||
'hash' => $key,
|
||||
'login' => $user_data->user_login,
|
||||
'hash' => $reset_key,
|
||||
'login' => rawurlencode( $user_data->user_login ),
|
||||
),
|
||||
um_get_core_page( 'password-reset' )
|
||||
);
|
||||
@@ -490,6 +495,7 @@ if ( ! class_exists( 'um\core\Password' ) ) {
|
||||
|
||||
if ( isset( $args['user_password'] ) && empty( $args['user_password'] ) ) {
|
||||
UM()->form()->add_error( 'user_password', __( 'You must enter a new password', 'ultimate-member' ) );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( isset( $args['user_password'] ) ) {
|
||||
|
||||
@@ -174,7 +174,7 @@ if ( ! class_exists( 'um\core\Permalinks' ) ) {
|
||||
do_action( 'um_after_email_confirmation', $user_id );
|
||||
|
||||
if ( empty( $set_password_required ) ) {
|
||||
$redirect = empty( $user_role_data['url_email_activate'] ) ? um_get_core_page( 'login', 'account_active' ) : trim( $user_role_data['url_email_activate'] ); // Role setting "URL redirect after e-mail activation"
|
||||
$redirect = empty( $user_role_data['url_email_activate'] ) ? um_get_core_page( 'login', 'account_active' ) : trim( $user_role_data['url_email_activate'] ); // Role setting "URL redirect after email activation"
|
||||
}
|
||||
$redirect = apply_filters( 'um_after_email_confirmation_redirect', $redirect, $user_id, $login );
|
||||
|
||||
|
||||
@@ -418,6 +418,13 @@ if ( ! class_exists( 'um\core\Profile' ) ) {
|
||||
if ( ! empty( $array ) ) {
|
||||
foreach ( $array as $key ) {
|
||||
if ( $key ) {
|
||||
if ( '_um_last_login' === $key ) {
|
||||
$show_last_login = get_user_meta( um_user( 'ID' ), 'um_show_last_login', true );
|
||||
if ( ! empty( $show_last_login ) && 'no' === $show_last_login[0] ) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$data = array();
|
||||
if ( isset( UM()->builtin()->all_user_fields[ $key ] ) ) {
|
||||
$data = UM()->builtin()->all_user_fields[ $key ];
|
||||
|
||||
@@ -162,6 +162,13 @@ if ( ! class_exists( 'um\core\Rewrite' ) ) {
|
||||
if ( empty( $custom_meta ) ) {
|
||||
// Set default permalink base if custom meta is empty.
|
||||
$permalink_base = 'user_login';
|
||||
} else {
|
||||
// Ignore username slug if custom meta slug exists.
|
||||
$user_id = username_exists( um_queried_user() );
|
||||
$custom_permalink = get_user_meta( $user_id, 'um_user_profile_url_slug_' . $permalink_base, true );
|
||||
if ( ! empty( $custom_permalink ) && um_queried_user() !== $custom_permalink ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -191,27 +191,7 @@ KEY meta_value_indx (um_value(191))
|
||||
$content = '[ultimatemember form_id="' . $setup_shortcodes[ $slug ] . '"]';
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters Ultimate Member predefined pages content when set up the predefined page.
|
||||
*
|
||||
* @param {string} $content Predefined page content.
|
||||
* @param {string} $slug Predefined page slug (key).
|
||||
*
|
||||
* @return {string} Predefined page content.
|
||||
*
|
||||
* @since 2.1.0
|
||||
* @hook um_setup_predefined_page_content
|
||||
*
|
||||
* @example <caption>Set Ultimate Member predefined pages content with key = 'my_page_key'.</caption>
|
||||
* function my_um_setup_predefined_page_content( $content, $slug ) {
|
||||
* // your code here
|
||||
* if ( 'my_page_key' === $slug ) {
|
||||
* $content = __( 'My Page content', 'my-translate-key' );
|
||||
* }
|
||||
* return $pages;
|
||||
* }
|
||||
* add_filter( 'um_setup_predefined_page_content', 'my_um_setup_predefined_page_content' );
|
||||
*/
|
||||
/** This filter is documented in includes/core/class-setup.php */
|
||||
$content = apply_filters( 'um_setup_predefined_page_content', $content, $slug );
|
||||
|
||||
$user_page = array(
|
||||
@@ -233,7 +213,7 @@ KEY meta_value_indx (um_value(191))
|
||||
$options = get_option( 'um_options', array() );
|
||||
|
||||
foreach ( $core_pages as $slug => $page_id ) {
|
||||
$key = UM()->options()->get_core_page_id( $slug );
|
||||
$key = UM()->options()->get_predefined_page_option_key( $slug );
|
||||
$options[ $key ] = $page_id;
|
||||
}
|
||||
|
||||
@@ -243,6 +223,72 @@ KEY meta_value_indx (um_value(191))
|
||||
UM()->rewrite()->reset_rules();
|
||||
}
|
||||
|
||||
public function predefined_page( $slug, $with_rewrite = true ) {
|
||||
$page_exists = UM()->query()->find_post_id( 'page', '_um_core', $slug );
|
||||
if ( $page_exists ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$predefined_pages = UM()->config()->get( 'predefined_pages' );
|
||||
if ( empty( $predefined_pages ) || ! array_key_exists( $slug, $predefined_pages ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$data = $predefined_pages[ $slug ];
|
||||
|
||||
if ( empty( $data['title'] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$content = ! empty( $data['content'] ) ? $data['content'] : '';
|
||||
/**
|
||||
* Filters Ultimate Member predefined pages content when set up the predefined page.
|
||||
*
|
||||
* @param {string} $content Predefined page content.
|
||||
* @param {string} $slug Predefined page slug (key).
|
||||
*
|
||||
* @return {string} Predefined page content.
|
||||
*
|
||||
* @since 2.1.0
|
||||
* @hook um_setup_predefined_page_content
|
||||
*
|
||||
* @example <caption>Set Ultimate Member predefined pages content with key = 'my_page_key'.</caption>
|
||||
* function my_um_setup_predefined_page_content( $content, $slug ) {
|
||||
* // your code here
|
||||
* if ( 'my_page_key' === $slug ) {
|
||||
* $content = __( 'My Page content', 'my-translate-key' );
|
||||
* }
|
||||
* return $pages;
|
||||
* }
|
||||
* add_filter( 'um_setup_predefined_page_content', 'my_um_setup_predefined_page_content' );
|
||||
*/
|
||||
$content = apply_filters( 'um_setup_predefined_page_content', $content, $slug );
|
||||
|
||||
$user_page = array(
|
||||
'post_title' => $data['title'],
|
||||
'post_content' => $content,
|
||||
'post_name' => $slug,
|
||||
'post_type' => 'page',
|
||||
'post_status' => 'publish',
|
||||
'post_author' => get_current_user_id(),
|
||||
'comment_status' => 'closed',
|
||||
);
|
||||
|
||||
$post_id = wp_insert_post( $user_page );
|
||||
if ( empty( $post_id ) || is_wp_error( $post_id ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
update_post_meta( $post_id, '_um_core', $slug );
|
||||
|
||||
UM()->options()->update( UM()->options()->get_predefined_page_option_key( $slug ), $post_id );
|
||||
|
||||
if ( $with_rewrite ) {
|
||||
// Reset rewrite rules after page creation and option upgrade.
|
||||
UM()->rewrite()->reset_rules();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set default UM settings.
|
||||
*/
|
||||
|
||||
@@ -968,28 +968,29 @@ if ( ! class_exists( 'um\core\Uploader' ) ) {
|
||||
/**
|
||||
* Profile photo image process
|
||||
*
|
||||
* @param array $response
|
||||
* @param array $response
|
||||
* @param string $image_path
|
||||
* @param string $src
|
||||
* @param string $key
|
||||
* @param integer $user_id
|
||||
* @param int $user_id
|
||||
* @param string $coord
|
||||
* @param array $crop
|
||||
* @param array $crop
|
||||
*
|
||||
* @since 2.0.22
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function profile_photo( $response, $image_path, $src, $key, $user_id, $coord, $crop ) {
|
||||
$sizes = UM()->options()->get( 'photo_thumb_sizes' );
|
||||
|
||||
$sizes = UM()->options()->get( 'photo_thumb_sizes' );
|
||||
$quality = UM()->options()->get( 'image_compression' );
|
||||
|
||||
$image = wp_get_image_editor( $image_path ); // Return an implementation that extends WP_Image_Editor
|
||||
|
||||
$temp_image_path = $image_path;
|
||||
//refresh image_path to make temporary image permanently after upload
|
||||
$image_path = pathinfo( $image_path, PATHINFO_DIRNAME ) . DIRECTORY_SEPARATOR . $key . '.' . pathinfo( $image_path, PATHINFO_EXTENSION );
|
||||
|
||||
// Refresh image_path to make temporary image permanently after upload
|
||||
$photo_ext = pathinfo( $image_path, PATHINFO_EXTENSION );
|
||||
$image_path = pathinfo( $image_path, PATHINFO_DIRNAME ) . DIRECTORY_SEPARATOR . $key . '.' . $photo_ext;
|
||||
|
||||
if ( ! is_wp_error( $image ) ) {
|
||||
$src_x = $crop[0];
|
||||
@@ -1004,12 +1005,16 @@ if ( ! class_exists( 'um\core\Uploader' ) ) {
|
||||
$image->resize( $max_w, $src_h );
|
||||
}
|
||||
|
||||
$image->save( $image_path );
|
||||
$save_result = $image->save( $image_path );
|
||||
|
||||
if ( is_wp_error( $save_result ) ) {
|
||||
// translators: %s is the file src.
|
||||
wp_send_json_error( sprintf( __( 'Unable to crop image file: %s', 'ultimate-member' ), $src ) );
|
||||
}
|
||||
|
||||
$image->set_quality( $quality );
|
||||
|
||||
$sizes_array = array();
|
||||
|
||||
foreach ( $sizes as $size ) {
|
||||
$sizes_array[] = array( 'width' => $size );
|
||||
}
|
||||
@@ -1020,50 +1025,49 @@ if ( ! class_exists( 'um\core\Uploader' ) ) {
|
||||
|
||||
unlink( $temp_image_path );
|
||||
|
||||
$src = str_replace( '/' . $key . '_temp.', '/' . $key . '.', $src );
|
||||
$basename = $key . '_temp.' . $photo_ext;
|
||||
$src = str_replace( '/' . $basename, '/' . $save_result['file'], $src );
|
||||
|
||||
$response['image']['source_url'] = $src;
|
||||
$response['image']['source_path'] = $image_path;
|
||||
$response['image']['filename'] = wp_basename( $image_path );
|
||||
$response['image']['source_url'] = $src;
|
||||
$response['image']['source_path'] = $save_result['path'];
|
||||
$response['image']['filename'] = $save_result['file'];
|
||||
|
||||
update_user_meta( $this->user_id, $key, wp_basename( wp_basename( $image_path ) ) );
|
||||
update_user_meta( $this->user_id, $key, $save_result['file'] );
|
||||
delete_user_meta( $this->user_id, "{$key}_metadata_temp" );
|
||||
} else {
|
||||
wp_send_json_error( esc_js( __( "Unable to crop image file: {$src}", 'ultimate-member' ) ) );
|
||||
// translators: %s is the file src.
|
||||
wp_send_json_error( sprintf( __( 'Unable to crop image file: %s', 'ultimate-member' ), $src ) );
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Cover photo image process
|
||||
*
|
||||
* @param string $src
|
||||
* @param integer $user_id
|
||||
* @param int $user_id
|
||||
* @param string $coord
|
||||
* @param array $crop
|
||||
* @param array $response
|
||||
* @param array $crop
|
||||
* @param array $response
|
||||
*
|
||||
* @since 2.0.22
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function cover_photo( $response, $image_path, $src, $key, $user_id, $coord, $crop ) {
|
||||
|
||||
$sizes = UM()->options()->get( 'cover_thumb_sizes' );
|
||||
|
||||
$sizes = UM()->options()->get( 'cover_thumb_sizes' );
|
||||
$quality = UM()->options()->get( 'image_compression' );
|
||||
|
||||
$image = wp_get_image_editor( $image_path ); // Return an implementation that extends WP_Image_Editor
|
||||
|
||||
$temp_image_path = $image_path;
|
||||
|
||||
//refresh image_path to make temporary image permanently after upload
|
||||
$image_path = pathinfo( $image_path, PATHINFO_DIRNAME ) . DIRECTORY_SEPARATOR . $key . '.' . pathinfo( $image_path, PATHINFO_EXTENSION );
|
||||
// Refresh image_path to make temporary image permanently after upload
|
||||
$photo_ext = pathinfo( $image_path, PATHINFO_EXTENSION );
|
||||
$image_path = pathinfo( $image_path, PATHINFO_DIRNAME ) . DIRECTORY_SEPARATOR . $key . '.' . $photo_ext;
|
||||
|
||||
if ( ! is_wp_error( $image ) ) {
|
||||
|
||||
$src_x = $crop[0];
|
||||
$src_y = $crop[1];
|
||||
$src_w = $crop[2];
|
||||
@@ -1076,7 +1080,12 @@ if ( ! class_exists( 'um\core\Uploader' ) ) {
|
||||
$image->resize( $max_w, $src_h );
|
||||
}
|
||||
|
||||
$image->save( $image_path );
|
||||
$save_result = $image->save( $image_path );
|
||||
|
||||
if ( is_wp_error( $save_result ) ) {
|
||||
// translators: %s is the file src.
|
||||
wp_send_json_error( sprintf( __( 'Unable to crop image file: %s', 'ultimate-member' ), $src ) );
|
||||
}
|
||||
|
||||
$image->set_quality( $quality );
|
||||
|
||||
@@ -1090,7 +1099,7 @@ if ( ! class_exists( 'um\core\Uploader' ) ) {
|
||||
|
||||
// change filenames of resized images
|
||||
foreach ( $resize as $row ) {
|
||||
$new_filename = str_replace( "x{$row['height']}" , '', $row['file'] );
|
||||
$new_filename = str_replace( "x{$row['height']}", '', $row['file'] );
|
||||
$old_filename = $row['file'];
|
||||
|
||||
rename( dirname( $image_path ) . DIRECTORY_SEPARATOR . $old_filename, dirname( $image_path ) . DIRECTORY_SEPARATOR . $new_filename );
|
||||
@@ -1098,16 +1107,18 @@ if ( ! class_exists( 'um\core\Uploader' ) ) {
|
||||
|
||||
unlink( $temp_image_path );
|
||||
|
||||
$src = str_replace( '/' . $key . '_temp.', '/' . $key . '.', $src );
|
||||
$basename = $key . '_temp.' . $photo_ext;
|
||||
$src = str_replace( '/' . $basename, '/' . $save_result['file'], $src );
|
||||
|
||||
$response['image']['source_url'] = $src;
|
||||
$response['image']['source_path'] = $image_path;
|
||||
$response['image']['filename'] = wp_basename( $image_path );
|
||||
$response['image']['source_url'] = $src;
|
||||
$response['image']['source_path'] = $save_result['path'];
|
||||
$response['image']['filename'] = $save_result['file'];
|
||||
|
||||
update_user_meta( $this->user_id, $key, wp_basename( wp_basename( $image_path ) ) );
|
||||
update_user_meta( $this->user_id, $key, $save_result['file'] );
|
||||
delete_user_meta( $this->user_id, "{$key}_metadata_temp" );
|
||||
} else {
|
||||
wp_send_json_error( esc_js( __( "Unable to crop image file: {$src}", 'ultimate-member' ) ) );
|
||||
// translators: %s is the file src.
|
||||
wp_send_json_error( sprintf( __( 'Unable to crop image file: %s', 'ultimate-member' ), $src ) );
|
||||
}
|
||||
|
||||
return $response;
|
||||
@@ -1195,15 +1206,15 @@ if ( ! class_exists( 'um\core\Uploader' ) ) {
|
||||
|
||||
$response = array(
|
||||
'image' => array(
|
||||
'source_url' => $src,
|
||||
'source_path' => $image_path,
|
||||
'filename' => wp_basename( $image_path ),
|
||||
'source_url' => $src,
|
||||
'source_path' => $image_path,
|
||||
'filename' => wp_basename( $image_path ),
|
||||
),
|
||||
);
|
||||
|
||||
$response = apply_filters( "um_upload_image_process__{$key}", $response, $image_path, $src, $key, $user_id, $coord, $crop );
|
||||
|
||||
if ( ! in_array( $key, array( 'profile_photo', 'cover_photo' ) ) ) {
|
||||
if ( ! in_array( $key, array( 'profile_photo', 'cover_photo' ), true ) ) {
|
||||
$response = apply_filters( 'um_upload_stream_image_process', $response, $image_path, $src, $key, $user_id, $coord, $crop );
|
||||
}
|
||||
|
||||
|
||||
@@ -1301,7 +1301,7 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
}
|
||||
|
||||
if ( $this->usermeta['account_status'][0] == 'awaiting_email_confirmation' ) {
|
||||
$this->usermeta['account_status_name'][0] = __( 'Awaiting E-mail Confirmation', 'ultimate-member' );
|
||||
$this->usermeta['account_status_name'][0] = __( 'Awaiting Email Confirmation', 'ultimate-member' );
|
||||
}
|
||||
|
||||
if ( $this->usermeta['account_status'][0] == 'awaiting_admin_review' ) {
|
||||
@@ -1607,7 +1607,7 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
|
||||
$expiry_time = UM()->options()->get( 'activation_link_expiry_time' );
|
||||
if ( ! empty( $expiry_time ) && is_numeric( $expiry_time ) ) {
|
||||
$this->profile['account_secret_hash_expiry'] = time() + $expiry_time;
|
||||
$this->profile['account_secret_hash_expiry'] = time() + $expiry_time * DAY_IN_SECONDS;
|
||||
$this->update_usermeta_info( 'account_secret_hash_expiry' );
|
||||
}
|
||||
|
||||
@@ -1676,7 +1676,7 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
|
||||
|
||||
/**
|
||||
* This method approves a user membership and sends them an optional welcome/approval e-mail.
|
||||
* This method approves a user membership and sends them an optional welcome/approval email.
|
||||
*
|
||||
* @usage <?php UM()->user()->approve(); ?>
|
||||
*
|
||||
@@ -1758,7 +1758,7 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
|
||||
|
||||
/**
|
||||
* This method puts a user under manual review by administrator and sends them an optional e-mail.
|
||||
* This method puts a user under manual review by administrator and sends them an optional email.
|
||||
*
|
||||
* @usage <?php UM()->user()->pending(); ?>
|
||||
*
|
||||
@@ -1784,7 +1784,7 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
|
||||
|
||||
/**
|
||||
* This method rejects a user membership and sends them an optional e-mail.
|
||||
* This method rejects a user membership and sends them an optional email.
|
||||
*
|
||||
* @usage <?php UM()->user()->reject(); ?>
|
||||
*
|
||||
@@ -1811,7 +1811,7 @@ if ( ! class_exists( 'um\core\User' ) ) {
|
||||
|
||||
|
||||
/**
|
||||
* This method deactivates a user membership and sends them an optional e-mail.
|
||||
* This method deactivates a user membership and sends them an optional email.
|
||||
*
|
||||
* @usage <?php UM()->user()->deactivate(); ?>
|
||||
*
|
||||
|
||||
@@ -157,15 +157,15 @@ function um_submit_account_errors_hook( $args ) {
|
||||
if ( isset( $args['user_email'] ) ) {
|
||||
|
||||
if ( strlen( trim( $args['user_email'] ) ) === 0 ) {
|
||||
UM()->form()->add_error( 'user_email', __( 'You must provide your e-mail', 'ultimate-member' ) );
|
||||
UM()->form()->add_error( 'user_email', __( 'You must provide your email', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
if ( ! is_email( $args['user_email'] ) ) {
|
||||
UM()->form()->add_error( 'user_email', __( 'Please provide a valid e-mail', 'ultimate-member' ) );
|
||||
UM()->form()->add_error( 'user_email', __( 'Please provide a valid email', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
if ( email_exists( $args['user_email'] ) && email_exists( $args['user_email'] ) !== get_current_user_id() ) {
|
||||
UM()->form()->add_error( 'user_email', __( 'Please provide a valid e-mail', 'ultimate-member' ) );
|
||||
UM()->form()->add_error( 'user_email', __( 'Please provide a valid email', 'ultimate-member' ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -330,7 +330,7 @@ function um_submit_account_details( $args ) {
|
||||
$v = sanitize_text_field( $v );
|
||||
} elseif ( 'user_email' === $k ) {
|
||||
$v = sanitize_email( $v );
|
||||
} elseif ( 'hide_in_members' === $k ) {
|
||||
} elseif ( 'hide_in_members' === $k || 'um_show_last_login' === $k ) {
|
||||
$v = array_map( 'sanitize_text_field', $v );
|
||||
}
|
||||
|
||||
@@ -351,6 +351,13 @@ function um_submit_account_details( $args ) {
|
||||
}
|
||||
}
|
||||
|
||||
if ( isset( $changes['um_show_last_login'] ) ) {
|
||||
if ( 'yes' === $changes['um_show_last_login'] || array_intersect( array( 'yes' ), $changes['um_show_last_login'] ) ) {
|
||||
delete_user_meta( $user_id, 'um_show_last_login' );
|
||||
unset( $changes['um_show_last_login'] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
*
|
||||
@@ -552,8 +559,13 @@ add_action( 'um_after_user_account_updated', 'um_after_user_account_updated_perm
|
||||
* @param $changed
|
||||
*/
|
||||
function um_account_updated_notification( $user_id, $changed ) {
|
||||
um_fetch_user( $user_id );
|
||||
UM()->mail()->send( um_user( 'user_email' ), 'changedaccount_email' );
|
||||
// phpcs:disable WordPress.Security.NonceVerification
|
||||
if ( 'password' !== $_POST['_um_account_tab'] || ! UM()->options()->get( 'changedpw_email_on' ) ) {
|
||||
// Avoid email duplicates (account changed and password changed) on the password change tab.
|
||||
um_fetch_user( $user_id );
|
||||
UM()->mail()->send( um_user( 'user_email' ), 'changedaccount_email' );
|
||||
}
|
||||
// phpcs:enable WordPress.Security.NonceVerification
|
||||
}
|
||||
add_action( 'um_after_user_account_updated', 'um_account_updated_notification', 20, 2 );
|
||||
|
||||
@@ -612,7 +624,7 @@ function um_after_account_privacy( $args ) {
|
||||
$exports_url = wp_privacy_exports_url();
|
||||
|
||||
echo '<p>' . esc_html__( 'You could download your previous data:', 'ultimate-member' ) . '</p>';
|
||||
echo '<a href="' . esc_attr( $exports_url . get_post_meta( $completed['ID'], '_export_file_name', true ) ) . '">' . esc_html__( 'Download Personal Data', 'ultimate-member' ) . '</a>';
|
||||
echo '<a href="' . esc_url( $exports_url . get_post_meta( $completed['ID'], '_export_file_name', true ) ) . '">' . esc_html__( 'Download Personal Data', 'ultimate-member' ) . '</a>';
|
||||
echo '<p>' . esc_html__( 'You could send a new request for an export of personal your data.', 'ultimate-member' ) . '</p>';
|
||||
|
||||
}
|
||||
|
||||
@@ -821,7 +821,7 @@ function um_submit_form_errors_hook_( $submitted_data, $form_data ) {
|
||||
case 'soundcloud_url':
|
||||
if ( ! UM()->validation()->is_url( $submitted_data[ $key ], 'soundcloud.com' ) ) {
|
||||
// translators: %s: label.
|
||||
UM()->form()->add_error( $key, sprintf( __( 'Please enter a valid %s username or profile URL','ultimate-member'), $array['label'] ) );
|
||||
UM()->form()->add_error( $key, sprintf( __( 'Please enter a valid %s username or profile URL', 'ultimate-member' ), $array['label'] ) );
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -840,7 +840,6 @@ function um_submit_form_errors_hook_( $submitted_data, $form_data ) {
|
||||
break;
|
||||
|
||||
case 'instagram_url':
|
||||
|
||||
if ( ! UM()->validation()->is_url( $submitted_data[ $key ], 'instagram.com' ) ) {
|
||||
// translators: %s: label.
|
||||
UM()->form()->add_error( $key, sprintf( __( 'Please enter a valid %s profile URL', 'ultimate-member' ), $array['label'] ) );
|
||||
@@ -861,7 +860,6 @@ function um_submit_form_errors_hook_( $submitted_data, $form_data ) {
|
||||
break;
|
||||
|
||||
case 'tiktok_url':
|
||||
|
||||
if ( ! UM()->validation()->is_url( $submitted_data[ $key ], 'tiktok.com' ) ) {
|
||||
// translators: %s: label.
|
||||
UM()->form()->add_error( $key, sprintf( __( 'Please enter a valid %s profile URL', 'ultimate-member' ), $array['label'] ) );
|
||||
@@ -869,7 +867,6 @@ function um_submit_form_errors_hook_( $submitted_data, $form_data ) {
|
||||
break;
|
||||
|
||||
case 'twitch_url':
|
||||
|
||||
if ( ! UM()->validation()->is_url( $submitted_data[ $key ], 'twitch.tv' ) ) {
|
||||
// translators: %s: label.
|
||||
UM()->form()->add_error( $key, sprintf( __( 'Please enter a valid %s profile URL', 'ultimate-member' ), $array['label'] ) );
|
||||
@@ -877,7 +874,6 @@ function um_submit_form_errors_hook_( $submitted_data, $form_data ) {
|
||||
break;
|
||||
|
||||
case 'reddit_url':
|
||||
|
||||
if ( ! UM()->validation()->is_url( $submitted_data[ $key ], 'reddit.com' ) ) {
|
||||
// translators: %s: label.
|
||||
UM()->form()->add_error( $key, sprintf( __( 'Please enter a valid %s profile URL', 'ultimate-member' ), $array['label'] ) );
|
||||
@@ -891,126 +887,126 @@ function um_submit_form_errors_hook_( $submitted_data, $form_data ) {
|
||||
break;
|
||||
|
||||
case 'unique_username':
|
||||
|
||||
if ( $submitted_data[ $key ] == '' ) {
|
||||
if ( '' === $submitted_data[ $key ] ) {
|
||||
UM()->form()->add_error( $key, __( 'You must provide a username', 'ultimate-member' ) );
|
||||
} elseif ( $mode == 'register' && username_exists( sanitize_user( $submitted_data[ $key ] ) ) ) {
|
||||
} elseif ( 'register' === $mode && username_exists( sanitize_user( $submitted_data[ $key ] ) ) ) {
|
||||
UM()->form()->add_error( $key, __( 'The username you entered is incorrect', 'ultimate-member' ) );
|
||||
} elseif ( is_email( $submitted_data[ $key ] ) ) {
|
||||
UM()->form()->add_error( $key, __( 'Username cannot be an email', 'ultimate-member' ) );
|
||||
} elseif ( ! UM()->validation()->safe_username( $submitted_data[ $key ] ) ) {
|
||||
UM()->form()->add_error( $key, __( 'Your username contains invalid characters', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'unique_username_or_email':
|
||||
|
||||
if ( $submitted_data[ $key ] == '' ) {
|
||||
if ( '' === $submitted_data[ $key ] ) {
|
||||
UM()->form()->add_error( $key, __( 'You must provide a username or email', 'ultimate-member' ) );
|
||||
} elseif ( $mode == 'register' && username_exists( sanitize_user( $submitted_data[ $key ] ) ) ) {
|
||||
} elseif ( 'register' === $mode && username_exists( sanitize_user( $submitted_data[ $key ] ) ) ) {
|
||||
UM()->form()->add_error( $key, __( 'The username you entered is incorrect', 'ultimate-member' ) );
|
||||
} elseif ( $mode == 'register' && email_exists( $submitted_data[ $key ] ) ) {
|
||||
} elseif ( 'register' === $mode && email_exists( $submitted_data[ $key ] ) ) {
|
||||
UM()->form()->add_error( $key, __( 'The email you entered is incorrect', 'ultimate-member' ) );
|
||||
} elseif ( ! UM()->validation()->safe_username( $submitted_data[ $key ] ) ) {
|
||||
UM()->form()->add_error( $key, __( 'Your username contains invalid characters', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'unique_email':
|
||||
|
||||
$submitted_data[ $key ] = trim( $submitted_data[ $key ] );
|
||||
|
||||
if ( in_array( $key, array( 'user_email' ) ) ) {
|
||||
|
||||
if ( ! isset( $submitted_data['user_id'] ) ){
|
||||
if ( 'user_email' === $key ) {
|
||||
if ( ! isset( $submitted_data['user_id'] ) ) {
|
||||
$submitted_data['user_id'] = um_get_requested_user();
|
||||
}
|
||||
|
||||
$email_exists = email_exists( $submitted_data[ $key ] );
|
||||
|
||||
if ( $submitted_data[ $key ] == '' && in_array( $key, array( 'user_email' ) ) ) {
|
||||
if ( '' === $submitted_data[ $key ] ) {
|
||||
UM()->form()->add_error( $key, __( 'You must provide your email', 'ultimate-member' ) );
|
||||
} elseif ( in_array( $mode, array( 'register' ) ) && $email_exists ) {
|
||||
} elseif ( 'register' === $mode && $email_exists ) {
|
||||
UM()->form()->add_error( $key, __( 'The email you entered is incorrect', 'ultimate-member' ) );
|
||||
} elseif ( in_array( $mode, array( 'profile' ) ) && $email_exists && $email_exists != $submitted_data['user_id'] ) {
|
||||
} elseif ( 'profile' === $mode && $email_exists && $email_exists !== $submitted_data['user_id'] ) {
|
||||
UM()->form()->add_error( $key, __( 'The email you entered is incorrect', 'ultimate-member' ) );
|
||||
} elseif ( ! is_email( $submitted_data[ $key ] ) ) {
|
||||
UM()->form()->add_error( $key, __( 'The email you entered is incorrect', 'ultimate-member') );
|
||||
UM()->form()->add_error( $key, __( 'The email you entered is incorrect', 'ultimate-member' ) );
|
||||
} elseif ( ! UM()->validation()->safe_username( $submitted_data[ $key ] ) ) {
|
||||
UM()->form()->add_error( $key, __( 'Your email contains invalid characters', 'ultimate-member' ) );
|
||||
UM()->form()->add_error( $key, __( 'Your email contains invalid characters', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if ( $submitted_data[ $key ] != '' && ! is_email( $submitted_data[ $key ] ) ) {
|
||||
if ( '' !== $submitted_data[ $key ] && ! is_email( $submitted_data[ $key ] ) ) {
|
||||
UM()->form()->add_error( $key, __( 'The email you entered is incorrect', 'ultimate-member' ) );
|
||||
} elseif ( $submitted_data[ $key ] != '' && email_exists( $submitted_data[ $key ] ) ) {
|
||||
} elseif ( '' !== $submitted_data[ $key ] && email_exists( $submitted_data[ $key ] ) ) {
|
||||
UM()->form()->add_error( $key, __( 'The email you entered is incorrect', 'ultimate-member' ) );
|
||||
} elseif ( $submitted_data[ $key ] != '' ) {
|
||||
} elseif ( '' !== $submitted_data[ $key ] ) {
|
||||
|
||||
$users = get_users( 'meta_value=' . $submitted_data[ $key ] );
|
||||
|
||||
foreach ( $users as $user ) {
|
||||
if ( $user->ID != $submitted_data['user_id'] ) {
|
||||
if ( $user->ID !== $submitted_data['user_id'] ) {
|
||||
UM()->form()->add_error( $key, __( 'The email you entered is incorrect', 'ultimate-member' ) );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'is_email':
|
||||
|
||||
$submitted_data[ $key ] = trim( $submitted_data[ $key ] );
|
||||
|
||||
if ( $submitted_data[ $key ] != '' && ! is_email( $submitted_data[ $key ] ) ) {
|
||||
if ( '' !== $submitted_data[ $key ] && ! is_email( $submitted_data[ $key ] ) ) {
|
||||
UM()->form()->add_error( $key, __( 'This is not a valid email', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'unique_value':
|
||||
if ( '' !== $submitted_data[ $key ] ) {
|
||||
|
||||
if ( $submitted_data[ $key ] != '' ) {
|
||||
if ( ! isset( $submitted_data['user_id'] ) ) {
|
||||
$submitted_data['user_id'] = um_get_requested_user();
|
||||
}
|
||||
|
||||
$args_unique_meta = array(
|
||||
'meta_key' => $key,
|
||||
'meta_value' => $submitted_data[ $key ],
|
||||
'compare' => '=',
|
||||
'exclude' => array( $submitted_data['user_id'] ),
|
||||
'meta_key' => $key,
|
||||
'meta_value' => $submitted_data[ $key ],
|
||||
'compare' => '=',
|
||||
'exclude' => array( $submitted_data['user_id'] ),
|
||||
);
|
||||
|
||||
$meta_key_exists = get_users( $args_unique_meta );
|
||||
|
||||
if ( $meta_key_exists ) {
|
||||
UM()->form()->add_error( $key , __( 'You must provide a unique value', 'ultimate-member' ) );
|
||||
UM()->form()->add_error( $key, __( 'You must provide a unique value', 'ultimate-member' ) );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'alphabetic':
|
||||
|
||||
if ( $submitted_data[ $key ] != '' ) {
|
||||
|
||||
if ( '' !== $submitted_data[ $key ] ) {
|
||||
if ( ! preg_match( '/^\p{L}+$/u', str_replace( ' ', '', $submitted_data[ $key ] ) ) ) {
|
||||
UM()->form()->add_error( $key, __( 'You must provide alphabetic letters', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case 'alpha_numeric':
|
||||
if ( '' !== $submitted_data[ $key ] ) {
|
||||
if ( ! preg_match( '/^[\p{L}0-9\s]+$/u', str_replace( ' ', '', $submitted_data[ $key ] ) ) ) {
|
||||
UM()->form()->add_error( $key, __( 'You must provide alphabetic letters or numbers', 'ultimate-member' ) );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'lowercase':
|
||||
if ( '' !== $submitted_data[ $key ] ) {
|
||||
if ( ! ctype_lower( str_replace( ' ', '', $submitted_data[ $key ] ) ) ) {
|
||||
UM()->form()->add_error( $key, __( 'You must provide lowercase letters.', 'ultimate-member' ) );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
if ( $submitted_data[ $key ] != '' ) {
|
||||
|
||||
if ( ! ctype_lower( str_replace(' ', '', $submitted_data[ $key ] ) ) ) {
|
||||
UM()->form()->add_error( $key , __( 'You must provide lowercase letters.', 'ultimate-member' ) );
|
||||
case 'english':
|
||||
if ( '' !== $submitted_data[ $key ] ) {
|
||||
if ( ! preg_match( '/^[a-zA-Z]*$/u', str_replace( ' ', '', $submitted_data[ $key ] ) ) ) {
|
||||
UM()->form()->add_error( $key, __( 'You must provide English letters.', 'ultimate-member' ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1076,9 +1072,12 @@ add_action( 'um_submit_form_errors_hook_', 'um_submit_form_errors_hook_', 10, 2
|
||||
* @return string
|
||||
*/
|
||||
function um_invalid_nonce_redirect_url( $url ) {
|
||||
$url = add_query_arg( [
|
||||
'um-hash' => substr( md5( rand() ), 0, 6 ),
|
||||
], remove_query_arg( 'um-hash', $url ) );
|
||||
$url = add_query_arg(
|
||||
array(
|
||||
'um-hash' => substr( md5( rand() ), 0, 6 ),
|
||||
),
|
||||
remove_query_arg( 'um-hash', $url )
|
||||
);
|
||||
|
||||
return $url;
|
||||
}
|
||||
|
||||
@@ -168,7 +168,7 @@ function um_add_update_notice( $args ) {
|
||||
$err = __( 'Your account has not been approved yet.', 'ultimate-member' );
|
||||
break;
|
||||
case 'awaiting_email_confirmation':
|
||||
$err = __( 'Your account is awaiting e-mail verification.', 'ultimate-member' );
|
||||
$err = __( 'Your account is awaiting email verification.', 'ultimate-member' );
|
||||
break;
|
||||
case 'rejected':
|
||||
$err = __( 'Your membership request has been rejected.', 'ultimate-member' );
|
||||
|
||||
@@ -1017,7 +1017,7 @@ function um_profile_header( $args ) {
|
||||
*/
|
||||
do_action( 'um_pre_header_editprofile', $args ); ?>
|
||||
|
||||
<div class="um-profile-photo" data-user_id="<?php echo esc_attr( um_profile_id() ); ?>" <?php echo esc_html( UM()->fields()->aria_valid_attributes( UM()->fields()->is_error( 'profile_photo' ), 'profile_photo' ) ); ?>>
|
||||
<div class="um-profile-photo" data-user_id="<?php echo esc_attr( um_profile_id() ); ?>" <?php echo wp_kses( UM()->fields()->aria_valid_attributes( UM()->fields()->is_error( 'profile_photo' ), 'profile_photo' ), UM()->get_allowed_html( 'templates' ) ); ?>>
|
||||
|
||||
<a href="<?php echo esc_url( um_user_profile_url() ); ?>" class="um-profile-photo-img" title="<?php echo esc_attr( um_user( 'display_name' ) ); ?>">
|
||||
<?php if ( ! $default_size || $default_size == 'original' ) {
|
||||
@@ -1278,7 +1278,7 @@ function um_profile_header( $args ) {
|
||||
<textarea id="um-meta-bio" data-html="<?php echo esc_attr( $bio_html ); ?>"
|
||||
data-character-limit="<?php echo esc_attr( $limit ); ?>"
|
||||
placeholder="<?php esc_attr_e( 'Tell us a bit about yourself...', 'ultimate-member' ); ?>"
|
||||
name="<?php echo esc_attr( $description_key ); ?>" <?php echo esc_html( UM()->fields()->aria_valid_attributes( UM()->fields()->is_error( $description_key ), 'um-meta-bio' ) ); ?>><?php echo esc_textarea( $description_value ); ?></textarea>
|
||||
name="<?php echo esc_attr( $description_key ); ?>" <?php echo wp_kses( UM()->fields()->aria_valid_attributes( UM()->fields()->is_error( $description_key ), 'um-meta-bio' ), UM()->get_allowed_html( 'templates' ) ); ?>><?php echo esc_textarea( $description_value ); ?></textarea>
|
||||
<span class="um-meta-bio-character um-right">
|
||||
<span class="um-bio-limit"><?php echo esc_html( $limit ); ?></span>
|
||||
</span>
|
||||
@@ -1576,7 +1576,8 @@ function um_submit_form_profile( $args, $form_data ) {
|
||||
* function my_user_edit_profile( $post, $form_data ) {
|
||||
* // your code here
|
||||
* }
|
||||
* add_action( 'um_user_edit_profile', 'my_user_edit_profile', 10, 2 );
|
||||
* // Don't use priority >= 10 because there is native Ultimate Member handler on it.
|
||||
* add_action( 'um_user_edit_profile', 'my_user_edit_profile', 9, 2 );
|
||||
*/
|
||||
do_action( 'um_user_edit_profile', $args, $form_data );
|
||||
}
|
||||
|
||||
@@ -766,7 +766,7 @@ add_action( 'um_registration_set_extra_data', 'um_registration_set_profile_full_
|
||||
* 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' ) );
|
||||
$page_id = UM()->options()->get( UM()->options()->get_predefined_page_option_key( 'register' ) );
|
||||
// Do not redirect if the registration page is not published.
|
||||
if ( ! empty( $page_id ) && 'publish' === get_post_status( $page_id ) ) {
|
||||
// Not `um_safe_redirect()` because predefined register page is situated on the same host.
|
||||
|
||||
@@ -1,37 +1,38 @@
|
||||
<?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Control comment author display
|
||||
* Control comment author display.
|
||||
*
|
||||
* @param $return
|
||||
* @param $author
|
||||
* @param $comment_ID
|
||||
* @param string $return The HTML-formatted comment author link.
|
||||
* @param string $author The comment author's username.
|
||||
* @param string $comment_id The comment ID as a numeric string.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function um_comment_link_to_profile( $return, $author, $comment_ID ) {
|
||||
function um_comment_link_to_profile( $return, $author, $comment_id ) {
|
||||
$comment = get_comment( $comment_id );
|
||||
|
||||
$comment = get_comment( $comment_ID );
|
||||
|
||||
if( isset( $comment->user_id ) && ! empty( $comment->user_id ) ){
|
||||
if ( ! empty( $comment->user_id ) ) {
|
||||
if ( isset( UM()->user()->cached_user[ $comment->user_id ] ) && UM()->user()->cached_user[ $comment->user_id ] ) {
|
||||
|
||||
$return = '<a href="'. UM()->user()->cached_user[$comment->user_id]['url'] . '">' . UM()->user()->cached_user[$comment->user_id]['name'] . '</a>';
|
||||
|
||||
$return = '<a href="' . esc_url( UM()->user()->cached_user[ $comment->user_id ]['url'] ) . '">' . UM()->user()->cached_user[ $comment->user_id ]['name'] . '</a>';
|
||||
} else {
|
||||
|
||||
um_fetch_user( $comment->user_id );
|
||||
|
||||
UM()->user()->cached_user[ $comment->user_id ] = array('url' => um_user_profile_url(), 'name' => um_user('display_name') );
|
||||
$return = '<a href="'. UM()->user()->cached_user[$comment->user_id]['url'] . '">' . UM()->user()->cached_user[$comment->user_id]['name'] . '</a>';
|
||||
UM()->user()->cached_user[ $comment->user_id ] = array(
|
||||
'url' => um_user_profile_url(),
|
||||
'name' => um_user( 'display_name' ),
|
||||
);
|
||||
|
||||
$return = '<a href="' . esc_url( UM()->user()->cached_user[ $comment->user_id ]['url'] ) . '">' . UM()->user()->cached_user[ $comment->user_id ]['name'] . '</a>';
|
||||
|
||||
um_reset_user();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
add_filter('get_comment_author_link', 'um_comment_link_to_profile', 10000, 3 );
|
||||
add_filter( 'get_comment_author_link', 'um_comment_link_to_profile', 10000, 3 );
|
||||
|
||||
@@ -3,24 +3,6 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Field is required?
|
||||
*
|
||||
* @param $label
|
||||
* @param $data
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function um_edit_label_all_fields( $label, $data ) {
|
||||
$asterisk = UM()->options()->get( 'form_asterisk' );
|
||||
if ( $asterisk && ! empty( $data['required'] ) ) {
|
||||
$label .= '<span class="um-req" title="' . esc_attr__( 'Required', 'ultimate-member' ) . '">*</span>';
|
||||
}
|
||||
|
||||
return $label;
|
||||
}
|
||||
add_filter( 'um_edit_label_all_fields', 'um_edit_label_all_fields', 10, 2 );
|
||||
|
||||
/**
|
||||
* Outputs a oEmbed field
|
||||
*
|
||||
@@ -114,7 +96,7 @@ add_filter( 'um_profile_field_filter_hook__youtube_video', 'um_profile_field_fil
|
||||
function um_profile_field_filter_hook__spotify( $value, $data ) {
|
||||
if ( preg_match( '/https:\/\/open.spotify.com\/.*/', $value ) ) {
|
||||
if ( false !== strpos( $value, '/user/' ) ) {
|
||||
$value = '<a href="' . esc_attr( $value ) . '" target="_blank">' . esc_html( $value ) . '</a>';
|
||||
$value = '<a href="' . esc_url( $value ) . '" target="_blank">' . esc_html( $value ) . '</a>';
|
||||
} else {
|
||||
$url = str_replace( 'open.spotify.com/', 'open.spotify.com/embed/', $value );
|
||||
|
||||
@@ -162,12 +144,10 @@ add_filter( 'um_profile_field_filter_hook__vimeo_video', 'um_profile_field_filte
|
||||
* @return int|string
|
||||
*/
|
||||
function um_profile_field_filter_hook__phone( $value, $data ) {
|
||||
$value = '<a href="tel:' . esc_attr( $value ) . '" rel="nofollow" title="' . esc_attr( $data['title'] ) . '">' . esc_html( $value ) . '</a>';
|
||||
$value = '<a href="' . esc_url( 'tel:' . $value ) . '" rel="nofollow" title="' . esc_attr( $data['title'] ) . '">' . esc_html( $value ) . '</a>';
|
||||
return $value;
|
||||
}
|
||||
add_filter( 'um_profile_field_filter_hook__phone_number', 'um_profile_field_filter_hook__phone', 99, 2 );
|
||||
add_filter( 'um_profile_field_filter_hook__mobile_number', 'um_profile_field_filter_hook__phone', 99, 2 );
|
||||
|
||||
add_filter( 'um_profile_field_filter_hook__tel', 'um_profile_field_filter_hook__phone', 99, 2 );
|
||||
|
||||
/**
|
||||
* Outputs a viber link
|
||||
@@ -178,8 +158,9 @@ add_filter( 'um_profile_field_filter_hook__mobile_number', 'um_profile_field_fil
|
||||
* @return int|string
|
||||
*/
|
||||
function um_profile_field_filter_hook__viber( $value, $data ) {
|
||||
$value = str_replace('+', '', $value);
|
||||
$value = '<a href="viber://chat?number=%2B' . esc_attr( $value ) . '" target="_blank" rel="nofollow" title="' . esc_attr( $data['title'] ) . '">' . esc_html( $value ) . '</a>';
|
||||
$value = str_replace( '+', '', $value );
|
||||
$url = 'viber://chat?number=%2B' . $value;
|
||||
$value = '<a href="' . esc_url( $url, array( 'viber' ) ) . '" target="_blank" rel="nofollow" title="' . esc_attr( $data['title'] ) . '">' . esc_html( $value ) . '</a>';
|
||||
return $value;
|
||||
}
|
||||
add_filter( 'um_profile_field_filter_hook__viber', 'um_profile_field_filter_hook__viber', 99, 2 );
|
||||
@@ -194,8 +175,9 @@ add_filter( 'um_profile_field_filter_hook__viber', 'um_profile_field_filter_hook
|
||||
* @return int|string
|
||||
*/
|
||||
function um_profile_field_filter_hook__whatsapp( $value, $data ) {
|
||||
$value = str_replace('+', '', $value);
|
||||
$value = '<a href="https://api.whatsapp.com/send?phone=' . esc_attr( $value ) . '" target="_blank" rel="nofollow" title="' . esc_attr( $data['title'] ) . '">' . esc_html( $value ) . '</a>';
|
||||
$value = str_replace( '+', '', $value );
|
||||
$url = add_query_arg( array( 'phone' => $value ), 'https://api.whatsapp.com/send' );
|
||||
$value = '<a href="' . esc_url( $url ) . '" target="_blank" rel="nofollow" title="' . esc_attr( $data['title'] ) . '">' . esc_html( $value ) . '</a>';
|
||||
return $value;
|
||||
}
|
||||
add_filter( 'um_profile_field_filter_hook__whatsapp', 'um_profile_field_filter_hook__whatsapp', 99, 2 );
|
||||
@@ -391,7 +373,7 @@ function um_profile_field_filter_hook__file( $value, $data ) {
|
||||
}
|
||||
$value = '<div class="um-single-file-preview show">
|
||||
<div class="um-single-fileinfo">
|
||||
<a href="' . esc_attr( $uri ) . '" target="_blank">
|
||||
<a href="' . esc_url( $uri ) . '" target="_blank">
|
||||
<span class="icon" style="background:'. UM()->files()->get_fonticon_bg_by_ext( $file_type['ext'] ) . '"><i class="'. UM()->files()->get_fonticon_by_ext( $file_type['ext'] ) .'"></i></span>
|
||||
<span class="filename">' . esc_attr( $value ) . '</span>
|
||||
</a>
|
||||
@@ -465,11 +447,13 @@ function um_profile_field_filter_hook__( $value, $data, $type = '' ) {
|
||||
$url_rel = ( isset( $data['url_rel'] ) && 'nofollow' === $data['url_rel'] ) ? 'rel="nofollow"' : '';
|
||||
$data['url_target'] = ( isset( $data['url_target'] ) ) ? $data['url_target'] : '_blank';
|
||||
|
||||
$protocols = wp_allowed_protocols();
|
||||
if ( false === strstr( $value, 'join.skype.com' ) ) {
|
||||
$value = 'skype:' . $value . '?chat';
|
||||
$protocols[] = 'skype';
|
||||
}
|
||||
|
||||
$value = '<a href="' . esc_attr( $value ) . '" title="' . esc_attr( $alt ) . '" target="' . esc_attr( $data['url_target'] ) . '" ' . $url_rel . '>' . esc_html( $alt ) . '</a>';
|
||||
$value = '<a href="' . esc_url( $value, $protocols ) . '" title="' . esc_attr( $alt ) . '" target="' . esc_attr( $data['url_target'] ) . '" ' . $url_rel . '>' . esc_html( $alt ) . '</a>';
|
||||
} else {
|
||||
// check $value is oEmbed
|
||||
if ( 'oembed' === $data['type'] ) {
|
||||
@@ -545,7 +529,7 @@ function um_profile_field_filter_hook__( $value, $data, $type = '' ) {
|
||||
|
||||
if ( ! is_array( $value ) ) {
|
||||
if ( is_email( $value ) ) {
|
||||
$value = '<a href="mailto:' . $value . '" title="' . $value . '">' . $value . '</a>';
|
||||
$value = '<a href="' . esc_url( 'mailto:' . $value ) . '" title="' . $value . '">' . $value . '</a>';
|
||||
}
|
||||
} else {
|
||||
$value = implode( ', ', $value );
|
||||
|
||||
@@ -53,45 +53,46 @@ function um_wp_form_errors_hook_ip_test( $user, $username, $password ) {
|
||||
}
|
||||
add_filter( 'authenticate', 'um_wp_form_errors_hook_ip_test', 10, 3 );
|
||||
|
||||
|
||||
/**
|
||||
* Login checks through the WordPress admin login.
|
||||
*
|
||||
* @param $user
|
||||
* @param $username
|
||||
* @param $password
|
||||
* @param WP_Error|WP_User $user
|
||||
*
|
||||
* @return WP_Error|WP_User
|
||||
*/
|
||||
function um_wp_form_errors_hook_logincheck( $user, $username, $password ) {
|
||||
function um_wp_form_errors_hook_logincheck( $user ) {
|
||||
if ( is_wp_error( $user ) ) {
|
||||
return $user;
|
||||
}
|
||||
|
||||
if ( isset( $user->ID ) ) {
|
||||
|
||||
um_fetch_user( $user->ID );
|
||||
$status = um_user( 'account_status' );
|
||||
|
||||
switch( $status ) {
|
||||
$error = null;
|
||||
switch ( $status ) {
|
||||
case 'inactive':
|
||||
return new WP_Error( $status, __( 'Your account has been disabled.', 'ultimate-member' ) );
|
||||
$error = new WP_Error( $status, __( 'Your account has been disabled.', 'ultimate-member' ) );
|
||||
break;
|
||||
case 'awaiting_admin_review':
|
||||
return new WP_Error( $status, __( 'Your account has not been approved yet.', 'ultimate-member' ) );
|
||||
$error = new WP_Error( $status, __( 'Your account has not been approved yet.', 'ultimate-member' ) );
|
||||
break;
|
||||
case 'awaiting_email_confirmation':
|
||||
return new WP_Error( $status, __( 'Your account is awaiting e-mail verification.', 'ultimate-member' ) );
|
||||
$error = new WP_Error( $status, __( 'Your account is awaiting email verification.', 'ultimate-member' ) );
|
||||
break;
|
||||
case 'rejected':
|
||||
return new WP_Error( $status, __( 'Your membership request has been rejected.', 'ultimate-member' ) );
|
||||
$error = new WP_Error( $status, __( 'Your membership request has been rejected.', 'ultimate-member' ) );
|
||||
break;
|
||||
}
|
||||
|
||||
if ( null !== $error ) {
|
||||
return $error;
|
||||
}
|
||||
}
|
||||
|
||||
return $user;
|
||||
|
||||
}
|
||||
add_filter( 'authenticate', 'um_wp_form_errors_hook_logincheck', 50, 3 );
|
||||
|
||||
add_filter( 'authenticate', 'um_wp_form_errors_hook_logincheck', 50 );
|
||||
|
||||
/**
|
||||
* Change lost password url in UM Login form
|
||||
|
||||
@@ -34,7 +34,7 @@ function um_admin_user_actions_hook( $actions, $user_id ) {
|
||||
}
|
||||
|
||||
if ( 'awaiting_email_confirmation' === $account_status ) {
|
||||
$actions['um_resend_activation'] = array( 'label' => __( 'Resend Activation E-mail', 'ultimate-member' ) );
|
||||
$actions['um_resend_activation'] = array( 'label' => __( 'Resend Activation Email', 'ultimate-member' ) );
|
||||
}
|
||||
|
||||
if ( 'inactive' !== $account_status ) {
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
* Deprecated Ultimate Member hooks.
|
||||
* The place for hookdocs of the Ultimate Member hooks that have been deprecated.
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters the language locale before loading textdomain.
|
||||
*
|
||||
* @param {string} $language_locale Current language locale.
|
||||
*
|
||||
* @return {string} Maybe changed language locale.
|
||||
*
|
||||
* @since 1.3.x
|
||||
* @depecated 2.8.5 Used WordPress native `load_plugin_textdomain()`. And can be replaced via WordPress native hook 'plugin_locale'.
|
||||
* @hook um_language_locale
|
||||
*
|
||||
* @example <caption>Change UM language locale.</caption>
|
||||
* function my_um_language_locale( $language_locale ) {
|
||||
* $language_locale = 'es_ES';
|
||||
* return $language_locale;
|
||||
* }
|
||||
* add_filter( 'um_language_locale', 'my_um_language_locale' );
|
||||
*/
|
||||
|
||||
/**
|
||||
* Filters the path to the language file (*.mo).
|
||||
*
|
||||
* @param {string} $language_file Default path to the language file.
|
||||
*
|
||||
* @return {string} Language file path.
|
||||
*
|
||||
* @since 1.3.x
|
||||
* @depecated 2.8.5 Used WordPress native `load_plugin_textdomain()`. And can be replaced via WordPress native hook 'load_textdomain_mofile'.
|
||||
* @hook um_language_file
|
||||
*
|
||||
* @example <caption>Change UM language file path.</caption>
|
||||
* function my_um_language_file( $language_file ) {
|
||||
* $language_file = '{path-to-language-file}';
|
||||
* return $language_file;
|
||||
* }
|
||||
* add_filter( 'um_language_file', 'my_um_language_file' );
|
||||
*/
|
||||
@@ -870,7 +870,7 @@ function um_user_submited_display( $k, $title, $data = array(), $style = true )
|
||||
}
|
||||
|
||||
if ( ! empty( $filedata['original_name'] ) ) {
|
||||
$v = '<a class="um-preview-upload" target="_blank" href="' . esc_attr( $baseurl . um_user( 'ID' ) . '/' . $file ) . '">' . esc_html( $filedata['original_name'] ) . '</a>';
|
||||
$v = '<a class="um-preview-upload" target="_blank" href="' . esc_url( $baseurl . um_user( 'ID' ) . '/' . $file ) . '">' . esc_html( $filedata['original_name'] ) . '</a>';
|
||||
} else {
|
||||
$v = $baseurl . um_user( 'ID' ) . '/' . $file;
|
||||
}
|
||||
@@ -1751,7 +1751,7 @@ function um_can_edit_my_profile() {
|
||||
|
||||
|
||||
/**
|
||||
* Short for admin e-mail
|
||||
* Short for admin email
|
||||
*
|
||||
* @return mixed|string|void
|
||||
*/
|
||||
@@ -1761,7 +1761,7 @@ function um_admin_email() {
|
||||
|
||||
|
||||
/**
|
||||
* Get admin e-mails
|
||||
* Get admin emails
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user