mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-16 13:13:33 +09:00
Merge pull request #1408 from ultimatemember/feature/wp_admin_settings
Ultimate Member > Settings redesign
This commit is contained in:
@@ -1,9 +1,6 @@
|
||||
.um-form-table .um-forms-line[data-conditional] {
|
||||
display: none; }
|
||||
|
||||
.um-form-table .um-forms-line[data-field_type="checkbox"] td label {
|
||||
font-style: italic; }
|
||||
|
||||
.um-form-table .um-forms-line label .um-req {
|
||||
color: #a00;
|
||||
margin: 0 0 0 3px;
|
||||
@@ -68,10 +65,6 @@
|
||||
display: block;
|
||||
margin: 0 0 5px 0; }
|
||||
|
||||
.um-form-table .description {
|
||||
font-style: italic;
|
||||
clear: both; }
|
||||
|
||||
.um_admin_fonticon_wrapper {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -7,10 +7,6 @@
|
||||
.#{$prefix}forms-line
|
||||
&[data-conditional]
|
||||
display: none
|
||||
&[data-field_type="checkbox"]
|
||||
td
|
||||
label
|
||||
font-style: italic
|
||||
label
|
||||
.#{$prefix}req
|
||||
color: $required-asterisk
|
||||
@@ -95,9 +91,9 @@
|
||||
width: 100%
|
||||
display: block
|
||||
margin: 0 0 5px 0
|
||||
.description
|
||||
font-style: italic
|
||||
clear: both
|
||||
//.description
|
||||
// font-style: italic
|
||||
// clear: both
|
||||
|
||||
.um_admin_fonticon_wrapper
|
||||
+flex( row, flex-start, center, nowrap )
|
||||
|
||||
@@ -1,14 +1,3 @@
|
||||
#um-settings-wrap .subsubsub {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
margin-left: -3px;
|
||||
margin-right: -3px; }
|
||||
#um-settings-wrap .subsubsub a {
|
||||
margin: 0 3px; }
|
||||
|
||||
.um-settings-section .description {
|
||||
font-style: italic; }
|
||||
|
||||
@@ -37,8 +26,8 @@
|
||||
width: 25%; }
|
||||
|
||||
.column-configure {
|
||||
width: 60px;
|
||||
text-align: center; }
|
||||
width: 10%;
|
||||
text-align: right; }
|
||||
|
||||
th.column-email.column-primary {
|
||||
padding-left: 48px; }
|
||||
@@ -46,16 +35,19 @@ th.column-email.column-primary {
|
||||
.um-form-table .um-forms-line td {
|
||||
padding-right: 0; }
|
||||
|
||||
#um-settings-template-versions .wp-list-table .column-core_version {
|
||||
width: 100px;
|
||||
text-align: center; }
|
||||
#um-settings-emails {
|
||||
margin: 15px 0; }
|
||||
|
||||
#um-settings-template-versions .wp-list-table .column-theme_version {
|
||||
width: 100px;
|
||||
text-align: center; }
|
||||
|
||||
#um-settings-template-versions .wp-list-table .column-status {
|
||||
width: 260px; }
|
||||
#um-settings-template-versions {
|
||||
margin: 15px 0; }
|
||||
#um-settings-template-versions .wp-list-table .column-core_version {
|
||||
width: 100px;
|
||||
text-align: center; }
|
||||
#um-settings-template-versions .wp-list-table .column-theme_version {
|
||||
width: 100px;
|
||||
text-align: center; }
|
||||
#um-settings-template-versions .wp-list-table .column-status {
|
||||
width: 260px; }
|
||||
|
||||
#um-settings-form {
|
||||
float: left;
|
||||
@@ -64,6 +56,12 @@ th.column-email.column-primary {
|
||||
#um-settings-form .subsubsub {
|
||||
float: left;
|
||||
width: 100%; }
|
||||
#um-settings-form h2.title a.um-back-button {
|
||||
font-weight: normal;
|
||||
font-size: 30px;
|
||||
line-height: 1;
|
||||
text-decoration: none;
|
||||
margin-right: 5px; }
|
||||
|
||||
.um-settings-line .multi-checkbox-line {
|
||||
float: left;
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
#um-settings-wrap .subsubsub{display:flex;flex-direction:row;justify-content:flex-start;align-items:center;flex-wrap:wrap;margin-left:-3px;margin-right:-3px}#um-settings-wrap .subsubsub a{margin:0 3px}.um-settings-section .description{font-style:italic}.um-notification-status{margin-right:18px;font-size:28px;line-height:22px;color:#c74a4a;float:left;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box}.um-notification-status.um-notification-is-active{color:#7acf58}.um-email-configure span{line-height:24px}.um-long-field{width:100%}.um-medium-field{width:50%}.um-small-field{width:25%}.column-configure{width:60px;text-align:center}th.column-email.column-primary{padding-left:48px}.um-form-table .um-forms-line td{padding-right:0}#um-settings-template-versions .wp-list-table .column-core_version{width:100px;text-align:center}#um-settings-template-versions .wp-list-table .column-theme_version{width:100px;text-align:center}#um-settings-template-versions .wp-list-table .column-status{width:260px}#um-settings-form{float:left;width:100%;margin:0}#um-settings-form .subsubsub{float:left;width:100%}.um-settings-line .multi-checkbox-line{float:left;width:100%;clear:both;margin:0 0 10px 0;padding:0}.um-settings-line .multi-checkbox-column{float:left;margin:0;padding:0}.um-settings-line .multi-checkbox-column label{float:left;width:100%}.wrap-licenses .form-table,.wrap-licenses caption,.wrap-licenses tbody,.wrap-licenses td,.wrap-licenses tfoot,.wrap-licenses th,.wrap-licenses thead,.wrap-licenses tr{display:block}.wrap-licenses .form-table tr{float:left;margin:0 15px 15px 0;background:#fff;border:1px solid #ccc;width:30.5%;max-width:350px;padding:14px;min-height:240px;position:relative;box-sizing:border-box}.wrap-licenses .form-table th{background:#f9f9f9;padding:14px;border-bottom:1px solid #ccc;margin:-14px -14px 20px;width:100%}.wrap-licenses .form-table td{padding:0}.wrap-licenses td input.regular-text{margin:0 0 8px;width:100%}.wrap-licenses .edd-license-data[class*=edd-license-]{position:absolute;background:#fafafa;padding:14px;border-top:1px solid #eee;margin:20px -14px -14px;min-height:67px;width:100%;bottom:14px;box-sizing:border-box}.wrap-licenses .edd-license-data[class*=edd-license-] a{color:#444}.wrap-licenses .edd-license-data[class*=edd-license-] a:hover{text-decoration:none}.wrap-licenses .edd-license-data.license-expires-soon-notice{background-color:#00a0d2;color:#fff;border-color:#00a0d2}.wrap-licenses .edd-license-data.license-expires-soon-notice a{color:#fff}.wrap-licenses .edd-license-data.license-expires-soon-notice a:hover{text-decoration:none}.wrap-licenses .edd-license-data.edd-license-expired{background-color:#e24e4e;color:#fff;border-color:#e24e4e}.wrap-licenses .edd-license-data.edd-license-expired a{color:#fff}.wrap-licenses .edd-license-data.edd-license-expired a:hover{text-decoration:none}.wrap-licenses .edd-license-data.edd-license-valid{background-color:#5abc55;color:#fff;border-color:#5abc55}.wrap-licenses .edd-license-data.edd-license-error,.wrap-licenses .edd-license-data.edd-license-invalid,.wrap-licenses .edd-license-data.edd-license-item_name_mismatch,.wrap-licenses .edd-license-data.edd-license-missing,.wrap-licenses .edd-license-data.edd-license-site_inactive{background-color:#ffebcd;border-color:#ffebcd}.wrap-licenses .edd-license-data p{font-size:13px;margin-top:0}.wrap-licenses~p.submit{clear:both}@media screen and (max-width:980px){.wrap-licenses .form-table tr{width:calc(50% - 15px);max-width:none}}@media screen and (max-width:782px){#um-settings-template-versions .wp-list-table .column-core_version,#um-settings-template-versions .wp-list-table .column-theme_version{width:auto;text-align:left}.wrap-licenses .form-table tr{width:100%;margin-right:0;max-width:none}.um-settings-line .multi-checkbox-column{width:100%!important}.um-settings-line .multi-checkbox-column label{line-height:30px!important}.um-medium-field{width:100%}.um-small-field{width:50%}}.um_setting_ajax_button_response.complete{color:#7acf58;font-style:italic}.wp-core-ui .button.um_license_activate,.wp-core-ui .button.um_license_deactivate,.wp-core-ui .button.um_license_reactivate{margin-top:5px}.um-media-upload .um-media-upload-url{margin-bottom:5px}
|
||||
.um-settings-section .description{font-style:italic}.um-notification-status{margin-right:18px;font-size:28px;line-height:22px;color:#c74a4a;float:left;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box}.um-notification-status.um-notification-is-active{color:#7acf58}.um-email-configure span{line-height:24px}.um-long-field{width:100%}.um-medium-field{width:50%}.um-small-field{width:25%}.column-configure{width:10%;text-align:right}th.column-email.column-primary{padding-left:48px}.um-form-table .um-forms-line td{padding-right:0}#um-settings-emails{margin:15px 0}#um-settings-template-versions{margin:15px 0}#um-settings-template-versions .wp-list-table .column-core_version{width:100px;text-align:center}#um-settings-template-versions .wp-list-table .column-theme_version{width:100px;text-align:center}#um-settings-template-versions .wp-list-table .column-status{width:260px}#um-settings-form{float:left;width:100%;margin:0}#um-settings-form .subsubsub{float:left;width:100%}#um-settings-form h2.title a.um-back-button{font-weight:400;font-size:30px;line-height:1;text-decoration:none;margin-right:5px}.um-settings-line .multi-checkbox-line{float:left;width:100%;clear:both;margin:0 0 10px 0;padding:0}.um-settings-line .multi-checkbox-column{float:left;margin:0;padding:0}.um-settings-line .multi-checkbox-column label{float:left;width:100%}.wrap-licenses .form-table,.wrap-licenses caption,.wrap-licenses tbody,.wrap-licenses td,.wrap-licenses tfoot,.wrap-licenses th,.wrap-licenses thead,.wrap-licenses tr{display:block}.wrap-licenses .form-table tr{float:left;margin:0 15px 15px 0;background:#fff;border:1px solid #ccc;width:30.5%;max-width:350px;padding:14px;min-height:240px;position:relative;box-sizing:border-box}.wrap-licenses .form-table th{background:#f9f9f9;padding:14px;border-bottom:1px solid #ccc;margin:-14px -14px 20px;width:100%}.wrap-licenses .form-table td{padding:0}.wrap-licenses td input.regular-text{margin:0 0 8px;width:100%}.wrap-licenses .edd-license-data[class*=edd-license-]{position:absolute;background:#fafafa;padding:14px;border-top:1px solid #eee;margin:20px -14px -14px;min-height:67px;width:100%;bottom:14px;box-sizing:border-box}.wrap-licenses .edd-license-data[class*=edd-license-] a{color:#444}.wrap-licenses .edd-license-data[class*=edd-license-] a:hover{text-decoration:none}.wrap-licenses .edd-license-data.license-expires-soon-notice{background-color:#00a0d2;color:#fff;border-color:#00a0d2}.wrap-licenses .edd-license-data.license-expires-soon-notice a{color:#fff}.wrap-licenses .edd-license-data.license-expires-soon-notice a:hover{text-decoration:none}.wrap-licenses .edd-license-data.edd-license-expired{background-color:#e24e4e;color:#fff;border-color:#e24e4e}.wrap-licenses .edd-license-data.edd-license-expired a{color:#fff}.wrap-licenses .edd-license-data.edd-license-expired a:hover{text-decoration:none}.wrap-licenses .edd-license-data.edd-license-valid{background-color:#5abc55;color:#fff;border-color:#5abc55}.wrap-licenses .edd-license-data.edd-license-error,.wrap-licenses .edd-license-data.edd-license-invalid,.wrap-licenses .edd-license-data.edd-license-item_name_mismatch,.wrap-licenses .edd-license-data.edd-license-missing,.wrap-licenses .edd-license-data.edd-license-site_inactive{background-color:#ffebcd;border-color:#ffebcd}.wrap-licenses .edd-license-data p{font-size:13px;margin-top:0}.wrap-licenses~p.submit{clear:both}@media screen and (max-width:980px){.wrap-licenses .form-table tr{width:calc(50% - 15px);max-width:none}}@media screen and (max-width:782px){#um-settings-template-versions .wp-list-table .column-core_version,#um-settings-template-versions .wp-list-table .column-theme_version{width:auto;text-align:left}.wrap-licenses .form-table tr{width:100%;margin-right:0;max-width:none}.um-settings-line .multi-checkbox-column{width:100%!important}.um-settings-line .multi-checkbox-column label{line-height:30px!important}.um-medium-field{width:100%}.um-small-field{width:50%}}.um_setting_ajax_button_response.complete{color:#7acf58;font-style:italic}.wp-core-ui .button.um_license_activate,.wp-core-ui .button.um_license_deactivate,.wp-core-ui .button.um_license_reactivate{margin-top:5px}.um-media-upload .um-media-upload-url{margin-bottom:5px}
|
||||
@@ -2,13 +2,13 @@
|
||||
@import "mixins"
|
||||
@import "colors"
|
||||
|
||||
##{$prefix}settings-wrap
|
||||
.subsubsub
|
||||
+flex( row, flex-start, center, wrap )
|
||||
margin-left: -3px
|
||||
margin-right: -3px
|
||||
a
|
||||
margin: 0 3px
|
||||
//##{$prefix}settings-wrap
|
||||
// .subsubsub
|
||||
// +flex( row, flex-start, center, wrap )
|
||||
// margin-left: -3px
|
||||
// margin-right: -3px
|
||||
// a
|
||||
// margin: 0 3px
|
||||
|
||||
.#{$prefix}settings-section
|
||||
.description
|
||||
@@ -38,8 +38,8 @@
|
||||
width: 25%
|
||||
|
||||
.column-configure
|
||||
width: 60px
|
||||
text-align: center
|
||||
width: 10%
|
||||
text-align: right
|
||||
|
||||
th.column-email.column-primary
|
||||
padding-left: 48px
|
||||
@@ -50,7 +50,11 @@ th.column-email.column-primary
|
||||
td
|
||||
padding-right: 0
|
||||
|
||||
##{$prefix}settings-emails
|
||||
margin: 15px 0
|
||||
|
||||
##{$prefix}settings-template-versions
|
||||
margin: 15px 0
|
||||
.wp-list-table
|
||||
.column-core_version
|
||||
width: 100px
|
||||
@@ -68,6 +72,13 @@ th.column-email.column-primary
|
||||
.subsubsub
|
||||
float: left
|
||||
width: 100%
|
||||
h2.title
|
||||
a.um-back-button
|
||||
font-weight: normal
|
||||
font-size: 30px
|
||||
line-height: 1
|
||||
text-decoration: none
|
||||
margin-right: 5px
|
||||
|
||||
|
||||
.#{$prefix}settings-line
|
||||
|
||||
@@ -97,6 +97,52 @@ function um_admin_init_users_select() {
|
||||
}
|
||||
|
||||
|
||||
function um_admin_init_pages_select() {
|
||||
// multiple select with AJAX search
|
||||
jQuery('.um-pages-select2').select2({
|
||||
ajax: {
|
||||
url: wp.ajax.settings.url,
|
||||
dataType: 'json',
|
||||
delay: 250, // delay in ms while typing when to perform a AJAX search
|
||||
data: function( params ) {
|
||||
return {
|
||||
search: params.term, // search query
|
||||
action: 'um_get_pages_list', // AJAX action for admin-ajax.php
|
||||
page: params.page || 1, // infinite scroll pagination
|
||||
nonce: um_admin_scripts.nonce
|
||||
};
|
||||
},
|
||||
processResults: function( data, params ) {
|
||||
params.page = params.page || 1;
|
||||
var options = [];
|
||||
|
||||
if ( data ) {
|
||||
|
||||
// data is the array of arrays, and each of them contains ID and the Label of the option
|
||||
jQuery.each( data, function( index, text ) { // do not forget that "index" is just auto incremented value
|
||||
if ( index === 'total_count' ) {
|
||||
return;
|
||||
}
|
||||
options.push( { id: text[0], text: text[1] } );
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
return {
|
||||
results: options,
|
||||
pagination: {
|
||||
more: ( params.page * 10 ) < data.total_count
|
||||
}
|
||||
};
|
||||
},
|
||||
cache: true
|
||||
},
|
||||
placeholder: jQuery(this).data('placeholder'),
|
||||
minimumInputLength: 0, // the minimum of symbols to input before perform a search
|
||||
allowClear: true,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param field_key
|
||||
@@ -123,6 +169,7 @@ function um_same_page_something_wrong( field_key ) {
|
||||
|
||||
jQuery(document).ready( function() {
|
||||
um_admin_init_users_select();
|
||||
um_admin_init_pages_select();
|
||||
|
||||
/**
|
||||
* Same page upgrade field
|
||||
@@ -130,9 +177,9 @@ jQuery(document).ready( function() {
|
||||
jQuery( document.body ).on( 'click', '.um-forms-field[data-log-object]', function() {
|
||||
var obj = jQuery( this ).data( 'log-object' );
|
||||
if ( jQuery( this ).is( ':checked' ) ) {
|
||||
jQuery( this ).siblings( '.um-same-page-update-' + obj ).show();
|
||||
jQuery( this ).parents('label').siblings( '.um-same-page-update-' + obj ).show();
|
||||
} else {
|
||||
jQuery( this ).siblings( '.um-same-page-update-' + obj ).hide();
|
||||
jQuery( this ).parents('label').siblings( '.um-same-page-update-' + obj ).hide();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -1842,8 +1842,9 @@ if ( ! class_exists( 'um\admin\Admin' ) ) {
|
||||
|
||||
$url = add_query_arg(
|
||||
array(
|
||||
'page' => 'um_options',
|
||||
'tab' => 'override_templates',
|
||||
'page' => 'um_options',
|
||||
'tab' => 'advanced',
|
||||
'section' => 'override_templates',
|
||||
),
|
||||
admin_url( 'admin.php' )
|
||||
);
|
||||
|
||||
@@ -351,9 +351,10 @@ final class Enqueue extends \um\common\Enqueue {
|
||||
$forms_data = array(
|
||||
'successfully_redirect' => add_query_arg(
|
||||
array(
|
||||
'page' => 'um_options',
|
||||
'tab' => 'misc',
|
||||
'msg' => 'updated',
|
||||
'page' => 'um_options',
|
||||
'tab' => 'advanced',
|
||||
'section' => 'features',
|
||||
'msg' => 'updated',
|
||||
),
|
||||
admin_url( 'admin.php' )
|
||||
),
|
||||
@@ -583,12 +584,18 @@ 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'] ) && 'secure' === $_GET['tab'] ) {
|
||||
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' );
|
||||
}
|
||||
|
||||
// phpcs:ignore WordPress.Security.NonceVerification
|
||||
if ( isset( $_GET['tab'] ) && 'appearance' === $_GET['tab'] && empty( $_GET['section'] ) ) {
|
||||
// Init WP Media Uploader on the UM > Settings > Appearance > Profile screen.
|
||||
wp_enqueue_media();
|
||||
}
|
||||
|
||||
wp_register_style( 'um_admin_settings', $css_url . 'admin/settings' . $suffix . '.css', array(), UM_VERSION );
|
||||
wp_enqueue_style( 'um_admin_settings' );
|
||||
|
||||
|
||||
@@ -91,8 +91,7 @@ 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'] ) && isset( $_REQUEST['tab'] ) &&
|
||||
'um_options' === sanitize_key( $_REQUEST['page'] ) && 'secure' === sanitize_key( $_REQUEST['tab'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification
|
||||
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' );
|
||||
}
|
||||
|
||||
@@ -236,16 +235,18 @@ if ( ! class_exists( 'um\admin\Secure' ) ) {
|
||||
'description' => __( 'Scan your site to check for vulnerabilities prior to Ultimate Member version 2.6.7 and get recommendations to secure your site.', 'ultimate-member' ),
|
||||
),
|
||||
array(
|
||||
'id' => 'lock_register_forms',
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'Lock All Register Forms', 'ultimate-member' ),
|
||||
'description' => __( 'This prevents all users from registering with Ultimate Member on your site.', 'ultimate-member' ),
|
||||
'id' => 'lock_register_forms',
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'Lock All Register Forms', 'ultimate-member' ),
|
||||
'checkbox_label' => __( 'Lock Forms', 'ultimate-member' ),
|
||||
'description' => __( 'This prevents all users from registering with Ultimate Member on your site.', 'ultimate-member' ),
|
||||
),
|
||||
array(
|
||||
'id' => 'display_login_form_notice',
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'Display Login form notice to reset passwords', 'ultimate-member' ),
|
||||
'description' => __( 'Enforces users to reset their passwords( one-time ) and prevent from entering old password.', 'ultimate-member' ),
|
||||
'id' => 'display_login_form_notice',
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'Display Login form notice to reset passwords', 'ultimate-member' ),
|
||||
'checkbox_label' => __( 'Enable Login form notice', 'ultimate-member' ),
|
||||
'description' => __( 'Enforces users to reset their passwords (one-time) and prevent from entering old password.', 'ultimate-member' ),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -265,17 +266,19 @@ if ( ! class_exists( 'um\admin\Secure' ) ) {
|
||||
$secure_fields,
|
||||
array(
|
||||
array(
|
||||
'id' => 'secure_ban_admins_accounts',
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'Enable ban for administrative capabilities', 'ultimate-member' ),
|
||||
'description' => __( ' When someone tries to inject capabilities to the Account, Profile & Register forms submission, it will be banned.', 'ultimate-member' ),
|
||||
'id' => 'secure_ban_admins_accounts',
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'Administrative capabilities ban', 'ultimate-member' ),
|
||||
'checkbox_label' => __( 'Enable ban for administrative capabilities', 'ultimate-member' ),
|
||||
'description' => __( ' When someone tries to inject capabilities to the Account, Profile & Register forms submission, it will be banned.', 'ultimate-member' ),
|
||||
),
|
||||
array(
|
||||
'id' => 'secure_notify_admins_banned_accounts',
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'Notify Administrators', 'ultimate-member' ),
|
||||
'description' => __( 'When enabled, All administrators will be notified when someone has suspicious activities in the Account, Profile & Register forms.', 'ultimate-member' ),
|
||||
'conditional' => array( 'secure_ban_admins_accounts', '=', 1 ),
|
||||
'id' => 'secure_notify_admins_banned_accounts',
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'Notify Administrators', 'ultimate-member' ),
|
||||
'checkbox_label' => __( 'Enable notification', 'ultimate-member' ),
|
||||
'description' => __( 'When enabled, All administrators will be notified when someone has suspicious activities in the Account, Profile & Register forms.', 'ultimate-member' ),
|
||||
'conditional' => array( 'secure_ban_admins_accounts', '=', 1 ),
|
||||
),
|
||||
array(
|
||||
'id' => 'secure_notify_admins_banned_accounts__interval',
|
||||
@@ -292,14 +295,15 @@ if ( ! class_exists( 'um\admin\Secure' ) ) {
|
||||
'id' => 'secure_allowed_redirect_hosts',
|
||||
'type' => 'textarea',
|
||||
'label' => __( 'Allowed hosts for safe redirect (one host per line)', 'ultimate-member' ),
|
||||
'description' => __( 'Extend allowed hosts for frontend pages redirects', 'ultimate-member' ),
|
||||
'description' => __( 'Extend allowed hosts for frontend pages redirects.', 'ultimate-member' ),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
$settings['secure'] = array(
|
||||
'title' => __( 'Secure', 'ultimate-member' ),
|
||||
'fields' => $secure_fields,
|
||||
$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,
|
||||
);
|
||||
|
||||
return $settings;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<?php
|
||||
namespace um\admin\core;
|
||||
|
||||
// Exit if accessed directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'um\admin\core\Admin_Forms_Settings' ) ) {
|
||||
|
||||
|
||||
/**
|
||||
* Class Admin_Forms_Settings
|
||||
* @package um\admin\core
|
||||
@@ -17,41 +17,42 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms_Settings' ) ) {
|
||||
* Admin_Forms constructor.
|
||||
* @param bool $form_data
|
||||
*/
|
||||
function __construct( $form_data = false ) {
|
||||
|
||||
public function __construct( $form_data = false ) {
|
||||
parent::__construct( $form_data );
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get field value
|
||||
* Get field value.
|
||||
*
|
||||
* @param array $field_data
|
||||
* @param array $field_data
|
||||
* @param string $i
|
||||
*
|
||||
* @return string|array
|
||||
*/
|
||||
function get_field_value( $field_data, $i = '' ) {
|
||||
$default = isset( $field_data['default' . $i] ) ? $field_data['default' . $i] : UM()->options()->get_default( $field_data['id' . $i] );
|
||||
public function get_field_value( $field_data, $i = '' ) {
|
||||
$default_key = 'default' . $i;
|
||||
$value_key = 'value' . $i;
|
||||
$id_key = 'id' . $i;
|
||||
|
||||
if ( $field_data['type'] == 'checkbox' || $field_data['type'] == 'multi_checkbox' ) {
|
||||
if ( isset( $field_data['value' . $i] ) ) {
|
||||
return $field_data['value' . $i];
|
||||
} else {
|
||||
$value = UM()->options()->get( $field_data['id' . $i] );
|
||||
$value = is_string( $value ) ? stripslashes( $value ) : $value;
|
||||
return '' !== $value ? $value : $default;
|
||||
}
|
||||
} else {
|
||||
if ( isset( $field_data['value' . $i] ) ) {
|
||||
return $field_data['value'. $i];
|
||||
} else {
|
||||
$value = UM()->options()->get( $field_data['id' . $i] );
|
||||
$value = is_string( $value ) ? stripslashes( $value ) : $value;
|
||||
return isset( $value ) ? $value : $default;
|
||||
$default = isset( $field_data[ $default_key ] ) ? $field_data[ $default_key ] : UM()->options()->get_default( $field_data[ $id_key ] );
|
||||
|
||||
if ( in_array( $field_data['type'], array( 'checkbox', 'multi_checkbox' ), true ) ) {
|
||||
if ( isset( $field_data[ $value_key ] ) ) {
|
||||
return $field_data[ $value_key ];
|
||||
}
|
||||
|
||||
$value = UM()->options()->get( $field_data[ $id_key ] );
|
||||
$value = is_string( $value ) ? stripslashes( $value ) : $value;
|
||||
return '' !== $value ? $value : $default;
|
||||
}
|
||||
}
|
||||
|
||||
if ( isset( $field_data[ $value_key ] ) ) {
|
||||
return $field_data[ $value_key ];
|
||||
}
|
||||
|
||||
$value = UM()->options()->get( $field_data[ $id_key ] );
|
||||
$value = is_string( $value ) ? stripslashes( $value ) : $value;
|
||||
return isset( $value ) ? $value : $default;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) {
|
||||
* @param bool $echo
|
||||
* @return string
|
||||
*/
|
||||
function render_form( $echo = true ) {
|
||||
public function render_form( $echo = true ) {
|
||||
|
||||
if ( empty( $this->form_data['fields'] ) ) {
|
||||
return '';
|
||||
@@ -64,7 +64,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) {
|
||||
ob_start();
|
||||
|
||||
foreach ( $this->form_data['fields'] as $field_data ) {
|
||||
if ( isset( $field_data['type'] ) && 'hidden' == $field_data['type'] ) {
|
||||
if ( isset( $field_data['type'] ) && 'hidden' === $field_data['type'] ) {
|
||||
echo $this->render_form_row( $field_data );
|
||||
}
|
||||
}
|
||||
@@ -97,19 +97,18 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function render_form_row( $data ) {
|
||||
public function render_form_row( $data ) {
|
||||
|
||||
if ( empty( $data['type'] ) ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if ( !empty( $data['value'] ) && $data['type'] != 'email_template' ) {
|
||||
if ( ! empty( $data['value'] ) && $data['type'] != 'email_template' ) {
|
||||
$data['value'] = wp_unslash( $data['value'] );
|
||||
|
||||
/*for multi_text*/
|
||||
@@ -169,8 +168,9 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) {
|
||||
|
||||
}
|
||||
|
||||
if ( ! empty( $data['description'] ) )
|
||||
if ( ! empty( $data['description'] ) ) {
|
||||
$html .= '<p class="description">' . $data['description'] . '</p>';
|
||||
}
|
||||
|
||||
$html .= '</div>';
|
||||
|
||||
@@ -190,8 +190,9 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) {
|
||||
|
||||
}
|
||||
|
||||
if ( ! empty( $data['description'] ) )
|
||||
if ( ! empty( $data['description'] ) ) {
|
||||
$html .= '<p class="description">' . $data['description'] . '</p>';
|
||||
}
|
||||
|
||||
$html .= '</div>';
|
||||
|
||||
@@ -209,8 +210,9 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) {
|
||||
|
||||
}
|
||||
|
||||
if ( ! empty( $data['description'] ) )
|
||||
if ( ! empty( $data['description'] ) ) {
|
||||
$html .= '<p class="description">' . $data['description'] . '</p>';
|
||||
}
|
||||
|
||||
$html .= '</div>';
|
||||
|
||||
@@ -233,8 +235,9 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) {
|
||||
|
||||
}
|
||||
|
||||
if ( ! empty( $data['description'] ) )
|
||||
if ( ! empty( $data['description'] ) ) {
|
||||
$html .= '<div class="clear"></div><p class="description">' . $data['description'] . '</p>';
|
||||
}
|
||||
|
||||
$html .= '</td></tr>';
|
||||
|
||||
@@ -255,8 +258,9 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) {
|
||||
|
||||
}
|
||||
|
||||
if ( ! empty( $data['description'] ) )
|
||||
if ( ! empty( $data['description'] ) ) {
|
||||
$html .= '<div class="clear"></div><p class="description">' . $data['description'] . '</p>';
|
||||
}
|
||||
|
||||
$html .= '</td></tr>';
|
||||
|
||||
@@ -276,15 +280,14 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) {
|
||||
|
||||
}
|
||||
|
||||
if ( ! empty( $data['description'] ) )
|
||||
if ( ! empty( $data['description'] ) ) {
|
||||
$html .= '<div class="clear"></div><p class="description">' . $data['description'] . '</p>';
|
||||
}
|
||||
|
||||
$html .= '</td></tr>';
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
$html .= $this->render_hidden( $data );
|
||||
}
|
||||
@@ -927,10 +930,11 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) {
|
||||
*
|
||||
* @return bool|string
|
||||
*/
|
||||
function render_checkbox( $field_data ) {
|
||||
public function render_checkbox( $field_data ) {
|
||||
|
||||
if ( empty( $field_data['id'] ) )
|
||||
if ( empty( $field_data['id'] ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$id = ( ! empty( $this->form_data['prefix_id'] ) ? $this->form_data['prefix_id'] : '' ) . '_' . $field_data['id'];
|
||||
$id_attr = ' id="' . esc_attr( $id ) . '" ';
|
||||
@@ -941,7 +945,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) {
|
||||
$class_attr = ' class="um-forms-field ' . esc_attr( $class ) . '" ';
|
||||
|
||||
$data = array(
|
||||
'field_id' => $field_data['id']
|
||||
'field_id' => $field_data['id'],
|
||||
);
|
||||
|
||||
if ( ! empty( $field_data['data'] ) ) {
|
||||
@@ -959,20 +963,22 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) {
|
||||
|
||||
$value = $this->get_field_value( $field_data );
|
||||
|
||||
$html = "<input type=\"hidden\" $id_attr_hidden $name_attr value=\"0\" />
|
||||
<input type=\"checkbox\" $id_attr $class_attr $name_attr $data_attr " . checked( $value, true, false ) . " value=\"1\" />";
|
||||
$checkbox_label = ! empty( $field_data['checkbox_label'] ) ? $field_data['checkbox_label'] : '';
|
||||
|
||||
|
||||
return $html;
|
||||
$field_html = "<input type=\"checkbox\" $id_attr $class_attr $name_attr $data_attr " . checked( $value, true, false ) . " value=\"1\" " . disabled( ! empty( $field_data['disabled'] ), true, false ) . " />";
|
||||
if ( '' !== $checkbox_label ) {
|
||||
$field_html = "<label>$field_html $checkbox_label</label>";
|
||||
}
|
||||
$html = "<input type=\"hidden\" $id_attr_hidden $name_attr value=\"0\" " . disabled( ! empty( $field_data['disabled'] ), true, false ) . " />{$field_html}";
|
||||
return apply_filters( 'um_admin_render_checkbox_field_html', $html, $field_data );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $field_data
|
||||
*
|
||||
* @return bool|string
|
||||
*/
|
||||
function render_same_page_update( $field_data ) {
|
||||
public function render_same_page_update( $field_data ) {
|
||||
|
||||
if ( empty( $field_data['id'] ) ) {
|
||||
return false;
|
||||
@@ -987,7 +993,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) {
|
||||
$class_attr = ' class="um-forms-field ' . esc_attr( $class ) . '" ';
|
||||
|
||||
$data = array(
|
||||
'field_id' => $field_data['id']
|
||||
'field_id' => $field_data['id'],
|
||||
);
|
||||
|
||||
if ( ! empty( $field_data['data'] ) ) {
|
||||
@@ -1009,8 +1015,13 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) {
|
||||
|
||||
$value = $this->get_field_value( $field_data );
|
||||
|
||||
$html = "<input type=\"hidden\" $id_attr_hidden $name_attr value=\"0\" />
|
||||
<input type=\"checkbox\" $id_attr $class_attr $name_attr $data_attr " . checked( $value, true, false ) . " value=\"1\" />";
|
||||
$checkbox_label = ! empty( $field_data['checkbox_label'] ) ? $field_data['checkbox_label'] : '';
|
||||
|
||||
$field_html = "<input type=\"checkbox\" $id_attr $class_attr $name_attr $data_attr " . checked( $value, true, false ) . " value=\"1\" " . disabled( ! empty( $field_data['disabled'] ), true, false ) . " />";
|
||||
if ( '' !== $checkbox_label ) {
|
||||
$field_html = "<label>$field_html $checkbox_label</label>";
|
||||
}
|
||||
$html = "<input type=\"hidden\" $id_attr_hidden $name_attr value=\"0\" " . disabled( ! empty( $field_data['disabled'] ), true, false ) . " />{$field_html}";
|
||||
|
||||
if ( ! empty( $field_data['upgrade_cb'] ) ) {
|
||||
$html .= '<div class="um-same-page-update-wrapper um-same-page-update-' . esc_attr( $field_data['upgrade_cb'] ) . '"><div class="um-same-page-update-description">' . $field_data['upgrade_description'] . '</div><input type="button" data-upgrade_cb="' . $field_data['upgrade_cb'] . '" class="button button-primary um-admin-form-same-page-update" value="' . esc_attr__( 'Run', 'ultimate-member' ) . '"/>
|
||||
@@ -1020,7 +1031,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) {
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $field_data
|
||||
*
|
||||
@@ -1083,6 +1093,79 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) {
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $field_data
|
||||
*
|
||||
* @since 2.8.3
|
||||
*
|
||||
* @return bool|string
|
||||
*/
|
||||
public function render_page_select( $field_data ) {
|
||||
if ( empty( $field_data['id'] ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$multiple = ! empty( $field_data['multi'] ) ? 'multiple' : '';
|
||||
|
||||
$id = ( ! empty( $this->form_data['prefix_id'] ) ? sanitize_title( $this->form_data['prefix_id'] ) : '' ) . '_' . $field_data['id'];
|
||||
$id_attr = ' id="' . esc_attr( $id ) . '" ';
|
||||
|
||||
$class = ! empty( $field_data['class'] ) ? $field_data['class'] . ' ' : ' ';
|
||||
$class .= ! empty( $field_data['size'] ) ? 'um-' . $field_data['size'] . '-field' : 'um-long-field';
|
||||
$class_attr = ' class="um-forms-field um-pages-select2 ' . esc_attr( $class ) . '" ';
|
||||
|
||||
$data = array(
|
||||
'field_id' => $field_data['id'],
|
||||
);
|
||||
|
||||
if ( ! empty( $field_data['placeholder'] ) ) {
|
||||
$data['placeholder'] = $field_data['placeholder'];
|
||||
}
|
||||
|
||||
$data_attr = '';
|
||||
foreach ( $data as $key => $value ) {
|
||||
$data_attr .= ' data-' . $key . '="' . esc_attr( $value ) . '" ';
|
||||
}
|
||||
|
||||
$name = $field_data['id'];
|
||||
$name = ! empty( $this->form_data['prefix_id'] ) ? $this->form_data['prefix_id'] . '[' . $name . ']' : $name;
|
||||
$hidden_name_attr = ' name="' . $name . '" ';
|
||||
$name = $name . ( ! empty( $field_data['multi'] ) ? '[]' : '' );
|
||||
$name_attr = ' name="' . $name . '" ';
|
||||
|
||||
$value = $this->get_field_value( $field_data );
|
||||
|
||||
$options = '<option value="">' . esc_html( $data['placeholder'] ) . '</option>';
|
||||
if ( ! empty( $field_data['options'] ) ) {
|
||||
foreach ( $field_data['options'] as $key => $option ) {
|
||||
if ( ! empty( $field_data['multi'] ) ) {
|
||||
|
||||
if ( ! is_array( $value ) || empty( $value ) ) {
|
||||
$value = array();
|
||||
}
|
||||
|
||||
$options .= '<option value="' . $key . '" ' . selected( in_array( $key, $value ), true, false ) . '>' . esc_html( $option ) . '</option>';
|
||||
} else {
|
||||
$options .= '<option value="' . $key . '" ' . selected( (string)$key == $value, true, false ) . '>' . esc_html( $option ) . '</option>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$hidden = '';
|
||||
if ( ! empty( $multiple ) ) {
|
||||
$hidden = "<input type=\"hidden\" $hidden_name_attr value=\"\" />";
|
||||
}
|
||||
|
||||
$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>';
|
||||
}
|
||||
|
||||
$html = "$hidden<select $multiple $id_attr $name_attr $class_attr $data_attr>$options</select>$button";
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $field_data
|
||||
@@ -1739,7 +1822,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Forms' ) ) {
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get field value
|
||||
*
|
||||
|
||||
@@ -16,18 +16,16 @@ if ( ! class_exists( 'um\admin\core\Admin_Menu' ) ) {
|
||||
*/
|
||||
class Admin_Menu {
|
||||
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
var $pagehook;
|
||||
var $slug = 'ultimatemember';
|
||||
|
||||
|
||||
/**
|
||||
* Admin_Menu constructor.
|
||||
*/
|
||||
function __construct() {
|
||||
public function __construct() {
|
||||
add_action( 'admin_menu', array( &$this, 'primary_admin_menu' ), 0 );
|
||||
add_action( 'admin_menu', array( &$this, 'secondary_menu_items' ), 1000 );
|
||||
add_action( 'admin_menu', array( &$this, 'extension_menu' ), 9999 );
|
||||
@@ -35,8 +33,46 @@ if ( ! class_exists( 'um\admin\core\Admin_Menu' ) ) {
|
||||
add_action( 'admin_head', array( $this, 'menu_order_count' ) );
|
||||
|
||||
add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ), 1000 );
|
||||
|
||||
add_action( 'load-ultimate-member_page_um_options', array( &$this, 'maybe_settings_redirect' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Trigger redirect on the Settings screen if there is a wrong tab or section.
|
||||
*
|
||||
* @since 2.8.2
|
||||
*/
|
||||
public function maybe_settings_redirect() {
|
||||
$current_tab = empty( $_GET['tab'] ) ? '' : sanitize_key( $_GET['tab'] );
|
||||
$current_subtab = empty( $_GET['section'] ) ? '' : sanitize_key( $_GET['section'] );
|
||||
|
||||
$settings_struct = UM()->admin_settings()->settings_structure[ $current_tab ];
|
||||
|
||||
// Remove not option hidden fields.
|
||||
if ( ! empty( $settings_struct['fields'] ) ) {
|
||||
foreach ( $settings_struct['fields'] as $field_key => $field_options ) {
|
||||
if ( isset( $field_options['is_option'] ) && false === $field_options['is_option'] ) {
|
||||
unset( $settings_struct['fields'][ $field_key ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( empty( $settings_struct['fields'] ) && empty( $settings_struct['sections'] ) && empty( $settings_struct['form_sections'] ) ) {
|
||||
wp_safe_redirect( add_query_arg( array( 'page' => 'um_options' ), admin_url( 'admin.php' ) ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( ! empty( $settings_struct['sections'] ) ) {
|
||||
if ( empty( $settings_struct['sections'][ $current_subtab ] ) ) {
|
||||
$args = array( 'page' => 'um_options' );
|
||||
if ( ! empty( $current_tab ) ) {
|
||||
$args['tab'] = $current_tab;
|
||||
}
|
||||
wp_safe_redirect( add_query_arg( $args, admin_url( 'admin.php' ) ) );
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the admin footer text on UM admin pages
|
||||
@@ -143,8 +179,8 @@ if ( ! class_exists( 'um\admin\core\Admin_Menu' ) ) {
|
||||
/**
|
||||
* Setup admin menu
|
||||
*/
|
||||
function primary_admin_menu() {
|
||||
$this->pagehook = add_menu_page( __( 'Ultimate Member', 'ultimate-member' ), __( 'Ultimate Member', 'ultimate-member' ), 'manage_options', $this->slug, array( &$this, 'admin_page' ), 'dashicons-admin-users', '42.78578');
|
||||
public function primary_admin_menu() {
|
||||
$this->pagehook = add_menu_page( __( 'Ultimate Member', 'ultimate-member' ), __( 'Ultimate Member', 'ultimate-member' ), 'manage_options', $this->slug, array( &$this, 'admin_page' ), 'dashicons-admin-users', '42.78578' );
|
||||
|
||||
add_action( 'load-' . $this->pagehook, array( &$this, 'on_load_page' ) );
|
||||
|
||||
@@ -155,7 +191,9 @@ if ( ! class_exists( 'um\admin\core\Admin_Menu' ) ) {
|
||||
/**
|
||||
* Secondary admin menu (after settings)
|
||||
*/
|
||||
function secondary_menu_items() {
|
||||
public function secondary_menu_items() {
|
||||
add_submenu_page( $this->slug, __( 'Settings', 'ultimate-member' ), __( 'Settings', 'ultimate-member' ), 'manage_options', 'um_options', array( UM()->admin_settings(), 'settings_page' ) );
|
||||
|
||||
add_submenu_page( $this->slug, __( 'Forms', 'ultimate-member' ), __( 'Forms', 'ultimate-member' ), 'manage_options', 'edit.php?post_type=um_form', '' );
|
||||
|
||||
add_submenu_page( $this->slug, __( 'User Roles', 'ultimate-member' ), __( 'User Roles', 'ultimate-member' ), 'manage_options', 'um_roles', array( &$this, 'um_roles_pages' ) );
|
||||
|
||||
@@ -780,7 +780,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
|
||||
*/
|
||||
public function template_version() {
|
||||
if ( true === (bool) get_option( 'um_override_templates_outdated' ) ) {
|
||||
$link = admin_url( 'admin.php?page=um_options&tab=override_templates' );
|
||||
$link = admin_url( 'admin.php?page=um_options&tab=advanced§ion=override_templates' );
|
||||
ob_start();
|
||||
?>
|
||||
|
||||
@@ -849,7 +849,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
|
||||
<?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=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 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
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -99,6 +99,15 @@ class UM_Emails_List_Table extends WP_List_Table {
|
||||
$this->_column_headers = array( $columns, $hidden, $sortable );
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the table navigation above or below the table
|
||||
*
|
||||
* @since 3.1.0
|
||||
* @param string $which
|
||||
*/
|
||||
protected function display_tablenav( $which ) {
|
||||
// Stop displaying tablenav.
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object $item
|
||||
@@ -221,12 +230,14 @@ class UM_Emails_List_Table extends WP_List_Table {
|
||||
function column_email( $item ) {
|
||||
$active = UM()->options()->get( $item['key'] . '_on' );
|
||||
|
||||
$icon = ! empty( $active ) ? 'um-notification-is-active dashicons-yes' : 'dashicons-no-alt';
|
||||
$link = add_query_arg( array( 'email' => $item['key'] ) );
|
||||
$text = '<span class="dashicons um-notification-status ' . esc_attr( $icon ) . '"></span><a href="' . esc_url( $link ) . '"><strong>' . $item['title'] . '</strong></a>';
|
||||
$icon = ! empty( $active ) ? 'um-notification-is-active dashicons-yes' : 'dashicons-no-alt';
|
||||
$icon_title = ! empty( $active ) ? __( 'Enabled', 'ultimate-member' ) : __( 'Disabled', 'ultimate-member' );
|
||||
|
||||
$link = add_query_arg( array( 'email' => $item['key'] ), remove_query_arg( 'paged' ) );
|
||||
$text = '<span class="dashicons um-notification-status ' . esc_attr( $icon ) . '" title="' . esc_attr( $icon_title ) . '"></span><a href="' . esc_url( $link ) . '"><strong>' . esc_html( $item['title'] ) . '</strong></a>';
|
||||
|
||||
if ( ! empty( $item['description'] ) ) {
|
||||
$text .= ' <span class="um_tooltip dashicons dashicons-editor-help" title="' . esc_attr__( $item['description'], 'ultimate-member' ) . '"></span>';
|
||||
$text .= ' <span class="um_tooltip dashicons dashicons-editor-help" title="' . esc_attr( $item['description'] ) . '"></span>';
|
||||
}
|
||||
|
||||
return $text;
|
||||
@@ -239,11 +250,11 @@ class UM_Emails_List_Table extends WP_List_Table {
|
||||
* @return string
|
||||
*/
|
||||
function column_recipients( $item ) {
|
||||
if ( $item['recipient'] == 'admin' ) {
|
||||
if ( 'admin' === $item['recipient'] ) {
|
||||
return UM()->options()->get( 'admin_email' );
|
||||
} else {
|
||||
return __( 'Member', 'ultimate-member' );
|
||||
}
|
||||
|
||||
return __( 'Member', 'ultimate-member' );
|
||||
}
|
||||
|
||||
|
||||
@@ -253,7 +264,8 @@ class UM_Emails_List_Table extends WP_List_Table {
|
||||
* @return string
|
||||
*/
|
||||
function column_configure( $item ) {
|
||||
return '<a class="button um-email-configure" href="' . add_query_arg( array( 'email' => $item['key'] ) ) . '" title="' . esc_attr__( 'Edit template', 'ultimate-member' ) . '"><span class="dashicons dashicons-admin-generic"></span></a>';
|
||||
$edit_link = add_query_arg( array( 'email' => $item['key'] ), remove_query_arg( 'paged' ) );
|
||||
return '<a class="button um-email-configure" href="' . esc_url( $edit_link ) . '" title="' . esc_attr__( 'Manage', 'ultimate-member' ) . '">' . esc_html__( 'Manage', 'ultimate-member' ) . '</a>';
|
||||
}
|
||||
|
||||
|
||||
@@ -276,13 +288,13 @@ class UM_Emails_List_Table extends WP_List_Table {
|
||||
}
|
||||
|
||||
$ListTable = new UM_Emails_List_Table( array(
|
||||
'singular' => __( 'Email Notification', 'ultimate-member' ),
|
||||
'plural' => __( 'Email Notifications', 'ultimate-member' ),
|
||||
'ajax' => false
|
||||
'singular' => __( 'Email Notification', 'ultimate-member' ),
|
||||
'plural' => __( 'Email Notifications', 'ultimate-member' ),
|
||||
'ajax' => false,
|
||||
));
|
||||
|
||||
$per_page = 20;
|
||||
$paged = $ListTable->get_pagenum();
|
||||
$per_page = 999;
|
||||
$paged = $ListTable->get_pagenum();
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
@@ -306,9 +318,9 @@ $paged = $ListTable->get_pagenum();
|
||||
* ?>
|
||||
*/
|
||||
$columns = apply_filters( 'um_email_templates_columns', array(
|
||||
'email' => __( 'Email', 'ultimate-member' ),
|
||||
'recipients' => __( 'Recipient(s)', 'ultimate-member' ),
|
||||
'configure' => '',
|
||||
'email' => __( 'Email', 'ultimate-member' ),
|
||||
'recipients' => __( 'Recipient(s)', 'ultimate-member' ),
|
||||
'configure' => '',
|
||||
) );
|
||||
|
||||
$ListTable->set_columns( $columns );
|
||||
@@ -317,18 +329,21 @@ $emails = UM()->config()->email_notifications;
|
||||
|
||||
$ListTable->prepare_items();
|
||||
$ListTable->items = array_slice( $emails, ( $paged - 1 ) * $per_page, $per_page );
|
||||
$ListTable->wpc_set_pagination_args( array( 'total_items' => count( $emails ), 'per_page' => $per_page ) ); ?>
|
||||
$ListTable->wpc_set_pagination_args( array( 'total_items' => count( $emails ), 'per_page' => $per_page ) );
|
||||
?>
|
||||
|
||||
<p class="description" style="margin: 20px 0 0 0;">
|
||||
<?php
|
||||
// translators: %s: doc link.
|
||||
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' ) );
|
||||
?>
|
||||
<h2 class="title"><?php esc_html_e( 'Email notifications', 'ultimate-member' ); ?></h2>
|
||||
<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' ) ); ?>
|
||||
</p>
|
||||
|
||||
<div class="clear"></div>
|
||||
<form action="" method="get" name="um-settings-emails" id="um-settings-emails">
|
||||
<input type="hidden" name="page" value="um_options" />
|
||||
<input type="hidden" name="tab" value="email" />
|
||||
|
||||
<?php $ListTable->display(); ?>
|
||||
</form>
|
||||
<div class="clear"></div>
|
||||
|
||||
@@ -163,6 +163,16 @@ class UM_Versions_List_Table extends WP_List_Table {
|
||||
$icon = 1 === $item['status_code'] ? 'um-notification-is-active dashicons-yes' : 'dashicons-no-alt';
|
||||
return $item['status'] . ' <span class="dashicons um-notification-status ' . esc_attr( $icon ) . '"></span>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the table navigation above or below the table
|
||||
*
|
||||
* @since 3.1.0
|
||||
* @param string $which
|
||||
*/
|
||||
protected function display_tablenav( $which ) {
|
||||
// Stop displaying tablenav.
|
||||
}
|
||||
}
|
||||
|
||||
$list_table = new UM_Versions_List_Table(
|
||||
@@ -210,6 +220,7 @@ $list_table->prepare_items();
|
||||
|
||||
<form action="" method="get" name="um-settings-template-versions" id="um-settings-template-versions">
|
||||
<input type="hidden" name="page" value="um_options" />
|
||||
<input type="hidden" name="tab" value="override_templates" />
|
||||
<input type="hidden" name="tab" value="advanced" />
|
||||
<input type="hidden" name="section" value="override_templates" />
|
||||
<?php $list_table->display(); ?>
|
||||
</form>
|
||||
|
||||
@@ -20,9 +20,22 @@ if ( ! class_exists( 'um\ajax\Init' ) ) {
|
||||
* @used-by \UM::includes()
|
||||
*/
|
||||
public function includes() {
|
||||
$this->pages();
|
||||
$this->secure();
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 2.8.3
|
||||
*
|
||||
* @return Pages
|
||||
*/
|
||||
public function pages() {
|
||||
if ( empty( UM()->classes['um\ajax\pages'] ) ) {
|
||||
UM()->classes['um\ajax\pages'] = new Pages();
|
||||
}
|
||||
return UM()->classes['um\ajax\pages'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 2.6.8
|
||||
*
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
namespace um\ajax;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Class Pages
|
||||
*
|
||||
* @package um\ajax
|
||||
*/
|
||||
class Pages {
|
||||
|
||||
/**
|
||||
* Pages constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
add_action( 'wp_ajax_um_get_pages_list', array( $this, 'get_pages_list' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* AJAX callback for getting the pages list
|
||||
*/
|
||||
public function get_pages_list() {
|
||||
UM()->admin()->check_ajax_nonce();
|
||||
|
||||
// we will pass post IDs and titles to this array
|
||||
$return = array();
|
||||
|
||||
$pre_result = apply_filters( 'um_admin_settings_get_pages_list', false );
|
||||
|
||||
if ( false === $pre_result ) {
|
||||
$query_args = array(
|
||||
'post_type' => 'page',
|
||||
'post_status' => 'publish', // if you don't want drafts to be returned
|
||||
'ignore_sticky_posts' => 1,
|
||||
'posts_per_page' => 10, // how much to show at once
|
||||
'paged' => absint( $_GET['page'] ),
|
||||
'orderby' => 'title',
|
||||
'order' => 'asc',
|
||||
);
|
||||
|
||||
if ( ! empty( $_GET['search'] ) ) {
|
||||
$query_args['s'] = sanitize_text_field( $_GET['search'] ); // the search query
|
||||
}
|
||||
|
||||
$search_results = new \WP_Query( $query_args );
|
||||
|
||||
if ( $search_results->have_posts() ) {
|
||||
while ( $search_results->have_posts() ) {
|
||||
$search_results->the_post();
|
||||
|
||||
// shorten the title a little
|
||||
$title = ( mb_strlen( $search_results->post->post_title ) > 50 ) ? mb_substr( $search_results->post->post_title, 0, 49 ) . '...' : $search_results->post->post_title;
|
||||
$title = sprintf( __( '%s (ID: %s)', 'ultimate-member' ), $title, $search_results->post->ID );
|
||||
$return[] = array( $search_results->post->ID, $title ); // array( Post ID, Post Title )
|
||||
}
|
||||
}
|
||||
|
||||
$return['total_count'] = $search_results->found_posts;
|
||||
} else {
|
||||
// got already calculated posts array from 3rd-party integrations (e.g. WPML, Polylang)
|
||||
$return = $pre_result;
|
||||
}
|
||||
|
||||
wp_send_json( $return );
|
||||
}
|
||||
}
|
||||
@@ -282,7 +282,7 @@ class Secure {
|
||||
|
||||
$content .= $br . '<div style="padding:10px; border:1px solid #ccc;">' . wp_kses( __( '<strong style="color:red">WARNING:</strong> Ensure that you\'ve created a full backup of your site as your restoration point before changing anything on your site with our recommendations.', 'ultimate-member' ), UM()->get_allowed_html( 'admin_notice' ) ) . '</div>';
|
||||
if ( $suspicious_accounts_count > 0 ) {
|
||||
$lock_register_forms_url = admin_url( 'admin.php?page=um_options&tab=secure&um_secure_lock_register_forms=1&_wpnonce=' . wp_create_nonce( 'um_secure_lock_register_forms' ) );
|
||||
$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' );
|
||||
|
||||
@@ -31,6 +31,13 @@ if ( ! class_exists( 'um\Config' ) ) {
|
||||
*/
|
||||
public $core_pages;
|
||||
|
||||
/**
|
||||
* @since 2.8.3
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $predefined_pages;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
@@ -841,6 +848,90 @@ if ( ! class_exists( 'um\Config' ) ) {
|
||||
'password-reset' => array( 'title' => __( 'Password Reset', 'ultimate-member' ) ),
|
||||
) );
|
||||
}
|
||||
//end class
|
||||
|
||||
/**
|
||||
* Get variable from config
|
||||
*
|
||||
* @param string $key
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @since 2.8.3
|
||||
*/
|
||||
public function get( $key ) {
|
||||
if ( empty( $this->$key ) ) {
|
||||
$this->{'init_' . $key}();
|
||||
}
|
||||
return apply_filters( 'um_config_get', $this->$key, $key );
|
||||
}
|
||||
|
||||
/**
|
||||
* Init plugin core pages.
|
||||
*
|
||||
* @since 2.8.3
|
||||
*/
|
||||
public function init_predefined_pages() {
|
||||
$core_forms = get_option( 'um_core_forms', array() );
|
||||
$setup_shortcodes = array_merge(
|
||||
array(
|
||||
'profile' => '',
|
||||
'login' => '',
|
||||
'register' => '',
|
||||
),
|
||||
$core_forms
|
||||
);
|
||||
|
||||
$this->predefined_pages = array(
|
||||
'user' => array(
|
||||
'title' => __( 'User', 'ultimate-member' ),
|
||||
'content' => ! empty( $setup_shortcodes['profile'] ) ? '[ultimatemember form_id="' . $setup_shortcodes['profile'] . '"]' : '',
|
||||
),
|
||||
'login' => array(
|
||||
'title' => __( 'Login', 'ultimate-member' ),
|
||||
'content' => ! empty( $setup_shortcodes['login'] ) ? '[ultimatemember form_id="' . $setup_shortcodes['login'] . '"]' : '',
|
||||
),
|
||||
'register' => array(
|
||||
'title' => __( 'Register', 'ultimate-member' ),
|
||||
'content' => ! empty( $setup_shortcodes['register'] ) ? '[ultimatemember form_id="' . $setup_shortcodes['register'] . '"]' : '',
|
||||
),
|
||||
'logout' => array(
|
||||
'title' => __( 'Logout', 'ultimate-member' ),
|
||||
'content' => '',
|
||||
),
|
||||
'account' => array(
|
||||
'title' => __( 'Account', 'ultimate-member' ),
|
||||
'content' => '[ultimatemember_account]',
|
||||
),
|
||||
'password-reset' => array(
|
||||
'title' => __( 'Password Reset', 'ultimate-member' ),
|
||||
'content' => '[ultimatemember_password]',
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* Filters Ultimate Member predefined pages.
|
||||
*
|
||||
* @param {array} $pages Predefined pages.
|
||||
*
|
||||
* @return {array} Predefined pages.
|
||||
*
|
||||
* @since 2.8.3
|
||||
* @hook um_predefined_pages
|
||||
*
|
||||
* @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' ) );
|
||||
* return $pages;
|
||||
* }
|
||||
* add_filter( 'um_predefined_pages', 'my_predefined_pages' );
|
||||
*/
|
||||
$this->predefined_pages = apply_filters( 'um_predefined_pages', $this->predefined_pages );
|
||||
|
||||
// since 2.8.3 legacy hook
|
||||
// @todo remove in 3.0 version
|
||||
$this->predefined_pages = apply_filters( 'um_core_pages', $this->predefined_pages );
|
||||
$this->core_pages = $this->predefined_pages;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -228,7 +228,8 @@ if ( ! class_exists( 'UM' ) ) {
|
||||
// init widgets
|
||||
add_action( 'widgets_init', array( &$this, 'widgets_init' ) );
|
||||
|
||||
//include short non class functions
|
||||
// Include short non-class functions
|
||||
require_once 'um-core-functions.php';
|
||||
require_once 'um-short-functions.php';
|
||||
require_once 'um-deprecated-functions.php';
|
||||
}
|
||||
@@ -585,8 +586,6 @@ if ( ! class_exists( 'UM' ) ) {
|
||||
$this->theme_updater();
|
||||
} elseif ( $this->is_request( 'frontend' ) ) {
|
||||
$this->frontend()->includes();
|
||||
$this->account();
|
||||
$this->password();
|
||||
$this->login();
|
||||
$this->register();
|
||||
$this->user_posts();
|
||||
@@ -594,6 +593,8 @@ if ( ! class_exists( 'UM' ) ) {
|
||||
}
|
||||
|
||||
//common includes
|
||||
$this->account();
|
||||
$this->password();
|
||||
$this->rewrite();
|
||||
$this->mail();
|
||||
$this->rest_api();
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
<?php
|
||||
namespace um\core;
|
||||
|
||||
// Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'um\core\Options' ) ) {
|
||||
|
||||
@@ -125,6 +126,18 @@ if ( ! class_exists( 'um\core\Options' ) ) {
|
||||
return $settings_defaults[ $option_id ];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get predefined page option key
|
||||
*
|
||||
* @since 2.8.3
|
||||
*
|
||||
* @param string $slug
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_predefined_page_option_key( $slug ) {
|
||||
return apply_filters( 'um_predefined_page_option_key', "core_{$slug}" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get core page ID
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Executable
+84
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
/**
|
||||
* Ultimate Member Core Functions
|
||||
*
|
||||
* General core functions available on both the front-end and admin.
|
||||
*
|
||||
* @version 2.8.3
|
||||
*/
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $slug
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function um_predefined_page_slug_exists( $slug ) {
|
||||
$predefined_pages = UM()->config()->get( 'predefined_pages' );
|
||||
return array_key_exists( $slug, $predefined_pages );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $slug
|
||||
*
|
||||
* @return false|int
|
||||
*/
|
||||
function um_get_predefined_page_id( $slug ) {
|
||||
if ( ! um_predefined_page_slug_exists( $slug ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$option_key = UM()->options()->get_predefined_page_option_key( $slug );
|
||||
return apply_filters( 'um_get_predefined_page_id', UM()->options()->get( $option_key ), $slug );
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $slug
|
||||
* @param null|int|\WP_Post $post
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function um_is_predefined_page( $slug, $post = null ) {
|
||||
// handle $post inside, just we need make $post as \WP_Post. Otherwise something is wrong and return false
|
||||
if ( ! $post ) {
|
||||
global $post;
|
||||
|
||||
if ( empty( $post ) ) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if ( is_numeric( $post ) ) {
|
||||
$post = get_post( $post );
|
||||
|
||||
if ( empty( $post ) ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( empty( $post->ID ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return um_get_predefined_page_id( $slug ) === $post->ID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get predefined page URL
|
||||
*
|
||||
* @param string $slug
|
||||
*
|
||||
* @return false|string
|
||||
*/
|
||||
function um_get_predefined_page_url( $slug ) {
|
||||
$url = false;
|
||||
|
||||
if ( $page_id = um_get_predefined_page_id( $slug ) ) {
|
||||
$url = get_permalink( $page_id );
|
||||
}
|
||||
|
||||
return $url;
|
||||
}
|
||||
Reference in New Issue
Block a user