| @@ -37,8 +37,10 @@ | ||
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | $input_value = isset( $request_data['custom_field_user_role'] ) ? $request_data['custom_field_user_role'] : $user_role; |
| 40 | 40 | $input_value_multiple = isset( $request_data['custom_field_user_role'] ) ? $request_data['custom_field_user_role'] : $user_roles; |
| 41 | + $input_value = apply_filters( 'wppb_form_user_role_field_value', $input_value, $field, $form_location ); | |
| 42 | + $input_value_multiple = apply_filters( 'wppb_form_user_role_multiple_field_value', $input_value_multiple, $field, $form_location ); | |
| 41 | 43 | |
| 42 | 44 | $item_title = apply_filters( 'wppb_'.$form_location.'_user_role_custom_field_'.$field['id'].'_item_title', wppb_icl_t( 'plugin profile-builder-pro', 'custom_field_'.$field['id'].'_title_translation', $field['field-title'], true ) ); |
| 43 | 45 | $item_description = wppb_icl_t( 'plugin profile-builder-pro', 'custom_field_'.$field['id'].'_description_translation', $field['description'], true ); |
| 44 | 46 | |
| @@ -118,13 +120,13 @@ | ||
| 118 | 120 | } |
| 119 | 121 | else{ |
| 120 | 122 | if( !empty( $input_value_multiple ) ){ |
| 121 | 123 | foreach( $input_value_multiple as $input_value_multi ){ |
| 122 | - $output .= '<input type="hidden" disabled="disabled" readonly="readonly" value="'.$input_value_multi.'">'; | |
| 124 | + $output .= '<input type="hidden" disabled="disabled" readonly="readonly" value="' . esc_attr( $input_value_multi ) . '">'; | |
| 123 | 125 | } |
| 124 | 126 | } |
| 125 | 127 | else { |
| 126 | - $output .= '<input type="hidden" disabled="disabled" readonly="readonly" value="' . $input_value . '">'; | |
| 128 | + $output .= '<input type="hidden" disabled="disabled" readonly="readonly" value="' . esc_attr( $input_value ) . '">'; | |
| 127 | 129 | } |
| 128 | 130 | } |
| 129 | 131 | |
| 130 | 132 | return apply_filters( 'wppb_'.$form_location.'_user_role_custom_field_'.$field['id'], $output, $form_location, $field, $user_id, $field_check_errors, $request_data, $input_value, $input_value_multiple ); |
| @@ -223,4 +225,23 @@ | ||
| 223 | 225 | |
| 224 | 226 | return $userdata; |
| 225 | 227 | } |
| 226 | 228 | add_filter( 'wppb_build_userdata', 'wppb_userdata_add_user_role', 10, 3 ); |
| 229 | + | |
| 230 | +//Activating Roles Editor from setup wizard | |
| 231 | +function wppb_handle_enable_roles_editor(){ | |
| 232 | + | |
| 233 | + if ( !isset( $_GET['wppb_nonce'] ) || !wp_verify_nonce( sanitize_text_field( $_GET['wppb_nonce'] ), 'wppb_enable_roles_editor_nonce' ) || !current_user_can( 'manage_options' ) ) | |
| 234 | + return; | |
| 235 | + | |
| 236 | + $wppb_generalSettings = get_option( 'wppb_general_settings', 'not_found' ); | |
| 237 | + | |
| 238 | + if ( $wppb_generalSettings !== 'not_found' && is_array( $wppb_generalSettings ) ) { | |
| 239 | + $wppb_generalSettings['rolesEditor'] = 'yes'; | |
| 240 | + update_option( 'wppb_general_settings', $wppb_generalSettings ); | |
| 241 | + } | |
| 242 | + | |
| 243 | + // Redirect to Roles Editor page | |
| 244 | + wp_safe_redirect( admin_url( 'edit.php?post_type=wppb-roles-editor' ) ); | |
| 245 | + exit; | |
| 246 | +} | |
| 247 | +add_action( 'admin_init', 'wppb_handle_enable_roles_editor', 9 ); | |