Merge branch 'master' of https://github.com/ultimatemember/ultimatemember into beta/2.1.0

This commit is contained in:
nikitasinelnikov
2019-08-28 17:09:45 +03:00
78 changed files with 1607 additions and 705 deletions
+8 -29
View File
@@ -54,6 +54,11 @@ if ( ! class_exists( 'um\admin\core\Admin_Builder' ) ) {
$validate = $field_attr['validate'];
foreach ( $validate as $post_input => $arr ) {
$skip = apply_filters( 'um_admin_builder_skip_field_validation', false, $post_input, $array );
if ( $skip ) {
continue;
}
$mode = $arr['mode'];
switch ( $mode ) {
@@ -115,42 +120,16 @@ if ( ! class_exists( 'um\admin\core\Admin_Builder' ) ) {
*/
extract( $array );
/**
* UM hook
*
* @type filter
* @title um_fields_without_metakey
* @description Field Types without meta key
* @input_vars
* [{"var":"$types","type":"array","desc":"Field Types"}]
* @change_log
* ["Since: 2.0"]
* @usage add_filter( 'um_fields_without_metakey', 'function_name', 10, 1 );
* @example
* <?php
* add_filter( 'um_fields_without_metakey', 'my_fields_without_metakey', 10, 1 );
* function my_fields_without_metakey( $types ) {
* // your code here
* return $types;
* }
* ?>
*/
$fields_without_metakey = apply_filters( 'um_fields_without_metakey', array(
'block',
'shortcode',
'spacing',
'divider',
'group'
) );
$fields_without_metakey = UM()->builtin()->get_fields_without_metakey();
$fields = UM()->query()->get_attr('custom_fields', $form_id);
$fields = UM()->query()->get_attr( 'custom_fields', $form_id );
$count = 1;
if ( ! empty( $fields ) ) {
$count = count( $fields ) + 1;
}
// set unique meta key
if ( in_array( $field_type, $fields_without_metakey ) || ! isset( $array['post']['_metakey'] ) ) {
if ( in_array( $field_type, $fields_without_metakey ) && ! isset( $array['post']['_metakey'] ) ) {
$array['post']['_metakey'] = "um_{$field_type}_{$form_id}_{$count}";
}
+2 -2
View File
@@ -164,8 +164,8 @@ if ( ! class_exists( 'um\admin\core\Admin_Enqueue' ) ) {
*/
function load_role_wrapper() {
wp_register_script( 'um_admin_role_wrapper', $this->js_url . 'um-admin-role-wrapper.js', array( 'jquery' ), ultimatemember_version, true );
$localize_roles_data = get_option( 'um_roles' );
wp_localize_script( 'um_admin_role_wrapper', 'um_roles', $localize_roles_data );
$localize_roles_data = get_option( 'um_roles' );
wp_localize_script( 'um_admin_role_wrapper', 'um_roles', (array) $localize_roles_data );
wp_enqueue_script( 'um_admin_role_wrapper' );
}