- fixed getting default metadata for UM forms;

This commit is contained in:
Nikita Sinelnikov
2021-07-26 14:57:31 +03:00
parent 54f0e059e6
commit 0d2ac59ce3
11 changed files with 81 additions and 43 deletions
@@ -1,6 +1,8 @@
<?php if ( ! defined( 'ABSPATH' ) ) {
exit;
} ?>
}
global $post_id; ?>
<div class="um-admin-metabox">
<?php
@@ -13,7 +15,7 @@
'id' => '_um_directory_template',
'type' => 'select',
'label' => __( 'Template', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_directory_template', null, UM()->options()->get( 'directory_template' ) ),
'value' => get_post_meta( $post_id, '_um_directory_template', true ),
'options' => UM()->shortcodes()->get_templates( 'members' ),
),
),
@@ -32,6 +32,8 @@ foreach ( $view_types_options as $key => $value ) {
$conditional[] = '_um_view_types_' . $key;
}
$default_view = get_post_meta( $post_id, '_um_default_view', true );
$default_view = empty( $default_view ) ? 'grid' : $default_view;
$fields = array(
array(
@@ -55,7 +57,7 @@ $fields = array(
'label' => __( 'Default view type', 'ultimate-member' ),
'tooltip' => __( 'Default directory view type', 'ultimate-member' ),
'options' => $view_types_options,
'value' => UM()->query()->get_meta_value( '_um_default_view', null, 'grid' ),
'value' => $default_view,
'conditional' => array( implode( '|', $conditional ), '~', 1 ),
),
array(
@@ -72,13 +74,13 @@ $fields = array(
'type' => 'checkbox',
'label' => __( 'Only show members who have uploaded a profile photo', 'ultimate-member' ),
'tooltip' => __( 'If \'Use Gravatars\' as profile photo is enabled, this option is ignored', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_has_profile_photo' ),
'value' => (bool) get_post_meta( $post_id, '_um_has_profile_photo', true ),
),
array(
'id' => '_um_has_cover_photo',
'type' => 'checkbox',
'label' => __( 'Only show members who have uploaded a cover photo', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_has_cover_photo' ),
'value' => (bool) get_post_meta( $post_id, '_um_has_cover_photo', true ),
),
array(
'id' => '_um_show_these_users',
@@ -1,6 +1,8 @@
<?php if ( ! defined( 'ABSPATH' ) ) {
exit;
} ?>
}
global $post_id; ?>
<div class="um-admin-metabox">
<?php
@@ -14,7 +16,7 @@
'type' => 'checkbox',
'label' => __( 'Show results only after search/filtration', 'ultimate-member' ),
'tooltip' => __( 'If turned on, member results will only appear after search/filter is performed', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_must_search' ),
'value' => (bool) get_post_meta( $post_id, '_um_must_search', true ),
'conditional' => array( '_um_search||_um_filters', '=', 1 ),
),
array(
@@ -2,41 +2,41 @@
exit;
}
global $post_id;
$user_fields = array();
foreach ( UM()->builtin()->all_user_fields() as $key => $arr ) {
$user_fields[ $key ] = isset( $arr['title'] ) ? $arr['title'] : '';
}
$post_id = get_the_ID();
$_um_tagline_fields = get_post_meta( $post_id, '_um_tagline_fields', true );
$_um_reveal_fields = get_post_meta( $post_id, '_um_reveal_fields', true );
$fields = array(
array(
'id' => '_um_profile_photo',
'type' => 'checkbox',
'label' => __( 'Enable Profile Photo', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_profile_photo' ),
'value' => (bool) get_post_meta( $post_id, '_um_profile_photo', true ),
),
array(
'id' => '_um_cover_photos',
'type' => 'checkbox',
'label' => __( 'Enable Cover Photo', 'ultimate-member' ),
'tooltip' => __( 'If turned on, the users cover photo will appear in the directory', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_cover_photos' ),
'value' => (bool) get_post_meta( $post_id, '_um_cover_photos', true ),
),
array(
'id' => '_um_show_name',
'type' => 'checkbox',
'label' => __( 'Show display name', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_show_name' ),
'value' => (bool) get_post_meta( $post_id, '_um_show_name', true ),
),
array(
'id' => '_um_show_tagline',
'type' => 'checkbox',
'label' => __( 'Show tagline below profile name', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_show_tagline' ),
'value' => (bool) get_post_meta( $post_id, '_um_show_tagline', true ),
),
array(
'id' => '_um_tagline_fields',
@@ -53,7 +53,7 @@ $fields = array(
'id' => '_um_show_userinfo',
'type' => 'checkbox',
'label' => __( 'Show extra user information below tagline?', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_show_userinfo' ),
'value' => (bool) get_post_meta( $post_id, '_um_show_userinfo', true ),
),
array(
'id' => '_um_reveal_fields',
@@ -70,7 +70,7 @@ $fields = array(
'id' => '_um_show_social',
'type' => 'checkbox',
'label' => __( 'Show social connect icons in extra user information section', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_show_social' ),
'value' => (bool) get_post_meta( $post_id, '_um_show_social', true ),
'conditional' => array( '_um_show_userinfo', '=', 1 ),
),
array(
@@ -78,7 +78,7 @@ $fields = array(
'type' => 'checkbox',
'label' => __( 'Hide extra user information to the reveal section', 'ultimate-member' ),
'tooltip' => __( 'If not checked always shown', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_userinfo_animate' ),
'value' => (bool) get_post_meta( $post_id, '_um_userinfo_animate', true ),
'conditional' => array( '_um_show_userinfo', '=', 1 ),
),
);
@@ -26,7 +26,7 @@ $_um_search_filters = get_post_meta( $post_id, '_um_search_filters', true ); ?>
'type' => 'checkbox',
'label' => __( 'Enable Search feature', 'ultimate-member' ),
'tooltip' => __( 'If turned on, users will be able to search members in this directory', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_search' ),
'value' => (bool) get_post_meta( $post_id, '_um_search', true ),
),
array(
'id' => '_um_roles_can_search',
@@ -43,7 +43,7 @@ $_um_search_filters = get_post_meta( $post_id, '_um_search_filters', true ); ?>
'type' => 'checkbox',
'label' => __( 'Enable Filters feature', 'ultimate-member' ),
'tooltip' => __( 'If turned on, users will be able to filter members in this directory', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_filters' ),
'value' => (bool) get_post_meta( $post_id, '_um_filters', true ),
),
array(
'id' => '_um_roles_can_filter',
@@ -71,7 +71,7 @@ $_um_search_filters = get_post_meta( $post_id, '_um_search_filters', true ); ?>
'type' => 'checkbox',
'label' => __( 'Expand the filter bar by default', 'ultimate-member' ),
'tooltip' => __( 'If turned on, filters bar will be visible after a page loading', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_filters_expanded' ),
'value' => (bool) get_post_meta( $post_id, '_um_filters_expanded', true ),
'conditional' => array( '_um_filters', '=', 1 ),
),
array(
@@ -79,7 +79,7 @@ $_um_search_filters = get_post_meta( $post_id, '_um_search_filters', true ); ?>
'type' => 'checkbox',
'label' => __( 'Can filter bar be collapsed', 'ultimate-member' ),
'tooltip' => __( 'If turned on, filters bar can be collapsed after a page loading', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_filters_is_collapsible' ),
'value' => (bool) get_post_meta( $post_id, '_um_filters_is_collapsible', true ),
'conditional' => array( '_um_filters_expanded', '=', 1 ),
),
array(
@@ -37,7 +37,7 @@ $fields = array(
'type' => 'checkbox',
'label' => __( 'Enable custom sorting', 'ultimate-member' ),
'tooltip' => __( 'Whether to provide an ability to change the sorting on the directory page', 'ultimate-member' ),
'value' => UM()->query()->get_meta_value( '_um_enable_sorting' ),
'value' => (bool) get_post_meta( $post_id, '_um_enable_sorting', true ),
),
array(
'id' => '_um_sorting_fields',