mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
- add default sorting
This commit is contained in:
@@ -389,6 +389,12 @@ if ( ! class_exists( 'um\admin\Admin' ) ) {
|
||||
'_um_sortby_custom_label' => array(
|
||||
'sanitize' => 'text',
|
||||
),
|
||||
'_um_sortby_custom_type' => array(
|
||||
'sanitize' => 'text',
|
||||
),
|
||||
'_um_sortby_custom_order' => array(
|
||||
'sanitize' => 'text',
|
||||
),
|
||||
'_um_enable_sorting' => array(
|
||||
'sanitize' => 'bool',
|
||||
),
|
||||
|
||||
@@ -7,6 +7,18 @@ global $post_id;
|
||||
$_um_sorting_fields = get_post_meta( $post_id, '_um_sorting_fields', true );
|
||||
$_um_sorting_fields = empty( $_um_sorting_fields ) ? array() : $_um_sorting_fields;
|
||||
|
||||
$custom_type_options = array(
|
||||
'CHAR' => 'CHAR',
|
||||
'NUMERIC' => 'NUMERIC',
|
||||
'BINARY' => 'BINARY',
|
||||
'DATE' => 'DATE',
|
||||
'DATETIME' => 'DATETIME',
|
||||
'DECIMAL' => 'DECIMAL',
|
||||
'SIGNED' => 'SIGNED',
|
||||
'TIME' => 'TIME',
|
||||
'UNSIGNED' => 'UNSIGNED',
|
||||
);
|
||||
|
||||
$fields = array(
|
||||
array(
|
||||
'id' => '_um_sortby',
|
||||
@@ -24,6 +36,27 @@ $fields = array(
|
||||
'value' => UM()->query()->get_meta_value( '_um_sortby_custom', null, 'na' ),
|
||||
'conditional' => array( '_um_sortby', '=', 'other' ),
|
||||
),
|
||||
array(
|
||||
'id' => '_um_sortby_custom_type',
|
||||
'type' => 'select',
|
||||
'label' => __( 'Data type', 'ultimate-member' ),
|
||||
'tooltip' => __( 'To correct sort by a custom field, choose a data type', 'ultimate-member' ),
|
||||
'value' => UM()->query()->get_meta_value( '_um_sortby_custom_type', null, 'CHAR' ),
|
||||
'options' => $custom_type_options,
|
||||
'conditional' => array( '_um_sortby', '=', 'other' ),
|
||||
),
|
||||
array(
|
||||
'id' => '_um_sortby_custom_order',
|
||||
'type' => 'select',
|
||||
'label' => __( 'Order', 'ultimate-member' ),
|
||||
'tooltip' => __( 'To correct sort by a custom field, choose an order', 'ultimate-member' ),
|
||||
'value' => UM()->query()->get_meta_value( '_um_sortby_custom_order', null, 'ASC' ),
|
||||
'options' => array(
|
||||
'ASC' => 'ASC',
|
||||
'DESC' => 'DESC',
|
||||
),
|
||||
'conditional' => array( '_um_sortby', '=', 'other' ),
|
||||
),
|
||||
array(
|
||||
'id' => '_um_sortby_custom_label',
|
||||
'type' => 'text',
|
||||
|
||||
Reference in New Issue
Block a user