- fixed registration and profile form roles (some sites empty profile + wrong registration roles);

This commit is contained in:
nikitozzzzzzz
2018-04-13 15:08:00 +03:00
parent a7132a5142
commit f06e9cce0d
3 changed files with 9 additions and 5 deletions
+6 -3
View File
@@ -516,9 +516,12 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) {
// for profiles only
if ( $mode == 'profile' && um_profile_id() ) {
$current_user_roles = UM()->roles()->get_all_user_roles( um_profile_id() );
if ( ! empty( $args['role'] ) && ! in_array( $args['role'], $current_user_roles ) ) {
return '';
$use_custom = get_post_meta( $this->form_id, "_um_{$mode}_use_custom_settings", true );
if ( $use_custom ) { // Custom Form settings
$current_user_roles = UM()->roles()->get_all_user_roles( um_profile_id() );
if ( ! empty( $args['role'] ) && ! in_array( $args['role'], $current_user_roles ) ) {
return '';
}
}
}
+1 -1
View File
@@ -440,7 +440,7 @@ function um_add_user_role( $args ) {
$role = apply_filters( 'um_registration_user_role', UM()->form()->assigned_role( UM()->form()->form_id ), $args );
if ( empty( $role ) ) return;
if ( empty( $use_custom_settings ) || empty( $role ) ) return;
/**
* UM hook