config()->core_directory_meta['members'] as $k => $v ) { $key = str_replace( '_um_', '', $k ); $def_args[ $key ] = $v; } $unique_hash = substr( md5( $args['form_id'] ), 10, 5 ); $args = array_merge( $def_args, $args ); //current user priority role $priority_user_role = false; if ( is_user_logged_in() ) { $priority_user_role = UM()->roles()->get_priority_user_role( um_user( 'ID' ) ); } // Views $single_view = false; $current_view = 'grid'; if ( ! empty( $args['view_types'] ) && is_array( $args['view_types'] ) ) { $args['view_types'] = array_filter( $args['view_types'], function( $item ) { return in_array( $item, array_keys( UM()->member_directory()->view_types ) ); }); } if ( empty( $args['view_types'] ) || ! is_array( $args['view_types'] ) ) { $args['view_types'] = array( 'grid', 'list' ); } if ( count( $args['view_types'] ) == 1 ) { $single_view = true; $current_view = $args['view_types'][0]; } else { $args['default_view'] = ! empty( $args['default_view'] ) ? $args['default_view'] : $args['view_types'][0]; $current_view = ( ! empty( $_GET[ 'view_type_' . $unique_hash ] ) && in_array( $_GET[ 'view_type_' . $unique_hash ], $args['view_types'] ) ) ? $_GET[ 'view_type_' . $unique_hash ] : $args['default_view']; } // Sorting $default_sorting = ! empty( $args['sortby'] ) ? $args['sortby'] : 'user_registered_desc'; $sort_from_url = ''; if ( ! empty( $args['enable_sorting'] ) ) { $sorting_options = empty( $args['sorting_fields'] ) ? array() : $args['sorting_fields']; if ( ! in_array( $default_sorting, $sorting_options ) ) { $sorting_options[] = $default_sorting; } if ( ! empty( $sorting_options ) ) { $all_sorting_options = UM()->member_directory()->sort_fields; $sorting_options = array_intersect_key( $all_sorting_options, array_flip( $sorting_options ) ); } $sorting_options = apply_filters( 'um_member_directory_pre_display_sorting', $sorting_options, $args ); $sort_from_url = ( ! empty( $_GET[ 'sort_' . $unique_hash ] ) && in_array( $_GET[ 'sort_' . $unique_hash ], array_keys( $sorting_options ) ) ) ? $_GET[ 'sort_' . $unique_hash ] : $default_sorting; } $current_page = ( ! empty( $_GET[ 'page_' . $unique_hash ] ) && is_numeric( $_GET[ 'page_' . $unique_hash ] ) ) ? (int) $_GET[ 'page_' . $unique_hash ] : 1; //Search $search = isset( $args['search'] ) ? $args['search'] : false; $show_search = empty( $args['roles_can_search'] ) || ( ! empty( $priority_user_role ) && in_array( $priority_user_role, $args['roles_can_search'] ) ); $search_from_url = ''; if ( $search && $show_search ) { $search_from_url = ! empty( $_GET[ 'search_' . $unique_hash ] ) ? $_GET[ 'search_' . $unique_hash ] : ''; } //Filters $filters = isset( $args['filters'] ) ? $args['filters'] : false; $show_filters = empty( $args['roles_can_filter'] ) || ( ! empty( $priority_user_role ) && in_array( $priority_user_role, $args['roles_can_filter'] ) ); $search_filters = array(); if ( isset( $args['search_fields'] ) ) { $search_filters = apply_filters( 'um_frontend_member_search_filters', array_unique( array_filter( $args['search_fields'] ) ) ); } if ( ! empty( $search_filters ) ) { $search_filters = array_filter( $search_filters, function( $item ) { return in_array( $item, array_keys( UM()->member_directory()->filter_fields ) ); }); $search_filters = array_values( $search_filters ); } // Classes $classes = ''; if ( $search && $show_search ) { $classes .= ' um-member-with-search'; } if ( $filters && $show_filters && count( $search_filters ) ) { $classes .= ' um-member-with-filters'; } if ( ! $single_view ) { $classes .= ' um-member-with-view'; } if ( ! empty( $args['enable_sorting'] ) && ! empty( $sorting_options ) && count( $sorting_options ) > 1 ) { $classes .= ' um-member-with-sorting'; } //send $args variable to the templates $args['args'] = $args; foreach ( $args['view_types'] as $type ) { $basename = UM()->member_directory()->get_type_basename( $type ); UM()->get_template( 'members-' . $type . '.php', $basename, $args, true ); } UM()->get_template( 'members-header.php', '', $args, true ); UM()->get_template( 'members-pagination.php', '', $args, true ); ?>
1 ) { ?>
member_directory()->view_types as $key => $value ) { if ( in_array( $key, $args['view_types'] ) ) { if ( empty( $view_types ) ) { ?>
*/ do_action( 'um_members_directory_footer', $args ); ?>