Skip Navigation

[Resolved] A previous fix seems to have caused another problem

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 4 replies, has 2 voices.

Last updated by nickH-5 1 year, 3 months ago.

Assisted by: Minesh.

Author
Posts
#2496735

I'm sorry but the fix to this problem https://toolset.com/forums/topic/repeating-field-group-edit-form-not-showing-content-of-fields/ appears to have caused another problem.

The fields "start hour" "end hour" "start minute" and "end minute" are also used in another CPT "events". Is there any reason why the code used in the fix would be causing a problem with the editing of the end hour and end minute fields?

If I edit an event in the backend, the time edits and displays fine,

If I edit an event in a frontend form, an error "Warning: Undefined array key "id" in /homepages/11/d842026020/htdocs/clickandbuilds/Mix926/wp-content/toolset-customizations/enddate.php on line 30" displays on the frontend form when it loads, and the end hour and end minute changes made in the edit form are not saved but the start hour and start minute ones are.

#2497251

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

I already bind the hook to run only with the form IDs:

 if( $form_id == 182634 or $form_id ==182904) {

As you can see with the code I shared before.

Can you please share problem URL where I can see the issue as well as admin access details.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#2498149

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Could you please check now.

I've adjusted the code I've added to "enddate" code snippet as given under:

add_filter('cred_filter_field_before_add_to_form', 'func_fill_values_on_rfg_edit_form', 10, 2);
function func_fill_values_on_rfg_edit_form($field, $computed_values){
  global $post;

  
  
   $form_id = 0;
   if ( isset($form_html_id) ) {
        $parts = explode( '_', $form_html_id);
        $form_id = (int) $parts[2];
     	if($form_id != 167366) return $field;
    }
  
	
  $field_slugs = array('day-of-week', 'start-hour','end-hour','presenter-names');
  
   if($form_id != 167366 and is_array($field) and isset($field['id']) and !in_array($field['id'],$field_slugs)) return $field;
   
  if(is_array($field) and isset($field['id']) and in_array($field['id'],$field_slugs)){
    
   $form_html_id = $field['form_html_id'];
   $form_id = 0;
   if ( isset($form_html_id) ) {
        $parts = explode( '_', $form_html_id);
        $form_id = (int) $parts[2];
    }
    
  if( $form_id == 167366) {
    $field['data'] = is_array($field['data']) ? $field['data'] : array();
    $edit_post_id = $_GET['cred_rfg_id'];
    
    if($field['id']=='presenter-names'){
      $default_value =  get_post_meta( $edit_post_id,'wpcf-'.$field['id'],true);
      $field['data']['user_default_value'] =   $default_value;
     
    }else{
   		$default_value =  get_post_meta( $edit_post_id,'wpcf-'.$field['id'],true);
    	$field['data']['options']['default'] = $default_value;
    }
   
    }
  }
  return $field;
}

Can you please confirm it works as expected now.

#2499019

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Can you please confirm the solution I shared help you to fix your issue.

#2500997

Thanks yes that has resolved the issue.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.