- fixed integration with User Tags extension (remove some hardcode, changed to hooks);

- fixed 2.0 upgrades for User roles meta data;
- clear/review code;
This commit is contained in:
nikitozzzzzzz
2017-09-06 09:03:24 +03:00
parent 31de1e49ce
commit 2921707a65
9 changed files with 309 additions and 102 deletions
+2 -9
View File
@@ -79,15 +79,8 @@ if ( ! class_exists( 'Members' ) ) {
// additional filter for search field attributes
$attrs = apply_filters("um_search_field_{$filter}", $attrs);
if ( UM()->builtin()->is_dropdown_field( $filter, $attrs ) ) {
$type = 'select';
} else if ( 'user_tags' == $attrs['type'] ) {
$attrs['options'] = apply_filters('um_multiselect_options_user_tags', array(), $attrs);
$attrs['custom'] = 1;
$type = 'select';
} else {
$type = 'text';
}
$type = UM()->builtin()->is_dropdown_field( $filter, $attrs ) ? 'select' : 'text';
$type = apply_filters( 'um_search_field_type', $type, $attrs );
// filter all search fields
$attrs = apply_filters( 'um_search_fields', $attrs );
+2 -4
View File
@@ -203,14 +203,12 @@ function um_submit_account_errors_hook( $args ) {
$url = UM()->permalinks()->get_current_url( true );
$url = add_query_arg( 'updated', 'account', $url );
UM()->redirect( $url );
exit;
um_js_redirect( $url );
}
}
}
UM()->redirect( $url );
exit;
um_js_redirect( $url );
}
+3 -4
View File
@@ -220,10 +220,6 @@
UM()->form()->add_error($key, sprintf(__('%s is required.','ultimate-member'), $array['title'] ) );
}
if ( defined('um_user_tags_path') && isset( $array['type'] ) && $array['type'] == 'user_tags' && isset( $array['required'] ) && $array['required'] == 1 && !isset( $args[$key] ) ) {
UM()->form()->add_error($key, sprintf(__('%s is required.','ultimate-member'), $array['title'] ) );
}
if ( isset( $array['type'] ) && $array['type'] == 'radio' && isset( $array['required'] ) && $array['required'] == 1 && !isset( $args[$key] ) && !in_array($key, array('role_radio','role_select') ) ) {
UM()->form()->add_error($key, sprintf(__('%s is required.','ultimate-member'), $array['title'] ) );
}
@@ -238,6 +234,9 @@
}
}
do_action( 'um_add_error_on_form_submit_validation', $array, $key, $args );
if ( isset( $args[$key] ) ) {
if ( isset( $array['required'] ) && $array['required'] == 1 ) {