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

# Conflicts:
#	assets/js/um-select.min.js
This commit is contained in:
nikitozzzzzzz
2018-10-28 23:51:28 +02:00
33 changed files with 900 additions and 680 deletions
@@ -5,6 +5,7 @@
.um-admin.post-type-um_form .manage-column.column-id {width: 60px}
.um-admin.post-type-um_form .manage-column.column-mode {width: 100px}
.um-admin.post-type-um_form .manage-column.column-is_default {width: 60px}
.um-admin.post-type-um_form .manage-column.column-title {width: 200px}
.um-admin.post-type-um_form .manage-column.column-shortcode {width: 200px}
.um-admin.post-type-um_form .manage-column.column-impressions {width: 100px}
@@ -12,6 +13,7 @@
.um-admin.post-type-um_directory .manage-column.column-id {width: 60px}
.um-admin.post-type-um_directory .manage-column.column-title {width: 250px}
.um-admin.post-type-um_directory .manage-column.column-is_default {width: 60px}
.um-admin.post-type-um_role .manage-column.column-title {width: 200px}
.um-admin.post-type-um_role .manage-column.column-count {width: 150px}
+20 -10
View File
@@ -45,22 +45,32 @@ if ( ! class_exists( 'um\admin\Admin' ) ) {
add_action( 'um_admin_do_action__install_core_pages', array( &$this, 'install_core_pages' ) );
add_filter( 'admin_body_class', array( &$this, 'admin_body_class' ), 999 );
add_action( 'parent_file', array( &$this, 'parent_file' ), 9 );
add_filter( 'gettext', array( &$this, 'gettext' ), 10, 4 );
add_filter( 'post_updated_messages', array( &$this, 'post_updated_messages' ) );
add_action( 'wp_ajax_um_dynamic_modal_content', array( UM()->builder(), 'dynamic_modal_content' ) );
add_action( 'wp_ajax_um_populate_dropdown_options', array( UM()->builder(), 'populate_dropdown_options' ) );
add_action( 'wp_ajax_um_update_field', array( UM()->builder(), 'update_field' ) );
add_action( 'wp_ajax_um_do_ajax_action', array( UM()->fields(), 'do_ajax_action' ) );
add_action( 'wp_ajax_um_update_builder', array( UM()->builder(), 'update_builder' ) );
add_action( 'wp_ajax_um_update_order', array( UM()->dragdrop(), 'update_order' ) );
add_action( 'wp_ajax_um_rated', array( UM()->admin_menu(), 'ultimatemember_rated' ) );
}
/**
* Adds class to our admin pages
*
* @param $classes
*
* @return string
*/
function admin_body_class( $classes ) {
if ( $this->is_um_screen() ) {
return "$classes um-admin";
}
return $classes;
}
/**
*
*/
function manual_upgrades_request() {
if ( ! is_admin() || ! current_user_can( 'manage_options' ) ) {
die();
@@ -0,0 +1,33 @@
<?php
namespace um\admin\core;
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) exit;
if ( ! class_exists( 'um\admin\core\Admin_Ajax_Hooks' ) ) {
/**
* Class Admin_Ajax_Hooks
* @package um\admin\core
*/
class Admin_Ajax_Hooks {
/**
* Admin_Columns constructor.
*/
function __construct() {
add_action( 'wp_ajax_um_do_ajax_action', array( UM()->fields(), 'do_ajax_action' ) );
add_action( 'wp_ajax_um_update_builder', array( UM()->builder(), 'update_builder' ) );
add_action( 'wp_ajax_um_update_order', array( UM()->dragdrop(), 'update_order' ) );
add_action( 'wp_ajax_um_update_field', array( UM()->builder(), 'update_field' ) );
add_action( 'wp_ajax_um_dynamic_modal_content', array( UM()->builder(), 'dynamic_modal_content' ) );
add_action( 'wp_ajax_um_populate_dropdown_options', array( UM()->builder(), 'populate_dropdown_options' ) );
add_action( 'wp_ajax_um_rated', array( UM()->admin_menu(), 'ultimatemember_rated' ) );
}
}
}
+32 -8
View File
@@ -90,11 +90,12 @@ if ( ! class_exists( 'um\admin\core\Admin_Columns' ) ) {
*/
function manage_edit_um_form_columns( $columns ) {
$new_columns['cb'] = '<input type="checkbox" />';
$new_columns['title'] = __( 'Title', 'ulitmatemember' );
$new_columns['id'] = __('ID', 'ulitmatemember' );
$new_columns['mode'] = __( 'Type', 'ulitmatemember' );
$new_columns['shortcode'] = __( 'Shortcode', 'ulitmatemember' );
$new_columns['date'] = __( 'Date', 'ulitmatemember' );
$new_columns['title'] = __( 'Title', 'ulitmate-member' );
$new_columns['id'] = __('ID', 'ulitmate-member' );
$new_columns['mode'] = __( 'Type', 'ulitmate-member' );
$new_columns['is_default'] = __( 'Default', 'ulitmate-member' );
$new_columns['shortcode'] = __( 'Shortcode', 'ulitmate-member' );
$new_columns['date'] = __( 'Date', 'ulitmate-member' );
return $new_columns;
}
@@ -111,6 +112,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Columns' ) ) {
$new_columns['cb'] = '<input type="checkbox" />';
$new_columns['title'] = __( 'Title', 'ultimate-member' );
$new_columns['id'] = __( 'ID', 'ultimate-member' );
$new_columns['is_default'] = __( 'Default', 'ulitmate-member' );
$new_columns['shortcode'] = __( 'Shortcode', 'ultimate-member' );
$new_columns['date'] = __( 'Date', 'ultimate-member' );
@@ -131,7 +133,19 @@ if ( ! class_exists( 'um\admin\core\Admin_Columns' ) ) {
break;
case 'shortcode':
echo UM()->shortcodes()->get_shortcode( $id );
$is_default = UM()->query()->get_attr( 'is_default', $id );
if ( $is_default ) {
echo UM()->shortcodes()->get_default_shortcode( $id );
} else {
echo UM()->shortcodes()->get_shortcode( $id );
}
break;
case 'is_default':
$is_default = UM()->query()->get_attr( 'is_default', $id );
echo empty( $is_default ) ? __( 'No', 'ultimate-member' ) : __( 'Yes', 'ultimate-member' );
break;
case 'mode':
@@ -143,7 +157,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Columns' ) ) {
/**
* Display cusom columns for Directory
* Display custom columns for Directory
*
* @param string $column_name
* @param int $id
@@ -154,7 +168,17 @@ if ( ! class_exists( 'um\admin\core\Admin_Columns' ) ) {
echo '<span class="um-admin-number">'.$id.'</span>';
break;
case 'shortcode':
echo UM()->shortcodes()->get_shortcode( $id );
$is_default = UM()->query()->get_attr( 'is_default', $id );
if ( $is_default ) {
echo UM()->shortcodes()->get_default_shortcode( $id );
} else {
echo UM()->shortcodes()->get_shortcode( $id );
}
break;
case 'is_default':
$is_default = UM()->query()->get_attr( 'is_default', $id );
echo empty( $is_default ) ? __( 'No', 'ultimate-member' ) : __( 'Yes', 'ultimate-member' );
break;
}
}
@@ -39,8 +39,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) {
add_action( 'admin_enqueue_scripts', array( &$this, 'admin_enqueue_scripts' ) );
add_filter( 'admin_body_class', array( &$this, 'admin_body_class' ), 999 );
add_filter( 'enter_title_here', array( &$this, 'enter_title_here' ) );
add_action( 'load-user-new.php', array( &$this, 'enqueue_role_wrapper' ) );
@@ -344,21 +342,6 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) {
}
/**
* Adds class to our admin pages
*
* @param $classes
*
* @return string
*/
function admin_body_class( $classes ) {
if ( UM()->admin()->is_um_screen() ) {
return "$classes um-admin";
}
return $classes;
}
/**
* Enqueue scripts and styles
*/
+33 -2
View File
@@ -1087,6 +1087,21 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
$v = preg_split( '/[\r\n]+/', $v, -1, PREG_SPLIT_NO_EMPTY );
}
if ( strstr( $k, '_um_' ) ) {
if ( $k === '_um_is_default' ) {
$mode = UM()->query()->get_attr( 'mode', $post_id );
if ( ! empty( $mode ) ) {
$posts = $wpdb->get_col(
"SELECT post_id
FROM {$wpdb->postmeta}
WHERE meta_key = '_um_mode' AND
meta_value = 'directory'"
);
foreach ( $posts as $p_id ) {
delete_post_meta( $p_id, '_um_is_default' );
}
}
}
update_post_meta( $post_id, $k, $v );
}
}
@@ -1121,8 +1136,24 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
// save
delete_post_meta( $post_id, '_um_profile_metafields' );
foreach ( $_POST['form'] as $k => $v ) {
if ( strstr( $k, '_um_' ) ){
update_post_meta( $post_id, $k, $v);
if ( strstr( $k, '_um_' ) ) {
if ( $k === '_um_is_default' ) {
$mode = UM()->query()->get_attr( 'mode', $post_id );
if ( ! empty( $mode ) ) {
$posts = $wpdb->get_col( $wpdb->prepare(
"SELECT post_id
FROM {$wpdb->postmeta}
WHERE meta_key = '_um_mode' AND
meta_value = %s",
$mode
) );
foreach ( $posts as $p_id ) {
delete_post_meta( $p_id, '_um_is_default' );
}
}
}
update_post_meta( $post_id, $k, $v );
}
}
+3 -3
View File
@@ -298,11 +298,11 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
ob_start(); ?>
<p>
<?php printf( __( 'One or more of your %s pages are not correctly setup. Please visit <strong>%s > Settings</strong> to re-assign your missing pages.', 'ultimate-member' ), ultimatemember_plugin_name, ultimatemember_plugin_name ); ?>
<?php printf( __( '%s needs to create several pages (User Profiles, Account, Registration, Login, Password Reset, Logout, Member Directory) to function correctly.', 'ultimate-member' ), ultimatemember_plugin_name ); ?>
</p>
<p>
<a href="<?php echo esc_attr( add_query_arg( 'um_adm_action', 'install_core_pages' ) ); ?>" class="button button-primary"><?php _e( 'Setup Pages', 'ultimate-member' ) ?></a>
<a href="<?php echo esc_attr( add_query_arg( 'um_adm_action', 'install_core_pages' ) ); ?>" class="button button-primary"><?php _e( 'Create Pages', 'ultimate-member' ) ?></a>
&nbsp;
<a href="javascript:void(0);" class="button-secondary um_secondary_dimiss"><?php _e( 'No thanks', 'ultimate-member' ) ?></a>
</p>
@@ -531,7 +531,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Notices' ) ) {
ob_start(); ?>
<p>
<?php printf( __( 'Thanks for installing <strong>%s</strong>! We hope you like the plugin. To fund full-time development and support of the plugin we also sell extensions. If you subscribe to our mailing list we will send you a 20%% discount code for our <a href="%s" target="_blank">extensions bundle</a>.', 'ultimate-member' ), ultimatemember_plugin_name, 'https://ultimatemember.com/core-extensions-bundle/' ); ?>
<?php printf( __( 'Thanks for installing <strong>%s</strong>! We hope you like the plugin. To fund full-time development and support of the plugin we also sell extensions. If you subscribe to our mailing list we will send you a 20%% discount code for our <a href="%s" target="_blank">extensions bundle</a>.', 'ultimate-member' ), ultimatemember_plugin_name, 'https://ultimatemember.com/core-extensions-bundle/' ); ?>
</p>
<p>
@@ -1,3 +1,24 @@
<div class="um-admin-metabox">
<?php /*UM()->admin_forms( array(
'class' => 'um-member-directory-shortcode um-top-label',
'prefix_id' => 'um_metadata',
'fields' => array(
array(
'id' => '_um_is_default',
'type' => 'select',
'label' => __( 'Default Member Directory', 'ultimate-member' ),
'tooltip' => sprintf( __( 'If you set this member directory as default you will have an ability to use %s shortcode for the displaying directory at the page. Otherwise you will have to use %s', 'ultimate-member' ), UM()->shortcodes()->get_default_shortcode( get_the_ID() ), UM()->shortcodes()->get_shortcode( get_the_ID() ) ),
'value' => UM()->query()->get_meta_value( '_um_is_default' ),
'options' => array(
0 => __( 'No', 'ultimate-member' ),
1 => __( 'Yes', 'ultimate-member' ),
),
),
)
) )->render_form();*/ ?>
<!-- <div class="um-admin-clear"></div>-->
<p><?php echo UM()->shortcodes()->get_shortcode( get_the_ID() ); ?></p>
<!-- <p>--><?php //echo UM()->shortcodes()->get_default_shortcode( get_the_ID() ); ?><!--</p>-->
</div>
@@ -1,3 +1,24 @@
<div class="um-admin-metabox">
<?php /*UM()->admin_forms( array(
'class' => 'um-form-shortcode um-top-label',
'prefix_id' => 'form',
'fields' => array(
array(
'id' => '_um_is_default',
'type' => 'select',
'label' => __( 'Default Form', 'ultimate-member' ),
'tooltip' => sprintf( __( 'If you set this form as default you will have an ability to use %s shortcode for the displaying form at the page. Otherwise you will have to use %s', 'ultimate-member' ), UM()->shortcodes()->get_default_shortcode( get_the_ID() ), UM()->shortcodes()->get_shortcode( get_the_ID() ) ),
'value' => UM()->query()->get_meta_value( '_um_is_default' ),
'options' => array(
0 => __( 'No', 'ultimate-member' ),
1 => __( 'Yes', 'ultimate-member' ),
),
),
)
) )->render_form();*/ ?>
<!-- <div class="um-admin-clear"></div>-->
<p><?php echo UM()->shortcodes()->get_shortcode( get_the_ID() ); ?></p>
<!-- <p>--><?php //echo UM()->shortcodes()->get_default_shortcode( get_the_ID() ); ?><!--</p>-->
</div>