- fixed scroll via enqueue new scroll library;

- fixed order by Display name option
This commit is contained in:
nikitasinelnikov
2019-05-02 18:29:00 +03:00
parent 2e0c712e13
commit 887d4b5293
14 changed files with 4716 additions and 3990 deletions
+2 -2
View File
@@ -82,7 +82,7 @@ if ( ! class_exists( 'um\core\Enqueue' ) ) {
}
wp_register_script( 'select2', $this->js_baseurl . 'select2/select2.full.min.js', array( 'jquery', 'jquery-masonry' ), ultimatemember_version, true );
wp_register_script( 'um_scrollbar', $this->js_baseurl . 'um-scrollbar' . $this->suffix . '.js', array( 'jquery' ), ultimatemember_version, true );
wp_register_script( 'um_scrollbar', $this->js_baseurl . 'simplebar' . $this->suffix . '.js', array( 'jquery' ), ultimatemember_version, true );
wp_register_script( 'um_jquery_form', $this->js_baseurl . 'um-jquery-form' . $this->suffix . '.js', array( 'jquery' ), ultimatemember_version, true );
wp_register_script( 'um_fileupload', $this->js_baseurl . 'um-fileupload' . $this->suffix . '.js', array( 'jquery', 'um_jquery_form' ), ultimatemember_version, true );
@@ -158,7 +158,7 @@ if ( ! class_exists( 'um\core\Enqueue' ) ) {
wp_register_style( 'um_datetime', $this->css_baseurl . 'pickadate/default.css', array(), ultimatemember_version );
wp_register_style( 'um_datetime_date', $this->css_baseurl . 'pickadate/default.date.css', array( 'um_datetime' ), ultimatemember_version );
wp_register_style( 'um_datetime_time', $this->css_baseurl . 'pickadate/default.time.css', array( 'um_datetime' ), ultimatemember_version );
wp_register_style( 'um_scrollbar', $this->css_baseurl . 'um-scrollbar.css', array(), ultimatemember_version );
wp_register_style( 'um_scrollbar', $this->css_baseurl . 'simplebar.css', array(), ultimatemember_version );
wp_register_style( 'um_rtl', $this->css_baseurl . 'um.rtl.css', array(), ultimatemember_version );
wp_register_style( 'um_default_css', $this->css_baseurl . 'um-old-default.css', array(), ultimatemember_version );
+5 -4
View File
@@ -25,9 +25,9 @@ if ( ! class_exists( 'um\core\Members' ) ) {
*/
function __construct() {
add_filter('user_search_columns', array(&$this, 'user_search_columns'), 99 );
add_filter( 'user_search_columns', array( &$this, 'user_search_columns' ), 99 );
add_action('template_redirect', array(&$this, 'access_members'), 555);
add_action( 'template_redirect', array( &$this, 'access_members' ), 555);
$this->core_search_fields = array(
'user_login',
@@ -48,7 +48,7 @@ if ( ! class_exists( 'um\core\Members' ) ) {
*
* @return array
*/
function user_search_columns( $search_columns ){
function user_search_columns( $search_columns ) {
if ( is_admin() ) {
$search_columns[] = 'display_name';
}
@@ -198,7 +198,7 @@ if ( ! class_exists( 'um\core\Members' ) ) {
$attrs = apply_filters( 'um_search_fields', $attrs );
if ( $type == 'select' ) {
if( isset($attrs) && is_array( $attrs['options'] ) ){
if ( isset( $attrs ) && is_array( $attrs['options'] ) ) {
asort( $attrs['options'] );
}
/**
@@ -228,6 +228,7 @@ if ( ! class_exists( 'um\core\Members' ) ) {
return compact( 'type', 'attrs' );
}
/**
* Show filter
*
+17 -7
View File
@@ -1,33 +1,39 @@
<?php
namespace um\core;
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) exit;
if ( ! class_exists( 'um\core\Multisite' ) ) {
/**
* Class Multisite
*
* @package um\core
*/
class Multisite {
/**
* Multisite constructor.
*/
function __construct() {
add_action( 'wpmu_new_blog', array( &$this, 'create_new_blog_old_wp' ) );
add_action( 'wp_insert_site', array( &$this, 'create_new_blog' ) );
add_action( 'wpmu_new_blog', array( &$this, 'create_new_blog_old_wp' ), 10, 1 );
add_action( 'wp_insert_site', array( &$this, 'create_new_blog' ), 10, 1 );
}
/**
* Make default UM installation at the new blog if UM is active for network
*
* is deprecated in WP 5.1
*
* @param $blog_id
*/
function create_new_blog_old_wp ( $blog_id ) {
function create_new_blog_old_wp( $blog_id ) {
switch_to_blog( $blog_id );
UM()->single_site_activation();
@@ -35,10 +41,14 @@ if ( ! class_exists( 'um\core\Multisite' ) ) {
}
/**
* @param $blog
* Make default UM installation at the new blog if UM is active for network
* works since 5.1 WP version
*
* @param \WP_Site $blog
*/
function create_new_blog ( $blog ) {
function create_new_blog( $blog ) {
switch_to_blog( $blog->blog_id );
UM()->single_site_activation();
+23 -14
View File
@@ -345,9 +345,9 @@ function um_prepare_user_query_args( $query_args, $args ) {
// must have a cover photo
if ( $has_cover_photo == 1 ) {
$query_args['meta_query'][] = array(
'key' => 'cover_photo',
'value' => '',
'compare' => '!='
'key' => 'cover_photo',
'value' => '',
'compare' => '!='
);
}
@@ -362,16 +362,8 @@ function um_prepare_user_query_args( $query_args, $args ) {
// add roles to appear in directory
if ( ! empty( $roles ) ) {
//since WP4.4 use 'role__in' argument
$query_args['role__in'] = $roles;
/*$query_args['meta_query'][] = array(
'key' => 'role',
'value' => $roles,
'compare' => 'IN'
);*/
}
// sort members by
@@ -384,7 +376,24 @@ function um_prepare_user_query_args( $query_args, $args ) {
$query_args['meta_key'] = $sortby_custom;
$query_args['orderby'] = 'meta_value, display_name';
} else if ( in_array( $sortby, array( 'last_name', 'first_name' ) ) ) {
} elseif ( 'display_name' == $sortby ) {
$query_args['meta_query'][] = array(
'relation' => 'OR',
'full_name' => array(
'key' => 'full_name',
'compare' => 'EXISTS'
),
array(
'key' => 'full_name',
'compare' => 'NOT EXISTS'
)
);
$query_args['orderby'] = 'full_name, display_name';
$order = 'ASC';
} elseif ( in_array( $sortby, array( 'last_name', 'first_name' ) ) ) {
$query_args['meta_key'] = $sortby;
$query_args['orderby'] = 'meta_value';
@@ -392,7 +401,7 @@ function um_prepare_user_query_args( $query_args, $args ) {
} else {
if ( strstr( $sortby, '_desc' ) ) {
$sortby = str_replace('_desc','',$sortby);
$sortby = str_replace( '_desc', '', $sortby );
$order = 'DESC';
}
@@ -431,7 +440,7 @@ function um_prepare_user_query_args( $query_args, $args ) {
* }
* ?>
*/
$query_args = apply_filters('um_modify_sortby_parameter', $query_args, $sortby);
$query_args = apply_filters( 'um_modify_sortby_parameter', $query_args, $sortby );
}