From 1de7855b1b587aff7d95ae1449bdb4fd639400b7 Mon Sep 17 00:00:00 2001 From: nikitozzzzzzz Date: Wed, 17 Jan 2018 11:34:00 +0200 Subject: [PATCH] - fixed role duplicates in some cases in 2.0 upgrade; --- includes/admin/core/packages/2.0-beta1.php | 1095 ++++++++++---------- 1 file changed, 552 insertions(+), 543 deletions(-) diff --git a/includes/admin/core/packages/2.0-beta1.php b/includes/admin/core/packages/2.0-beta1.php index 59fc6b2b..b5ebb3fd 100644 --- a/includes/admin/core/packages/2.0-beta1.php +++ b/includes/admin/core/packages/2.0-beta1.php @@ -1,6 +1,6 @@ query( array( - 'post_type' => 'um_form', - 'meta_query' => array( - 'relation' => 'AND', - array( - 'key' => '_um_mode', - 'value' => 'register' - ), - array( - 'key' => '_um_register_use_globals', - 'value' => true - ) - ), - 'fields' => 'ids' + 'post_type' => 'um_form', + 'meta_query' => array( + 'relation' => 'AND', + array( + 'key' => '_um_mode', + 'value' => 'register' + ), + array( + 'key' => '_um_register_use_globals', + 'value' => true + ) + ), + 'fields' => 'ids' ) ); $login_forms = $forms_query->query( array( - 'post_type' => 'um_form', - 'meta_query' => array( - 'relation' => 'AND', - array( - 'key' => '_um_mode', - 'value' => 'login' - ), - array( - 'key' => '_um_login_use_globals', - 'value' => true - ) - ), - 'fields' => 'ids' + 'post_type' => 'um_form', + 'meta_query' => array( + 'relation' => 'AND', + array( + 'key' => '_um_mode', + 'value' => 'login' + ), + array( + 'key' => '_um_login_use_globals', + 'value' => true + ) + ), + 'fields' => 'ids' ) ); $profile_forms = $forms_query->query( array( - 'post_type' => 'um_form', - 'meta_query' => array( - 'relation' => 'AND', - array( - 'key' => '_um_mode', - 'value' => 'profile' - ), - array( - 'key' => '_um_profile_use_globals', - 'value' => true - ) - ), - 'fields' => 'ids' + 'post_type' => 'um_form', + 'meta_query' => array( + 'relation' => 'AND', + array( + 'key' => '_um_mode', + 'value' => 'profile' + ), + array( + 'key' => '_um_profile_use_globals', + 'value' => true + ) + ), + 'fields' => 'ids' ) ); $css = ''; $active_color = UM()->options()->get( 'active_color' ); if ( $active_color ) { - $css .= " + $css .= " .um .um-tip:hover, .um .um-field-radio.active:not(.um-field-radio-state-disabled) i, .um .um-field-checkbox.active:not(.um-field-radio-state-disabled) i, @@ -112,7 +112,7 @@ div.uimob800 .um-account-side li a.current:hover $secondary_color = UM()->options()->get( 'secondary_color' ); if ( $secondary_color ) { - $css .= " + $css .= " .um .um-field-group-head:hover, .picker__footer, .picker__header, @@ -139,7 +139,7 @@ $css .= " $primary_btn_color = UM()->options()->get( 'primary_btn_color' ); if ( $primary_btn_color ) { - $css .= " + $css .= " .um input[type=submit]:disabled:hover { background: $primary_btn_color; } @@ -161,13 +161,13 @@ if ( $primary_btn_color ) { $primary_btn_hover = UM()->options()->get( 'primary_btn_hover' ); if ( $primary_btn_hover ) { - $css .= " + $css .= " .um input[type=submit].um-button:hover, .um a.um-button:hover { background-color: $primary_btn_hover; } -.um a.um-link:hover, +.um a.um-link:hover, .um a.um-link-hvr:hover { color: $primary_btn_hover; } @@ -176,7 +176,7 @@ if ( $primary_btn_hover ) { $primary_btn_text = UM()->options()->get( 'primary_btn_text' ); if ( $primary_btn_text ) { - $css .= " + $css .= " .um .um-button { color: $primary_btn_text; } @@ -185,7 +185,7 @@ if ( $primary_btn_text ) { $secondary_btn_color = UM()->options()->get( 'secondary_btn_color' ); if ( $secondary_btn_color ) { - $css .= " + $css .= " .um .um-button.um-alt, .um input[type=submit].um-button.um-alt { background: $secondary_btn_color; @@ -195,7 +195,7 @@ if ( $secondary_btn_color ) { $secondary_btn_hover = UM()->options()->get( 'secondary_btn_hover' ); if ( $secondary_btn_hover ) { - $css .= " + $css .= " .um .um-button.um-alt:hover, .um input[type=submit].um-button.um-alt:hover{ background: $secondary_btn_hover; @@ -205,7 +205,7 @@ if ( $secondary_btn_hover ) { $secondary_btn_text = UM()->options()->get( 'secondary_btn_text' ); if ( $secondary_btn_text ) { - $css .= " + $css .= " .um .um-button.um-alt, .um input[type=submit].um-button.um-alt { color: $secondary_btn_text; @@ -215,7 +215,7 @@ if ( $secondary_btn_text ) { $help_tip_color = UM()->options()->get( 'help_tip_color' ); if ( $help_tip_color ) { - $css .= " + $css .= " .um .um-tip { color: $help_tip_color; } @@ -224,7 +224,7 @@ if ( $help_tip_color ) { $form_field_label = UM()->options()->get( 'form_field_label' ); if ( $form_field_label ) { - $css .= " + $css .= " .um .um-field-label { color: $form_field_label; } @@ -233,7 +233,7 @@ if ( $form_field_label ) { $form_border = UM()->options()->get( 'form_border' ); if ( $form_border ) { - $css .= " + $css .= " .um .um-form input[type=text], .um .um-form input[type=tel], .um .um-form input[type=number], @@ -257,7 +257,7 @@ if ( $form_border ) { $form_border_hover = UM()->options()->get( 'form_border_hover' ); if ( $form_border_hover ) { - $css .= " + $css .= " .um .um-form input[type=text]:focus, .um .um-form input[type=tel]:focus, .um .um-form input[type=number]:focus, @@ -272,7 +272,7 @@ if ( $form_border_hover ) { $form_bg_color = UM()->options()->get( 'form_bg_color' ); if ( $form_bg_color ) { - $css .= " + $css .= " .um .um-form input[type=text], .um .um-form input[type=tel], .um .um-form input[type=number], @@ -288,7 +288,7 @@ if ( $form_bg_color ) { $form_bg_color_focus = UM()->options()->get( 'form_bg_color_focus' ); if ( $form_bg_color_focus ) { - $css .= " + $css .= " .um .um-form input[type=text]:focus, .um .um-form input[type=tel]:focus, .um .um-form input[type=number]:focus, @@ -301,7 +301,7 @@ if ( $form_bg_color_focus ) { $form_text_color = UM()->options()->get( 'form_text_color' ); if ( $form_text_color ) { - $css .= " + $css .= " .um .um-form input[type=text], .um .um-form input[type=tel], .um .um-form input[type=password], @@ -324,7 +324,7 @@ if ( $form_text_color ) { $form_placeholder = UM()->options()->get( 'form_placeholder' ); if ( $form_placeholder ) { - $css .= " + $css .= " .um .um-form ::-webkit-input-placeholder { color: $form_placeholder; @@ -360,7 +360,7 @@ if ( $form_placeholder ) { $form_icon_color = UM()->options()->get( 'form_icon_color' ); if ( $form_icon_color ) { - $css .= " + $css .= " .um .um-field-icon i, .select2-container .select2-choice .select2-arrow:before, .select2-search:before, @@ -373,7 +373,7 @@ if ( $form_icon_color ) { $form_asterisk_color = UM()->options()->get( 'form_asterisk_color' ); if ( $form_asterisk_color ) { - $css .= " + $css .= " .um span.um-req { color: $form_asterisk_color; @@ -384,43 +384,43 @@ if ( $form_asterisk_color ) { $profile_photocorner = UM()->options()->get( 'profile_photocorner' ); if ( $profile_photocorner == 1 ) { - $css .= " + $css .= " .um .um-profile-photo a.um-profile-photo-img, .um .um-profile-photo img, .um .um-profile-photo span.um-profile-photo-overlay -{ - -moz-border-radius: 999px !important; - -webkit-border-radius: 999px !important; - border-radius: 999px !important +{ + -moz-border-radius: 999px !important; + -webkit-border-radius: 999px !important; + border-radius: 999px !important } "; } else if ( $profile_photocorner == 2 ) { - $css .= " + $css .= " .um .um-profile-photo a.um-profile-photo-img, .um .um-profile-photo img, .um .um-profile-photo span.um-profile-photo-overlay -{ - -moz-border-radius: 4px !important; - -webkit-border-radius: 4px !important; - border-radius: 4px !important +{ + -moz-border-radius: 4px !important; + -webkit-border-radius: 4px !important; + border-radius: 4px !important } "; } else if ( $profile_photocorner == 3 ) { - $css .= " + $css .= " .um .um-profile-photo a.um-profile-photo-img, .um .um-profile-photo img, .um .um-profile-photo span.um-profile-photo-overlay -{ - -moz-border-radius: 0px !important; - -webkit-border-radius: 0px !important; - border-radius: 0px !important +{ + -moz-border-radius: 0px !important; + -webkit-border-radius: 0px !important; + border-radius: 0px !important } "; } $profile_main_bg = UM()->options()->get( 'profile_main_bg' ); if ( $profile_main_bg ) { - $css .= " + $css .= " .um-profile { background-color: $profile_main_bg; } @@ -429,7 +429,7 @@ if ( $profile_main_bg ) { $profile_header_bg = UM()->options()->get( 'profile_header_bg' ); if ( $profile_header_bg ) { - $css .= " + $css .= " .um-profile.um .um-header { background-color: $profile_header_bg; } @@ -438,7 +438,7 @@ if ( $profile_header_bg ) { $profile_header_text = UM()->options()->get( 'profile_header_text' ); if ( $profile_header_text ) { - $css .= " + $css .= " .um-profile.um .um-profile-meta { color: $profile_header_text; } @@ -447,7 +447,7 @@ if ( $profile_header_text ) { $profile_header_link_color = UM()->options()->get( 'profile_header_link_color' ); if ( $profile_header_link_color ) { - $css .= " + $css .= " .um-profile.um .um-name a { color: $profile_header_link_color; } @@ -456,7 +456,7 @@ if ( $profile_header_link_color ) { $profile_header_link_hcolor = UM()->options()->get( 'profile_header_link_hcolor' ); if ( $profile_header_link_hcolor ) { - $css .= " + $css .= " .um-profile.um .um-name a:hover { color: $profile_header_link_hcolor; } @@ -465,7 +465,7 @@ if ( $profile_header_link_hcolor ) { $profile_header_icon_color = UM()->options()->get( 'profile_header_icon_color' ); if ( $profile_header_icon_color ) { - $css .= " + $css .= " .um-profile.um .um-profile-headericon a { color: $profile_header_icon_color; } @@ -474,7 +474,7 @@ if ( $profile_header_icon_color ) { $profile_header_icon_hcolor = UM()->options()->get( 'profile_header_icon_hcolor' ); if ( $profile_header_icon_hcolor ) { - $css .= " + $css .= " .um-profile.um .um-profile-headericon a:hover, .um-profile.um .um-profile-edit-a.active { color: $profile_header_icon_hcolor; @@ -485,18 +485,18 @@ if ( $profile_header_icon_hcolor ) { foreach ( $registration_forms as $form_id ) { - $align = get_post_meta( $form_id, '_um_register_align', true ); - if ( $align && $align != 'center' ) { - $css .= " + $align = get_post_meta( $form_id, '_um_register_align', true ); + if ( $align && $align != 'center' ) { + $css .= " .um-$form_id.um { float: $align; } "; - } + } - $primary_btn_color = get_post_meta( $form_id, '_um_register_primary_btn_color', true ); - if ( $primary_btn_color ) { - $css .= " + $primary_btn_color = get_post_meta( $form_id, '_um_register_primary_btn_color', true ); + if ( $primary_btn_color ) { + $css .= " .um-$form_id.um input[type=submit]:disabled:hover { background: $primary_btn_color; } @@ -514,82 +514,82 @@ foreach ( $registration_forms as $form_id ) { color: $primary_btn_color; } "; - } + } - $primary_btn_hover = get_post_meta( $form_id, '_um_register_primary_btn_hover', true ); - if ( $primary_btn_hover ) { - $css .= " + $primary_btn_hover = get_post_meta( $form_id, '_um_register_primary_btn_hover', true ); + if ( $primary_btn_hover ) { + $css .= " .um-$form_id.um input[type=submit].um-button:hover, .um-$form_id.um a.um-button:hover { background-color: $primary_btn_hover; } -.um-$form_id.um a.um-link:hover, +.um-$form_id.um a.um-link:hover, .um-$form_id.um a.um-link-hvr:hover { color: $primary_btn_hover; } "; - } + } - $primary_btn_text = get_post_meta( $form_id, '_um_register_primary_btn_text', true ); - if ( $primary_btn_text ) { - $css .= " + $primary_btn_text = get_post_meta( $form_id, '_um_register_primary_btn_text', true ); + if ( $primary_btn_text ) { + $css .= " .um-$form_id.um .um-button { color: $primary_btn_text; } "; - } + } - $secondary_button = get_post_meta( $form_id, '_um_register_secondary_btn', true ); - if ( $secondary_button ) { + $secondary_button = get_post_meta( $form_id, '_um_register_secondary_btn', true ); + if ( $secondary_button ) { - $secondary_btn_color = get_post_meta( $form_id, '_um_register_secondary_btn_color', true ); - if ( $secondary_btn_color ) { - $css .= " + $secondary_btn_color = get_post_meta( $form_id, '_um_register_secondary_btn_color', true ); + if ( $secondary_btn_color ) { + $css .= " .um-$form_id.um .um-button.um-alt, .um-$form_id.um input[type=submit].um-button.um-alt { background: $secondary_btn_color; } "; - } + } - $secondary_btn_hover = get_post_meta( $form_id, '_um_register_secondary_btn_hover', true ); - if ( $secondary_btn_hover ) { - $css .= " + $secondary_btn_hover = get_post_meta( $form_id, '_um_register_secondary_btn_hover', true ); + if ( $secondary_btn_hover ) { + $css .= " .um-$form_id.um .um-button.um-alt:hover, .um-$form_id.um input[type=submit].um-button.um-alt:hover{ background: $secondary_btn_hover; } "; - } + } - $secondary_btn_text = get_post_meta( $form_id, '_um_register_secondary_btn_text', true ); - if ( $secondary_btn_text ) { - $css .= " + $secondary_btn_text = get_post_meta( $form_id, '_um_register_secondary_btn_text', true ); + if ( $secondary_btn_text ) { + $css .= " .um-$form_id.um .um-button.um-alt, .um-$form_id.um input[type=submit].um-button.um-alt { color: $secondary_btn_text; } "; - } - } + } + } } foreach ( $login_forms as $form_id ) { - $align = get_post_meta( $form_id, '_um_login_align', true ); - if ( $align && $align != 'center' ) { - $css .= " + $align = get_post_meta( $form_id, '_um_login_align', true ); + if ( $align && $align != 'center' ) { + $css .= " .um-$form_id.um { float: $align; } "; - } + } - $primary_btn_color = get_post_meta( $form_id, '_um_login_primary_btn_color', true ); - if ( $primary_btn_color ) { - $css .= " + $primary_btn_color = get_post_meta( $form_id, '_um_login_primary_btn_color', true ); + if ( $primary_btn_color ) { + $css .= " .um-$form_id.um input[type=submit]:disabled:hover { background: $primary_btn_color; } @@ -607,81 +607,81 @@ foreach ( $login_forms as $form_id ) { color: $primary_btn_color; } "; - } + } - $primary_btn_hover = get_post_meta( $form_id, '_um_login_primary_btn_hover', true ); - if ( $primary_btn_hover ) { - $css .= " + $primary_btn_hover = get_post_meta( $form_id, '_um_login_primary_btn_hover', true ); + if ( $primary_btn_hover ) { + $css .= " .um-$form_id.um input[type=submit].um-button:hover, .um-$form_id.um a.um-button:hover { background-color: $primary_btn_hover; } -.um-$form_id.um a.um-link:hover, +.um-$form_id.um a.um-link:hover, .um-$form_id.um a.um-link-hvr:hover { color: $primary_btn_hover; } "; - } + } - $primary_btn_text = get_post_meta( $form_id, '_um_login_primary_btn_text', true ); - if ( $primary_btn_text ) { - $css .= " + $primary_btn_text = get_post_meta( $form_id, '_um_login_primary_btn_text', true ); + if ( $primary_btn_text ) { + $css .= " .um-$form_id.um .um-button { color: $primary_btn_text; } "; - } + } - $secondary_button = get_post_meta( $form_id, '_um_login_secondary_btn', true ); - if ( $secondary_button ) { + $secondary_button = get_post_meta( $form_id, '_um_login_secondary_btn', true ); + if ( $secondary_button ) { - $secondary_btn_color = get_post_meta( $form_id, '_um_login_secondary_btn_color', true ); - if ( $secondary_btn_color ) { - $css .= " + $secondary_btn_color = get_post_meta( $form_id, '_um_login_secondary_btn_color', true ); + if ( $secondary_btn_color ) { + $css .= " .um-$form_id.um .um-button.um-alt, .um-$form_id.um input[type=submit].um-button.um-alt { background: $secondary_btn_color; } "; - } + } - $secondary_btn_hover = get_post_meta( $form_id, '_um_login_secondary_btn_hover', true ); - if ( $secondary_btn_hover ) { - $css .= " + $secondary_btn_hover = get_post_meta( $form_id, '_um_login_secondary_btn_hover', true ); + if ( $secondary_btn_hover ) { + $css .= " .um-$form_id.um .um-button.um-alt:hover, .um-$form_id.um input[type=submit].um-button.um-alt:hover{ background: $secondary_btn_hover; } "; - } + } - $secondary_btn_text = get_post_meta( $form_id, '_um_login_secondary_btn_text', true ); - if ( $secondary_btn_text ) { - $css .= " + $secondary_btn_text = get_post_meta( $form_id, '_um_login_secondary_btn_text', true ); + if ( $secondary_btn_text ) { + $css .= " .um-$form_id.um .um-button.um-alt, .um-$form_id.um input[type=submit].um-button.um-alt { color: $secondary_btn_text; } "; - } - } + } + } } foreach ( $profile_forms as $form_id ) { - $align = get_post_meta( $form_id, '_um_profile_align', true ); - if ( $align && $align != 'center' ) { - $css .= " + $align = get_post_meta( $form_id, '_um_profile_align', true ); + if ( $align && $align != 'center' ) { + $css .= " .um-$form_id.um { float: $align; } "; - } + } - $primary_btn_color = get_post_meta( $form_id, '_um_profile_primary_btn_color', true ); - if ( $primary_btn_color ) { - $css .= " + $primary_btn_color = get_post_meta( $form_id, '_um_profile_primary_btn_color', true ); + if ( $primary_btn_color ) { + $css .= " .um-$form_id.um input[type=submit]:disabled:hover { background: $primary_btn_color; } @@ -699,175 +699,175 @@ foreach ( $profile_forms as $form_id ) { color: $primary_btn_color; } "; - } + } - $primary_btn_hover = get_post_meta( $form_id, '_um_profile_primary_btn_hover', true ); - if ( $primary_btn_hover ) { - $css .= " + $primary_btn_hover = get_post_meta( $form_id, '_um_profile_primary_btn_hover', true ); + if ( $primary_btn_hover ) { + $css .= " .um-$form_id.um input[type=submit].um-button:hover, .um-$form_id.um a.um-button:hover { background-color: $primary_btn_hover; } -.um-$form_id.um a.um-link:hover, +.um-$form_id.um a.um-link:hover, .um-$form_id.um a.um-link-hvr:hover { color: $primary_btn_hover; } "; - } + } - $primary_btn_text = get_post_meta( $form_id, '_um_profile_primary_btn_text', true ); - if ( $primary_btn_text ) { - $css .= " + $primary_btn_text = get_post_meta( $form_id, '_um_profile_primary_btn_text', true ); + if ( $primary_btn_text ) { + $css .= " .um-$form_id.um .um-button { color: $primary_btn_text; } "; - } + } - $secondary_button = get_post_meta( $form_id, '_um_profile_secondary_btn', true ); - if ( $secondary_button ) { + $secondary_button = get_post_meta( $form_id, '_um_profile_secondary_btn', true ); + if ( $secondary_button ) { - $secondary_btn_color = get_post_meta( $form_id, '_um_profile_secondary_btn_color', true ); - if ( $secondary_btn_color ) { - $css .= " + $secondary_btn_color = get_post_meta( $form_id, '_um_profile_secondary_btn_color', true ); + if ( $secondary_btn_color ) { + $css .= " .um-$form_id.um .um-button.um-alt, .um-$form_id.um input[type=submit].um-button.um-alt { background: $secondary_btn_color; } "; - } + } - $secondary_btn_hover = get_post_meta( $form_id, '_um_profile_secondary_btn_hover', true ); - if ( $secondary_btn_hover ) { - $css .= " + $secondary_btn_hover = get_post_meta( $form_id, '_um_profile_secondary_btn_hover', true ); + if ( $secondary_btn_hover ) { + $css .= " .um-$form_id.um .um-button.um-alt:hover, .um-$form_id.um input[type=submit].um-button.um-alt:hover{ background: $secondary_btn_hover; } "; - } + } - $secondary_btn_text = get_post_meta( $form_id, '_um_profile_secondary_btn_text', true ); - if ( $secondary_btn_text ) { - $css .= " + $secondary_btn_text = get_post_meta( $form_id, '_um_profile_secondary_btn_text', true ); + if ( $secondary_btn_text ) { + $css .= " .um-$form_id.um .um-button.um-alt, .um-$form_id.um input[type=submit].um-button.um-alt { color: $secondary_btn_text; } "; - } - } + } + } - $profile_photocorner = get_post_meta( $form_id, '_um_profile_photocorner', true ); - if ( $profile_photocorner == 1 ) { - $css .= " + $profile_photocorner = get_post_meta( $form_id, '_um_profile_photocorner', true ); + if ( $profile_photocorner == 1 ) { + $css .= " .um-$form_id.um .um-profile-photo a.um-profile-photo-img, .um-$form_id.um .um-profile-photo img, .um-$form_id.um .um-profile-photo span.um-profile-photo-overlay -{ - -moz-border-radius: 999px !important; - -webkit-border-radius: 999px !important; - border-radius: 999px !important +{ + -moz-border-radius: 999px !important; + -webkit-border-radius: 999px !important; + border-radius: 999px !important } "; - } else if ( $profile_photocorner == 2 ) { - $css .= " + } else if ( $profile_photocorner == 2 ) { + $css .= " .um-$form_id.um .um-profile-photo a.um-profile-photo-img, .um-$form_id.um .um-profile-photo img, .um-$form_id.um .um-profile-photo span.um-profile-photo-overlay -{ - -moz-border-radius: 4px !important; - -webkit-border-radius: 4px !important; - border-radius: 4px !important +{ + -moz-border-radius: 4px !important; + -webkit-border-radius: 4px !important; + border-radius: 4px !important } "; - } else if ( $profile_photocorner == 3 ) { - $css .= " + } else if ( $profile_photocorner == 3 ) { + $css .= " .um-$form_id.um .um-profile-photo a.um-profile-photo-img, .um-$form_id.um .um-profile-photo img, .um-$form_id.um .um-profile-photo span.um-profile-photo-overlay -{ - -moz-border-radius: 0px !important; - -webkit-border-radius: 0px !important; - border-radius: 0px !important +{ + -moz-border-radius: 0px !important; + -webkit-border-radius: 0px !important; + border-radius: 0px !important } "; - } + } - $profile_main_bg = get_post_meta( $form_id, '_um_profile_main_bg', true ); - if ( $profile_main_bg ) { - $css .= " + $profile_main_bg = get_post_meta( $form_id, '_um_profile_main_bg', true ); + if ( $profile_main_bg ) { + $css .= " .um-$form_id.um-profile { background-color: $profile_main_bg; } "; - } + } - $main_text_color = get_post_meta( $form_id, '_um_profile_main_text_color', true ); - if ( $main_text_color ) { - $css .= " + $main_text_color = get_post_meta( $form_id, '_um_profile_main_text_color', true ); + if ( $main_text_color ) { + $css .= " .um-$form_id.um .um-profile-body.main *{ color: $main_text_color; } "; - } + } - $profile_header_bg = get_post_meta( $form_id, '_um_profile_header_bg', true ); - if ( $profile_header_bg ) { - $css .= " + $profile_header_bg = get_post_meta( $form_id, '_um_profile_header_bg', true ); + if ( $profile_header_bg ) { + $css .= " .um-$form_id.um .um-header { background-color: $profile_header_bg; } "; - } + } - $profile_header_text = get_post_meta( $form_id, '_um_profile_header_text', true ); - if ( $profile_header_text ) { - $css .= " + $profile_header_text = get_post_meta( $form_id, '_um_profile_header_text', true ); + if ( $profile_header_text ) { + $css .= " .um-$form_id.um .um-profile-meta { color: $profile_header_text; } "; - } + } - $profile_header_link_color = get_post_meta( $form_id, '_um_profile_header_link_color', true ); - if ( $profile_header_link_color ) { - $css .= " + $profile_header_link_color = get_post_meta( $form_id, '_um_profile_header_link_color', true ); + if ( $profile_header_link_color ) { + $css .= " .um-$form_id.um .um-name a { color: $profile_header_link_color; } "; - } + } - $profile_header_link_hcolor = get_post_meta( $form_id, '_um_profile_header_link_hcolor', true ); - if ( $profile_header_link_hcolor ) { - $css .= " + $profile_header_link_hcolor = get_post_meta( $form_id, '_um_profile_header_link_hcolor', true ); + if ( $profile_header_link_hcolor ) { + $css .= " .um-$form_id.um .um-name a:hover { color: $profile_header_link_hcolor; } "; - } + } - $profile_header_icon_color = get_post_meta( $form_id, '_um_profile_header_icon_color', true ); - if ( $profile_header_icon_color ) { - $css .= " + $profile_header_icon_color = get_post_meta( $form_id, '_um_profile_header_icon_color', true ); + if ( $profile_header_icon_color ) { + $css .= " .um-$form_id.um .um-profile-headericon a { color: $profile_header_icon_color; } "; - } + } - $profile_header_icon_hcolor = get_post_meta( $form_id, '_um_profile_header_icon_hcolor', true ); - if ( $profile_header_icon_hcolor ) { - $css .= " + $profile_header_icon_hcolor = get_post_meta( $form_id, '_um_profile_header_icon_hcolor', true ); + if ( $profile_header_icon_hcolor ) { + $css .= " .um-$form_id.um .um-profile-headericon a:hover, .um-$form_id.um .um-profile-edit-a.active { color: $profile_header_icon_hcolor; } "; - } + } } $uploads = wp_upload_dir(); @@ -917,101 +917,110 @@ global $wpdb; $role_keys = array(); register_post_type( 'um_role', array( - 'labels' => array( - 'name' => __( 'User Roles' ), - 'singular_name' => __( 'User Role' ), - 'add_new' => __( 'Add New' ), - 'add_new_item' => __('Add New User Role' ), - 'edit_item' => __('Edit User Role'), - 'not_found' => __('You did not create any user roles yet'), - 'not_found_in_trash' => __('Nothing found in Trash'), - 'search_items' => __('Search User Roles') - ), - 'show_ui' => true, - 'show_in_menu' => false, - 'public' => false, - 'supports' => array('title') + 'labels' => array( + 'name' => __( 'User Roles' ), + 'singular_name' => __( 'User Role' ), + 'add_new' => __( 'Add New' ), + 'add_new_item' => __('Add New User Role' ), + 'edit_item' => __('Edit User Role'), + 'not_found' => __('You did not create any user roles yet'), + 'not_found_in_trash' => __('Nothing found in Trash'), + 'search_items' => __('Search User Roles') + ), + 'show_ui' => true, + 'show_in_menu' => false, + 'public' => false, + 'supports' => array('title') ) ); $um_roles = get_posts( array( - 'post_type' => 'um_role', - 'posts_per_page' => -1, - 'post_status' => 'publish' + 'post_type' => 'um_role', + 'posts_per_page' => -1, + 'post_status' => 'publish' ) ); +$all_wp_roles = array_keys( get_editable_roles() ); if ( ! empty( $um_roles ) ) { - foreach ( $um_roles as $um_role ) { - $role_key = sanitize_title( $um_role->post_title ); + foreach ( $um_roles as $um_role ) { + $role_key = sanitize_title( $um_role->post_title ); - $role_keys[] = $role_key; + if ( ! in_array( $role_key, $all_wp_roles ) ) { + $role_keys[] = $role_key; + } - $all_role_metadata = $wpdb->get_results( $wpdb->prepare( - "SELECT pm.meta_key, + $all_role_metadata = $wpdb->get_results( $wpdb->prepare( + "SELECT pm.meta_key, pm.meta_value - FROM {$wpdb->postmeta} pm - WHERE pm.post_id = %d AND + FROM {$wpdb->postmeta} pm + WHERE pm.post_id = %d AND pm.meta_key LIKE %s", - $um_role->ID, - "_um_%" - ), ARRAY_A ); + $um_role->ID, + "_um_%" + ), ARRAY_A ); - $role_metadata = array(); - if ( ! empty( $all_role_metadata ) ) { - foreach( $all_role_metadata as $metadata ) { + $role_metadata = array(); + if ( ! empty( $all_role_metadata ) ) { + foreach( $all_role_metadata as $metadata ) { - if ( '_um_can_edit_roles' == $metadata['meta_key'] || '_um_can_delete_roles' == $metadata['meta_key'] - || '_um_can_view_roles' == $metadata['meta_key'] || '_um_can_follow_roles' == $metadata['meta_key'] - || '_um_can_friend_roles' == $metadata['meta_key'] || '_um_can_review_roles' == $metadata['meta_key'] ) { - $metadata['meta_value'] = maybe_unserialize( $metadata['meta_value'] ); + if ( '_um_can_edit_roles' == $metadata['meta_key'] || '_um_can_delete_roles' == $metadata['meta_key'] + || '_um_can_view_roles' == $metadata['meta_key'] || '_um_can_follow_roles' == $metadata['meta_key'] + || '_um_can_friend_roles' == $metadata['meta_key'] || '_um_can_review_roles' == $metadata['meta_key'] ) { + $metadata['meta_value'] = maybe_unserialize( $metadata['meta_value'] ); - $metadata['meta_value'] = array_map( function( $item ) { - return 'um_' . $item; - }, $metadata['meta_value'] ); - } elseif ( '_um_profilec_upgrade_role' == $metadata['meta_key'] ) { - $metadata['meta_value'] = 'um_' . $metadata['meta_value']; - } + $metadata['meta_value'] = array_map( function( $item ) { + return 'um_' . $item; + }, $metadata['meta_value'] ); + } elseif ( '_um_profilec_upgrade_role' == $metadata['meta_key'] ) { + $metadata['meta_value'] = 'um_' . $metadata['meta_value']; + } - $role_metadata[$metadata['meta_key']] = $metadata['meta_value']; - } - } + $role_metadata[$metadata['meta_key']] = $metadata['meta_value']; + } + } - $role_meta = array_merge( $role_metadata, array( - 'name' => $um_role->post_title, - '_um_is_custom' => true, - ) ); + if ( ! in_array( $role_key, $all_wp_roles ) ) { + $role_meta = array_merge( $role_metadata, array( + 'name' => $um_role->post_title, + '_um_is_custom' => true, + ) ); + } else { + $role_meta = $role_metadata; + } - if ( ! empty( $role_meta['_um_core'] ) ) - unset( $role_meta['_um_core'] ); + //get all users with UM role + $args = array( + 'meta_query' => array( + array( + 'key' => 'role', + 'value' => $role_meta['_um_core'] + ) + ), + 'number' => '', + 'count_total' => false, + ); + $all_users = get_users( $args ); - update_option( "um_role_{$role_key}_meta", $role_meta ); - } + //update roles for users + foreach ( $all_users as $k => $user ) { + $user_object = get_userdata( $user->ID ); + if ( ! in_array( $role_key, $all_wp_roles ) ) { + $user_object->add_role( 'um_' . $role_key ); + } else { + if ( ! in_array( $role_key, (array) $user_object->roles ) ) { + $user_object->add_role( $role_key ); + } + } + } - //get all users with UM role - $args = array( - 'meta_query' => array( - array( - 'key' => 'role', - 'compare' => 'EXISTS', - ) - ), - 'number' => '', - 'count_total' => false, - ); - $all_users = get_users( $args ); - //update roles for users - foreach ( $all_users as $k => $user ) { - $role_slug = get_user_meta( $user->ID, 'role', true ); + if ( ! empty( $role_meta['_um_core'] ) ) + unset( $role_meta['_um_core'] ); - if ( ! empty( $role_slug ) ) { - $user_object = get_userdata( $user->ID ); - $user_object->add_role( 'um_' . $role_slug ); - } - } + update_option( "um_role_{$role_key}_meta", $role_meta ); + } } - update_option( 'um_roles', $role_keys ); global $wp_roles, $wp_version; @@ -1057,39 +1066,39 @@ $posts = get_posts( array( ) ); if ( ! empty( $posts ) ) { - foreach ( $posts as $post_id ) { - $um_accessible = get_post_meta( $post_id, '_um_accessible', true ); - $um_access_roles = get_post_meta( $post_id, '_um_access_roles', true ); - $um_access_redirect = ( $um_accessible == '2' ) ? get_post_meta( $post_id, '_um_access_redirect', true ) : get_post_meta( $post_id, '_um_access_redirect2', true ); + foreach ( $posts as $post_id ) { + $um_accessible = get_post_meta( $post_id, '_um_accessible', true ); + $um_access_roles = get_post_meta( $post_id, '_um_access_roles', true ); + $um_access_redirect = ( $um_accessible == '2' ) ? get_post_meta( $post_id, '_um_access_redirect', true ) : get_post_meta( $post_id, '_um_access_redirect2', true ); - $access_roles = array(); - if ( ! empty( $um_access_roles ) ) { - foreach ( $roles_array as $role => $role_label ) { - if ( in_array( substr( $role, 3 ), $um_access_roles ) ) - $access_roles[ $role ] = '1'; - else - $access_roles[ $role ] = '0'; - } - } else { - foreach ( $roles_array as $role => $role_label ) { - $access_roles[ $role ] = '0'; - } - } + $access_roles = array(); + if ( ! empty( $um_access_roles ) ) { + foreach ( $roles_array as $role => $role_label ) { + if ( in_array( substr( $role, 3 ), $um_access_roles ) ) + $access_roles[ $role ] = '1'; + else + $access_roles[ $role ] = '0'; + } + } else { + foreach ( $roles_array as $role => $role_label ) { + $access_roles[ $role ] = '0'; + } + } - $restrict_options = array( - '_um_custom_access_settings' => '1', - '_um_accessible' => $um_accessible, - '_um_access_roles' => $access_roles, - '_um_noaccess_action' => '1', - '_um_restrict_by_custom_message' => '0', - '_um_restrict_custom_message' => '', - '_um_access_redirect' => '1', - '_um_access_redirect_url' => ! empty( $um_access_redirect ) ? $um_access_redirect : '', - '_um_access_hide_from_queries' => '0', - ); + $restrict_options = array( + '_um_custom_access_settings' => '1', + '_um_accessible' => $um_accessible, + '_um_access_roles' => $access_roles, + '_um_noaccess_action' => '1', + '_um_restrict_by_custom_message' => '0', + '_um_restrict_custom_message' => '', + '_um_access_redirect' => '1', + '_um_access_redirect_url' => ! empty( $um_access_redirect ) ? $um_access_redirect : '', + '_um_access_hide_from_queries' => '0', + ); - update_post_meta( $post_id, 'um_content_restriction', $restrict_options ); - } + update_post_meta( $post_id, 'um_content_restriction', $restrict_options ); + } } @@ -1097,58 +1106,58 @@ $all_taxonomies = get_taxonomies( array( 'public' => true ) ); $exclude_taxonomies = UM()->excluded_taxonomies(); foreach ( $all_taxonomies as $key => $taxonomy ) { - if ( in_array( $key , $exclude_taxonomies ) ) - continue; + if ( in_array( $key , $exclude_taxonomies ) ) + continue; - $terms = get_terms( array( - 'taxonomy' => $taxonomy, - 'hide_empty' => false, - 'fields' => 'ids' - ) ); + $terms = get_terms( array( + 'taxonomy' => $taxonomy, + 'hide_empty' => false, + 'fields' => 'ids' + ) ); if ( empty( $terms ) ) continue; - foreach ( $terms as $term_id ) { - $term_meta = get_option( "category_{$term_id}" ); + foreach ( $terms as $term_id ) { + $term_meta = get_option( "category_{$term_id}" ); - if ( empty( $term_meta ) ) - continue; + if ( empty( $term_meta ) ) + continue; - $um_accessible = ! empty( $term_meta['_um_accessible'] ) ? $term_meta['_um_accessible'] : false; - $um_access_roles = ! empty( $term_meta['_um_roles'] ) ? $term_meta['_um_roles'] : array(); - $redirect = ! empty( $term_meta['_um_redirect'] ) ? $term_meta['_um_redirect'] : ''; - $redirect2 = ! empty( $term_meta['_um_redirect2'] ) ? $term_meta['_um_redirect2'] : ''; - $um_access_redirect = ( $um_accessible == '2' ) ? $redirect : $redirect2; + $um_accessible = ! empty( $term_meta['_um_accessible'] ) ? $term_meta['_um_accessible'] : false; + $um_access_roles = ! empty( $term_meta['_um_roles'] ) ? $term_meta['_um_roles'] : array(); + $redirect = ! empty( $term_meta['_um_redirect'] ) ? $term_meta['_um_redirect'] : ''; + $redirect2 = ! empty( $term_meta['_um_redirect2'] ) ? $term_meta['_um_redirect2'] : ''; + $um_access_redirect = ( $um_accessible == '2' ) ? $redirect : $redirect2; - $access_roles = array(); - if ( ! empty( $um_access_roles ) ) { - foreach ( $roles_array as $role => $role_label ) { - if ( in_array( substr( $role, 3 ), $um_access_roles ) ) - $access_roles[ $role ] = '1'; - else - $access_roles[ $role ] = '0'; - } - } else { - foreach ( $roles_array as $role => $role_label ) { - $access_roles[ $role ] = '0'; - } - } + $access_roles = array(); + if ( ! empty( $um_access_roles ) ) { + foreach ( $roles_array as $role => $role_label ) { + if ( in_array( substr( $role, 3 ), $um_access_roles ) ) + $access_roles[ $role ] = '1'; + else + $access_roles[ $role ] = '0'; + } + } else { + foreach ( $roles_array as $role => $role_label ) { + $access_roles[ $role ] = '0'; + } + } - $restrict_options = array( - '_um_custom_access_settings' => '1', - '_um_accessible' => $um_accessible, - '_um_access_roles' => $access_roles, - '_um_noaccess_action' => '1', - '_um_restrict_by_custom_message' => '0', - '_um_restrict_custom_message' => '', - '_um_access_redirect' => '1', - '_um_access_redirect_url' => ! empty( $um_access_redirect ) ? $um_access_redirect : '', - '_um_access_hide_from_queries' => '0', - ); + $restrict_options = array( + '_um_custom_access_settings' => '1', + '_um_accessible' => $um_accessible, + '_um_access_roles' => $access_roles, + '_um_noaccess_action' => '1', + '_um_restrict_by_custom_message' => '0', + '_um_restrict_custom_message' => '', + '_um_access_redirect' => '1', + '_um_access_redirect_url' => ! empty( $um_access_redirect ) ? $um_access_redirect : '', + '_um_access_hide_from_queries' => '0', + ); - update_term_meta( $term_id, 'um_content_restriction', $restrict_options ); - } + update_term_meta( $term_id, 'um_content_restriction', $restrict_options ); + } } @@ -1158,56 +1167,56 @@ foreach ( $all_taxonomies as $key => $taxonomy ) { //also update for forms metadata where "member" or "admin" $forms = get_posts( array( - 'post_type' => 'um_form', - 'numberposts' => -1, - 'fields' => 'ids' + 'post_type' => 'um_form', + 'numberposts' => -1, + 'fields' => 'ids' ) ); foreach ( $forms as $form_id ) { - $form_type = get_post_meta( $form_id, '_um_mode', true ); + $form_type = get_post_meta( $form_id, '_um_mode', true ); - if ( ! empty( $form_type ) ) { - $use_globals = get_post_meta( $form_id, "_um_{$form_type}_use_globals", true ); - $use_custom_settings = empty( $use_globals ) ? true : false; + if ( ! empty( $form_type ) ) { + $use_globals = get_post_meta( $form_id, "_um_{$form_type}_use_globals", true ); + $use_custom_settings = empty( $use_globals ) ? true : false; - update_post_meta( $form_id, "_um_{$form_type}_use_custom_settings", $use_custom_settings ); - delete_post_meta( $form_id, "_um_{$form_type}_use_globals" ); + update_post_meta( $form_id, "_um_{$form_type}_use_custom_settings", $use_custom_settings ); + delete_post_meta( $form_id, "_um_{$form_type}_use_globals" ); - $role = get_post_meta( $form_id, "_um_{$form_type}_role", true ); - if ( $role ) { - update_post_meta( $form_id, "_um_{$form_type}_role", 'um_' . $role ); - } - } + $role = get_post_meta( $form_id, "_um_{$form_type}_role", true ); + if ( $role ) { + update_post_meta( $form_id, "_um_{$form_type}_role", 'um_' . $role ); + } + } } //for metadata for all UM Member Directories //also update for forms metadata where "member" or "admin" $member_directories = get_posts( array( - 'post_type' => 'um_directory', - 'numberposts' => -1, - 'fields' => 'ids' + 'post_type' => 'um_directory', + 'numberposts' => -1, + 'fields' => 'ids' ) ); foreach ( $member_directories as $directory_id ) { - $directory_roles = get_post_meta( $directory_id, '_um_roles', true ); + $directory_roles = get_post_meta( $directory_id, '_um_roles', true ); - if ( ! empty( $directory_roles ) ) { - $directory_roles = array_map( function( $item ) { - return 'um_' . $item; - }, $directory_roles ); + if ( ! empty( $directory_roles ) ) { + $directory_roles = array_map( function( $item ) { + return 'um_' . $item; + }, $directory_roles ); - update_post_meta( $directory_id, '_um_roles', $directory_roles ); - } + update_post_meta( $directory_id, '_um_roles', $directory_roles ); + } - $um_roles_can_search = get_post_meta( $directory_id, '_um_roles_can_search', true ); + $um_roles_can_search = get_post_meta( $directory_id, '_um_roles_can_search', true ); - if ( ! empty( $um_roles_can_search ) ) { - $um_roles_can_search = array_map( function( $item ) { - return 'um_' . $item; - }, $um_roles_can_search ); + if ( ! empty( $um_roles_can_search ) ) { + $um_roles_can_search = array_map( function( $item ) { + return 'um_' . $item; + }, $um_roles_can_search ); - update_post_meta( $directory_id, '_um_roles_can_search', $um_roles_can_search ); - } + update_post_meta( $directory_id, '_um_roles_can_search', $um_roles_can_search ); + } } @@ -1217,30 +1226,30 @@ foreach ( $member_directories as $directory_id ) { $emails = UM()->config()->email_notifications; foreach ( $emails as $email_key => $value ) { - $in_theme = UM()->mail()->template_in_theme( $email_key, true ); - $theme_template_path = UM()->mail()->get_template_file( 'theme', $email_key ); + $in_theme = UM()->mail()->template_in_theme( $email_key, true ); + $theme_template_path = UM()->mail()->get_template_file( 'theme', $email_key ); - if ( ! $in_theme ) { - $setting_value = UM()->options()->get( $email_key ); + if ( ! $in_theme ) { + $setting_value = UM()->options()->get( $email_key ); - UM()->mail()->copy_email_template( $email_key ); + UM()->mail()->copy_email_template( $email_key ); - $fp = fopen( $theme_template_path, "w" ); - $result = fputs( $fp, $setting_value ); - fclose( $fp ); - } else { - $theme_template_path_html = UM()->mail()->get_template_file( 'theme', $email_key, true ); + $fp = fopen( $theme_template_path, "w" ); + $result = fputs( $fp, $setting_value ); + fclose( $fp ); + } else { + $theme_template_path_html = UM()->mail()->get_template_file( 'theme', $email_key, true ); - $setting_value = preg_replace( '/<\/body>|<\/head>||<\/html>||/' , '', file_get_contents( $theme_template_path_html ) ); + $setting_value = preg_replace( '/<\/body>|<\/head>||<\/html>||/' , '', file_get_contents( $theme_template_path_html ) ); - if ( file_exists( $theme_template_path_html ) ) { - if ( copy( $theme_template_path_html, $theme_template_path ) ) { - $fp = fopen( $theme_template_path, "w" ); - $result = fputs( $fp, $setting_value ); - fclose( $fp ); - } - } - } + if ( file_exists( $theme_template_path_html ) ) { + if ( copy( $theme_template_path_html, $theme_template_path ) ) { + $fp = fopen( $theme_template_path, "w" ); + $result = fputs( $fp, $setting_value ); + fclose( $fp ); + } + } + } } @@ -1248,36 +1257,36 @@ foreach ( $emails as $email_key => $value ) { * Transferring menu restriction data */ $menus = get_posts( array( - 'post_type' => 'nav_menu_item', - 'meta_query' => array( - array( - 'key' => 'menu-item-um_nav_roles', - 'compare' => 'EXISTS', - ) - ), + 'post_type' => 'nav_menu_item', + 'meta_query' => array( + array( + 'key' => 'menu-item-um_nav_roles', + 'compare' => 'EXISTS', + ) + ), 'numberposts' => -1, ) ); foreach ( $menus as $menu ) { - $menu_roles = get_post_meta( $menu->ID, 'menu-item-um_nav_roles', true ); + $menu_roles = get_post_meta( $menu->ID, 'menu-item-um_nav_roles', true ); - $menu_roles = array_map( function( $item ) { - if ( strpos( $item, 'um_' ) === 0 ) - return $item; + $menu_roles = array_map( function( $item ) { + if ( strpos( $item, 'um_' ) === 0 ) + return $item; - return 'um_' . $item; - }, $menu_roles ); + return 'um_' . $item; + }, $menu_roles ); - update_post_meta( $menu->ID, 'menu-item-um_nav_roles', $menu_roles ); + update_post_meta( $menu->ID, 'menu-item-um_nav_roles', $menu_roles ); } $profile_tab_main_roles = UM()->options()->get( 'profile_tab_main_roles' ); $profile_tab_main_roles = ! $profile_tab_main_roles ? array() : $profile_tab_main_roles; if ( ! empty( $profile_tab_main_roles ) ) { - $profile_tab_main_roles = array_map( function( $item ) { - return 'um_' . $item; - }, $profile_tab_main_roles ); + $profile_tab_main_roles = array_map( function( $item ) { + return 'um_' . $item; + }, $profile_tab_main_roles ); UM()->options()->update( 'profile_tab_main_roles', $profile_tab_main_roles ); } @@ -1285,9 +1294,9 @@ if ( ! empty( $profile_tab_main_roles ) ) { $profile_tab_posts_roles = UM()->options()->get( 'profile_tab_posts_roles' ); $profile_tab_posts_roles = ! $profile_tab_posts_roles ? array() : $profile_tab_posts_roles; if ( ! empty( $profile_tab_posts_roles ) ) { - $profile_tab_posts_roles = array_map( function( $item ) { - return 'um_' . $item; - }, $profile_tab_posts_roles ); + $profile_tab_posts_roles = array_map( function( $item ) { + return 'um_' . $item; + }, $profile_tab_posts_roles ); UM()->options()->update( 'profile_tab_posts_roles', $profile_tab_posts_roles ); } @@ -1295,9 +1304,9 @@ if ( ! empty( $profile_tab_posts_roles ) ) { $profile_tab_comments_roles = UM()->options()->get( 'profile_tab_comments_roles' ); $profile_tab_comments_roles = ! $profile_tab_comments_roles ? array() : $profile_tab_comments_roles; if ( ! empty( $profile_tab_comments_roles ) ) { - $profile_tab_comments_roles = array_map( function( $item ) { - return 'um_' . $item; - }, $profile_tab_comments_roles ); + $profile_tab_comments_roles = array_map( function( $item ) { + return 'um_' . $item; + }, $profile_tab_comments_roles ); UM()->options()->update( 'profile_tab_comments_roles', $profile_tab_comments_roles ); } @@ -1305,9 +1314,9 @@ if ( ! empty( $profile_tab_comments_roles ) ) { $profile_tab_activity_roles = UM()->options()->get( 'profile_tab_activity_roles' ); $profile_tab_activity_roles = ! $profile_tab_activity_roles ? array() : $profile_tab_activity_roles; if ( ! empty( $profile_tab_activity_roles ) ) { - $profile_tab_activity_roles = array_map( function( $item ) { - return 'um_' . $item; - }, $profile_tab_activity_roles ); + $profile_tab_activity_roles = array_map( function( $item ) { + return 'um_' . $item; + }, $profile_tab_activity_roles ); UM()->options()->update( 'profile_tab_activity_roles', $profile_tab_activity_roles ); } @@ -1315,9 +1324,9 @@ if ( ! empty( $profile_tab_activity_roles ) ) { $profile_tab_messages_roles = UM()->options()->get( 'profile_tab_messages_roles' ); $profile_tab_messages_roles = ! $profile_tab_messages_roles ? array() : $profile_tab_messages_roles; if ( ! empty( $profile_tab_messages_roles ) ) { - $profile_tab_messages_roles = array_map( function( $item ) { - return 'um_' . $item; - }, $profile_tab_messages_roles ); + $profile_tab_messages_roles = array_map( function( $item ) { + return 'um_' . $item; + }, $profile_tab_messages_roles ); UM()->options()->update( 'profile_tab_messages_roles', $profile_tab_messages_roles ); } @@ -1325,9 +1334,9 @@ if ( ! empty( $profile_tab_messages_roles ) ) { $profile_tab_reviews_roles = UM()->options()->get( 'profile_tab_reviews_roles' ); $profile_tab_reviews_roles = ! $profile_tab_reviews_roles ? array() : $profile_tab_reviews_roles; if ( ! empty( $profile_tab_reviews_roles ) ) { - $profile_tab_reviews_roles = array_map( function( $item ) { - return 'um_' . $item; - }, $profile_tab_reviews_roles ); + $profile_tab_reviews_roles = array_map( function( $item ) { + return 'um_' . $item; + }, $profile_tab_reviews_roles ); UM()->options()->update( 'profile_tab_reviews_roles', $profile_tab_reviews_roles ); } @@ -1335,9 +1344,9 @@ if ( ! empty( $profile_tab_reviews_roles ) ) { $profile_tab_purchases_roles = UM()->options()->get( 'profile_tab_purchases_roles' ); $profile_tab_purchases_roles = ! $profile_tab_purchases_roles ? array() : $profile_tab_purchases_roles; if ( ! empty( $profile_tab_purchases_roles ) ) { - $profile_tab_purchases_roles = array_map( function( $item ) { - return 'um_' . $item; - }, $profile_tab_purchases_roles ); + $profile_tab_purchases_roles = array_map( function( $item ) { + return 'um_' . $item; + }, $profile_tab_purchases_roles ); UM()->options()->update( 'profile_tab_purchases_roles', $profile_tab_purchases_roles ); } @@ -1345,9 +1354,9 @@ if ( ! empty( $profile_tab_purchases_roles ) ) { $profile_tab_product_reviews = UM()->options()->get( 'profile_tab_product-reviews_roles' ); $profile_tab_product_reviews = ! $profile_tab_product_reviews ? array() : $profile_tab_product_reviews; if ( ! empty( $profile_tab_product_reviews ) ) { - $profile_tab_product_reviews = array_map( function( $item ) { - return 'um_' . $item; - }, $profile_tab_product_reviews ); + $profile_tab_product_reviews = array_map( function( $item ) { + return 'um_' . $item; + }, $profile_tab_product_reviews ); UM()->options()->update( 'profile_tab_product-reviews_roles', $profile_tab_product_reviews ); } @@ -1356,9 +1365,9 @@ if ( ! empty( $profile_tab_product_reviews ) ) { $profile_tab_forums_roles = UM()->options()->get( 'profile_tab_forums_roles' ); $profile_tab_forums_roles = ! $profile_tab_forums_roles ? array() : $profile_tab_forums_roles; if ( ! empty( $profile_tab_forums_roles ) ) { - $profile_tab_forums_roles = array_map( function( $item ) { - return 'um_' . $item; - }, $profile_tab_forums_roles ); + $profile_tab_forums_roles = array_map( function( $item ) { + return 'um_' . $item; + }, $profile_tab_forums_roles ); UM()->options()->update( 'profile_tab_forums_roles', $profile_tab_forums_roles ); } @@ -1366,9 +1375,9 @@ if ( ! empty( $profile_tab_forums_roles ) ) { $profile_tab_friends_roles = UM()->options()->get( 'profile_tab_friends_roles' ); $profile_tab_friends_roles = ! $profile_tab_friends_roles ? array() : $profile_tab_friends_roles; if ( ! empty( $profile_tab_friends_roles ) ) { - $profile_tab_friends_roles = array_map( function( $item ) { - return 'um_' . $item; - }, $profile_tab_friends_roles ); + $profile_tab_friends_roles = array_map( function( $item ) { + return 'um_' . $item; + }, $profile_tab_friends_roles ); UM()->options()->update( 'profile_tab_friends_roles', $profile_tab_friends_roles ); } @@ -1376,22 +1385,22 @@ if ( ! empty( $profile_tab_friends_roles ) ) { $register_role = UM()->options()->get( 'register_role' ); if ( ! empty( $register_role ) ) { - $register_role = 'um_' . $register_role; + $register_role = 'um_' . $register_role; UM()->options()->update( 'register_role', $register_role ); } $woo_oncomplete_role = UM()->options()->get( 'woo_oncomplete_role' ); if ( ! empty( $woo_oncomplete_role ) ) { - $woo_oncomplete_role = 'um_' . $woo_oncomplete_role; + $woo_oncomplete_role = 'um_' . $woo_oncomplete_role; UM()->options()->update( 'woo_oncomplete_role', $woo_oncomplete_role ); } $woo_oncomplete_except_roles = UM()->options()->get( 'woo_oncomplete_except_roles' ); $woo_oncomplete_except_roles = ! $woo_oncomplete_except_roles ? array() : $woo_oncomplete_except_roles; if ( ! empty( $woo_oncomplete_except_roles ) ) { - $woo_oncomplete_except_roles = array_map( function( $item ) { - return 'um_' . $item; - }, $woo_oncomplete_except_roles ); + $woo_oncomplete_except_roles = array_map( function( $item ) { + return 'um_' . $item; + }, $woo_oncomplete_except_roles ); UM()->options()->update( 'woo_oncomplete_except_roles', $woo_oncomplete_except_roles ); } @@ -1399,117 +1408,117 @@ if ( ! empty( $woo_oncomplete_except_roles ) ) { //for metadata for all bbPress forums //also update for forms metadata where "member" or "admin" $wc_products = get_posts( array( - 'post_type' => 'product', - 'numberposts' => -1, - 'fields' => 'ids' + 'post_type' => 'product', + 'numberposts' => -1, + 'fields' => 'ids' ) ); foreach ( $wc_products as $product_id ) { - $woo_product_role = get_post_meta( $product_id, '_um_woo_product_role', true ); + $woo_product_role = get_post_meta( $product_id, '_um_woo_product_role', true ); - if ( ! empty( $woo_product_role ) ) { - $woo_product_role = 'um_' . $woo_product_role; - update_post_meta( $product_id, '_um_woo_product_role', $woo_product_role ); - } + if ( ! empty( $woo_product_role ) ) { + $woo_product_role = 'um_' . $woo_product_role; + update_post_meta( $product_id, '_um_woo_product_role', $woo_product_role ); + } - $woo_product_activated_role = get_post_meta( $product_id, '_um_woo_product_activated_role', true ); + $woo_product_activated_role = get_post_meta( $product_id, '_um_woo_product_activated_role', true ); - if ( ! empty( $woo_product_activated_role ) ) { - $woo_product_activated_role = 'um_' . $woo_product_activated_role; - update_post_meta( $product_id, '_um_woo_product_activated_role', $woo_product_activated_role ); - } + if ( ! empty( $woo_product_activated_role ) ) { + $woo_product_activated_role = 'um_' . $woo_product_activated_role; + update_post_meta( $product_id, '_um_woo_product_activated_role', $woo_product_activated_role ); + } - $woo_product_downgrade_pending_role = get_post_meta( $product_id, '_um_woo_product_downgrade_pending_role', true ); + $woo_product_downgrade_pending_role = get_post_meta( $product_id, '_um_woo_product_downgrade_pending_role', true ); - if ( ! empty( $woo_product_downgrade_pending_role ) ) { - $woo_product_downgrade_pending_role = 'um_' . $woo_product_downgrade_pending_role; - update_post_meta( $product_id, '_um_woo_product_downgrade_pending_role', $woo_product_downgrade_pending_role ); - } + if ( ! empty( $woo_product_downgrade_pending_role ) ) { + $woo_product_downgrade_pending_role = 'um_' . $woo_product_downgrade_pending_role; + update_post_meta( $product_id, '_um_woo_product_downgrade_pending_role', $woo_product_downgrade_pending_role ); + } - $woo_product_downgrade_onhold_role = get_post_meta( $product_id, '_um_woo_product_downgrade_onhold_role', true ); + $woo_product_downgrade_onhold_role = get_post_meta( $product_id, '_um_woo_product_downgrade_onhold_role', true ); - if ( ! empty( $woo_product_downgrade_onhold_role ) ) { - $woo_product_downgrade_onhold_role = 'um_' . $woo_product_downgrade_onhold_role; - update_post_meta( $product_id, '_um_woo_product_downgrade_onhold_role', $woo_product_downgrade_onhold_role ); - } + if ( ! empty( $woo_product_downgrade_onhold_role ) ) { + $woo_product_downgrade_onhold_role = 'um_' . $woo_product_downgrade_onhold_role; + update_post_meta( $product_id, '_um_woo_product_downgrade_onhold_role', $woo_product_downgrade_onhold_role ); + } - $woo_product_downgrade_expired_role = get_post_meta( $product_id, '_um_woo_product_downgrade_expired_role', true ); + $woo_product_downgrade_expired_role = get_post_meta( $product_id, '_um_woo_product_downgrade_expired_role', true ); - if ( ! empty( $woo_product_downgrade_expired_role ) ) { - $woo_product_downgrade_expired_role = 'um_' . $woo_product_downgrade_expired_role; - update_post_meta( $product_id, '_um_woo_product_downgrade_expired_role', $woo_product_downgrade_expired_role ); - } + if ( ! empty( $woo_product_downgrade_expired_role ) ) { + $woo_product_downgrade_expired_role = 'um_' . $woo_product_downgrade_expired_role; + update_post_meta( $product_id, '_um_woo_product_downgrade_expired_role', $woo_product_downgrade_expired_role ); + } - $woo_product_downgrade_cancelled_role = get_post_meta( $product_id, '_um_woo_product_downgrade_cancelled_role', true ); + $woo_product_downgrade_cancelled_role = get_post_meta( $product_id, '_um_woo_product_downgrade_cancelled_role', true ); - if ( ! empty( $woo_product_downgrade_cancelled_role ) ) { - $woo_product_downgrade_cancelled_role = 'um_' . $woo_product_downgrade_cancelled_role; - update_post_meta( $product_id, '_um_woo_product_downgrade_cancelled_role', $woo_product_downgrade_cancelled_role ); - } + if ( ! empty( $woo_product_downgrade_cancelled_role ) ) { + $woo_product_downgrade_cancelled_role = 'um_' . $woo_product_downgrade_cancelled_role; + update_post_meta( $product_id, '_um_woo_product_downgrade_cancelled_role', $woo_product_downgrade_cancelled_role ); + } } $bb_forums = get_posts( array( - 'post_type' => 'forum', - 'numberposts' => -1, - 'fields' => 'ids' + 'post_type' => 'forum', + 'numberposts' => -1, + 'fields' => 'ids' ) ); foreach ( $bb_forums as $forum_id ) { - $bbpress_can_topic = get_post_meta( $forum_id, '_um_bbpress_can_topic', true ); - $bbpress_can_topic = ! $bbpress_can_topic ? array() : $bbpress_can_topic; - if ( ! empty( $bbpress_can_topic ) ) { - $bbpress_can_topic = array_map( function( $item ) { - return 'um_' . $item; - }, $bbpress_can_topic ); + $bbpress_can_topic = get_post_meta( $forum_id, '_um_bbpress_can_topic', true ); + $bbpress_can_topic = ! $bbpress_can_topic ? array() : $bbpress_can_topic; + if ( ! empty( $bbpress_can_topic ) ) { + $bbpress_can_topic = array_map( function( $item ) { + return 'um_' . $item; + }, $bbpress_can_topic ); - update_post_meta( $forum_id, '_um_bbpress_can_topic', $bbpress_can_topic ); - } + update_post_meta( $forum_id, '_um_bbpress_can_topic', $bbpress_can_topic ); + } - $bbpress_can_reply = get_post_meta( $forum_id, '_um_bbpress_can_reply', true ); - $bbpress_can_reply = ! $bbpress_can_reply ? array() : $bbpress_can_reply; - if ( ! empty( $bbpress_can_reply ) ) { - $bbpress_can_reply = array_map( function( $item ) { - return 'um_' . $item; - }, $bbpress_can_reply ); + $bbpress_can_reply = get_post_meta( $forum_id, '_um_bbpress_can_reply', true ); + $bbpress_can_reply = ! $bbpress_can_reply ? array() : $bbpress_can_reply; + if ( ! empty( $bbpress_can_reply ) ) { + $bbpress_can_reply = array_map( function( $item ) { + return 'um_' . $item; + }, $bbpress_can_reply ); - update_post_meta( $forum_id, '_um_bbpress_can_reply', $bbpress_can_reply ); - } + update_post_meta( $forum_id, '_um_bbpress_can_reply', $bbpress_can_reply ); + } } $mc_lists = get_posts( array( - 'post_type' => 'um_mailchimp', - 'numberposts' => -1, - 'fields' => 'ids' + 'post_type' => 'um_mailchimp', + 'numberposts' => -1, + 'fields' => 'ids' ) ); foreach ( $mc_lists as $list_id ) { - $um_roles = get_post_meta( $list_id, '_um_roles', true ); - $um_roles = ! $um_roles ? array() : $um_roles; - if ( ! empty( $um_roles ) ) { - $um_roles = array_map( function( $item ) { - return 'um_' . $item; - }, $um_roles ); + $um_roles = get_post_meta( $list_id, '_um_roles', true ); + $um_roles = ! $um_roles ? array() : $um_roles; + if ( ! empty( $um_roles ) ) { + $um_roles = array_map( function( $item ) { + return 'um_' . $item; + }, $um_roles ); - update_post_meta( $list_id, '_um_roles', $um_roles ); - } + update_post_meta( $list_id, '_um_roles', $um_roles ); + } } $um_social_login = get_posts( array( - 'post_type' => 'um_social_login', - 'numberposts' => -1, - 'fields' => 'ids' + 'post_type' => 'um_social_login', + 'numberposts' => -1, + 'fields' => 'ids' ) ); foreach ( $um_social_login as $social_login_id ) { - $assigned_role = get_post_meta( $social_login_id, '_um_assigned_role', true ); + $assigned_role = get_post_meta( $social_login_id, '_um_assigned_role', true ); - if ( ! empty( $assigned_role ) ) { - $assigned_role = 'um_' . $assigned_role; - update_post_meta( $social_login_id, '_um_assigned_role', $assigned_role ); - } + if ( ! empty( $assigned_role ) ) { + $assigned_role = 'um_' . $assigned_role; + update_post_meta( $social_login_id, '_um_assigned_role', $assigned_role ); + } } \ No newline at end of file