- added custom date format ability for datepicker field;

This commit is contained in:
nikitasinelnikov
2019-10-22 12:24:36 +03:00
parent 4e791ef722
commit fca6de05d6
4 changed files with 32 additions and 16 deletions
@@ -1736,6 +1736,16 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
}
break;
case '_format_custom':
?>
<p><label for="_format_custom"><?php _e( 'Use custom Date format', 'ultimate-member' ); ?> <?php UM()->tooltip( __( 'This option overrides "Date User-Friendly Format" option. See https://www.php.net/manual/en/function.date.php', 'ultimate-member' ) ); ?></label>
<input type="text" name="_format_custom" id="_format_custom" value="<?php echo htmlspecialchars( $this->edit_mode_value, ENT_QUOTES ); ?>" placeholder="j M Y" />
</p>
<?php
break;
case '_pretty_format':
?>
+15 -15
View File
@@ -398,27 +398,27 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
),
'date' => array(
'name' => 'Date Picker',
'col1' => array('_title','_metakey','_help','_default','_range','_years','_years_x','_range_start','_range_end','_visibility'),
'col2' => array('_label','_placeholder','_public','_roles','_format','_pretty_format','_disabled_weekdays'),
'col3' => array('_required','_editable','_icon'),
'validate' => array(
'_title' => array(
'mode' => 'required',
'name' => 'Date Picker',
'col1' => array( '_title', '_metakey', '_help', '_default', '_range', '_years', '_years_x', '_range_start', '_range_end', '_visibility' ),
'col2' => array( '_label', '_placeholder', '_public', '_roles', '_format', '_format_custom', '_pretty_format', '_disabled_weekdays' ),
'col3' => array( '_required', '_editable', '_icon' ),
'validate' => array(
'_title' => array(
'mode' => 'required',
'error' => __( 'You must provide a title', 'ultimate-member' )
),
'_metakey' => array(
'mode' => 'unique',
'_metakey' => array(
'mode' => 'unique',
),
'_years' => array(
'mode' => 'numeric',
'_years' => array(
'mode' => 'numeric',
'error' => __( 'Number of years is not valid', 'ultimate-member' )
),
'_range_start' => array(
'mode' => 'range-start',
'_range_start' => array(
'mode' => 'range-start',
),
'_range_end' => array(
'mode' => 'range-end',
'_range_end' => array(
'mode' => 'range-end',
),
)
),
+2 -1
View File
@@ -227,7 +227,8 @@ function um_profile_field_filter_hook__date( $value, $data ) {
if ( isset( $data['pretty_format'] ) && $data['pretty_format'] == 1 ) {
$value = UM()->datetime()->get_age( $value );
} else {
$value = date_i18n( $data['format'], strtotime( $value ) );
$format = empty( $data['format_custom'] ) ? $data['format'] : $data['format_custom'];
$value = date_i18n( $format, strtotime( $value ) );
}
return $value;
+5
View File
@@ -154,6 +154,7 @@ The plugin works with popular caching plugins by automatically excluding Ultimat
- Additional parameter 'user_id' to action hook 'um_user_after_updating_profile'
- Added ability to set profile/cover image sizes from Ultimate Member -> General -> Uploads settings or Original size
- Added ability edit cover photo HTML (e.g. for adding some HTML attributes. See how add srcset attribute based on all generated cover sizes [here](https://docs.ultimatemember.com/article/1519-change-cover-photo-html))
- Added custom date format for Date Picker field
* Bugfixes:
- Optimized usermeta for Account submit security
@@ -168,6 +169,10 @@ The plugin works with popular caching plugins by automatically excluding Ultimat
(it makes the same for {site_url}/user and {site_url}/user/{user_slug} )
- Fixed security issue on registration form submission when username or email have conditional logic
- Fixed RTL styles issues on user profile and account pages
- Fixed upload profile/cover photos at the profile page, don't apply until the crop finished
- Fixed alphabetical field validation for cyrillic and not UTF-8 symbols
- Localized um-raty.js library
= 2.0.56: August 21, 2019 =