diff --git a/core/um-fields.php b/core/um-fields.php
index 2fbad26a..a02a97cf 100644
--- a/core/um-fields.php
+++ b/core/um-fields.php
@@ -69,6 +69,10 @@ class UM_Fields {
echo '';
}
+ function disabled_hidden_field( $key, $value ){
+ return '';
+ }
+
/***
*** @update a field globally
***/
@@ -909,12 +913,17 @@ class UM_Fields {
if ( !isset( $data['type'] ) ) return;
if ( isset( $data['in_group'] ) && $data['in_group'] != '' && $rule != 'group' ) return;
+
+ if ( $visibility == 'view' && $this->set_mode != 'register' ) return;
- if ( $visibility == 'view' ) return;
+ if ( $visibility == 'view' && $this->set_mode == 'register' ){
+ $disabled = ' disabled="disabled" ';
+ }
if ( !um_can_view_field( $data ) ) return;
if ( !um_can_edit_field( $data ) ) return;
+
// fields that need to be disabled in edit mode (profile)
$arr_restricted_fields = array('user_email','username','user_login','user_password');
@@ -982,9 +991,16 @@ class UM_Fields {
}
- $output .= '
+ $field_name = $key.$ultimatemember->form->form_suffix;
+ $field_value = htmlspecialchars( $this->field_value( $key, $default, $data ) );
+
+ $output .= '
';
+
+ if( ! empty( $disabled ) ){
+ $output .= $this->disabled_hidden_field( $field_name, $field_value );
+ }
if ( $this->is_error($key) ) {
$output .= $this->field_error( $this->show_error($key) );
@@ -1010,9 +1026,16 @@ class UM_Fields {
}
- $output .= '
+ $field_name = $key.$ultimatemember->form->form_suffix;
+ $field_value = htmlspecialchars( $this->field_value( $key, $default, $data ) );
+
+ $output .= '
';
+
+ if( ! empty( $disabled ) ){
+ $output .= $this->disabled_hidden_field( $field_name, $field_value );
+ }
if ( $this->is_error($key) ) {
$output .= $this->field_error( $this->show_error($key) );
@@ -1195,7 +1218,7 @@ class UM_Fields {
}
- $output .= '
+ $output .= '
';
@@ -1223,7 +1246,7 @@ class UM_Fields {
}
- $output .= '
+ $output .= '
';
@@ -1251,7 +1274,7 @@ class UM_Fields {
}
- $output .= '
+ $output .= '
';
@@ -1276,6 +1299,8 @@ class UM_Fields {
}
$output .= '
';
+ $field_name = $key;
+ $field_value = $this->field_value( $key, $default, $data );
if ( isset( $data['html'] ) && $data['html'] != 0 && $key != "description" ) {
@@ -1287,27 +1312,35 @@ class UM_Fields {
'editor_height' => $height,
'tinymce'=> array(
'toolbar1' => 'formatselect,bullist,numlist,bold,italic,underline,forecolor,blockquote,hr,removeformat,link,unlink,undo,redo',
- 'toolbar2' => ''
+ 'toolbar2' => '',
)
);
+ if( ! empty( $disabled ) ){
+ $textarea_settings['tinymce']['readonly'] = true;
+ }
+
$textarea_settings = apply_filters('um_form_fields_textarea_settings', $textarea_settings );
// turn on the output buffer
ob_start();
// echo the editor to the buffer
- wp_editor( $this->field_value( $key, $default, $data ) , $key, $textarea_settings );
+ wp_editor( $field_value , $key, $textarea_settings );
// add the contents of the buffer to the output variable
$output .= ob_get_clean();
}
- else $output .= '';
+ else $output .= '';
$output .= '
';
+ if( ! empty( $disabled ) ){
+ $output .= $this->disabled_hidden_field( $field_name, $field_value );
+ }
+
if ( $this->is_error($key) ) {
$output .= $this->field_error( $this->show_error($key) );
}
@@ -1544,7 +1577,7 @@ class UM_Fields {
$output .= '';
- $output .= '
';
+
if ( $this->is_error($form_key) ) {
$output .= $this->field_error( $this->show_error($form_key) );
}
@@ -1645,7 +1689,7 @@ class UM_Fields {
$output .= '';
- $output .= '';
+ $output .= '';
if ( isset($options) && $options == 'builtin'){
@@ -1665,7 +1709,7 @@ class UM_Fields {
// add an empty option!
$output .= '';
-
+ $arr_selected = array();
// add options
foreach( $options as $k => $v ) {
@@ -1684,16 +1728,28 @@ class UM_Fields {
$output .= '';
+ $output .= '>'.__( $um_field_checkbox_item_title ,UM_TEXTDOMAIN).'';
+
+
+
}
$output .= '';
+ if( ! empty( $disabled ) && ! empty( $arr_selected ) ){
+ foreach( $arr_selected as $item ){
+ $output .= $this->disabled_hidden_field( $key.'[]', $item );
+ }
+ }
+
$output .= '
';
+
if ( $this->is_error($key) ) {
$output .= $this->field_error( $this->show_error( $key ) );
}
@@ -1737,6 +1793,7 @@ class UM_Fields {
// add options
$i = 0;
+ $field_value = array();
foreach($options as $k => $v) {
@@ -1769,13 +1826,15 @@ class UM_Fields {
$option_value = apply_filters('um_field_non_utf8_value',$option_value );
- $output .= 'is_radio_checked($key, $option_value, $data) ) {
$output.= 'checked';
+ $field_value[ $key ] = $option_value;
}
$output .= ' />';
+
$output .= '';
$output .= ''.__( $um_field_checkbox_item_title,UM_TEXTDOMAIN).'';
$output .= '';
@@ -1786,6 +1845,12 @@ class UM_Fields {
}
+ if( ! empty( $disabled ) ){
+ foreach( $field_value as $item ){
+ $output .= $this->disabled_hidden_field( $form_key , $item );
+ }
+ }
+
$output .= '';
$output .= '';
@@ -1841,7 +1906,7 @@ class UM_Fields {
$v = apply_filters('um_field_non_utf8_value', $v );
- $output .= 'is_selected($key, $v, $data) ) {
$output.= 'checked';
@@ -1849,6 +1914,11 @@ class UM_Fields {
$output .= ' />';
+ if( ! empty( $disabled ) && $this->is_selected($key, $v, $data) ){
+ $output .= $this->disabled_hidden_field( $key.'[]', strip_tags( $v ) );
+ }
+
+
$output .= '';
$um_field_checkbox_item_title = apply_filters("um_field_checkbox_item_title", $um_field_checkbox_item_title , $key, $v, $data );
$output .= ''. __( $um_field_checkbox_item_title ,UM_TEXTDOMAIN) .'';
@@ -1864,6 +1934,7 @@ class UM_Fields {
$output .= '';
+
if ( $this->is_error($key) ) {
$output .= $this->field_error( $this->show_error($key) );
}