Support

Account

Home Forums ACF PRO How to save ACF data to a unique post and user combination Reply To: How to save ACF data to a unique post and user combination

  • Thanks for your hint, saving evaluation data as array solved my issue.

    I implemented this using a standard ACF form group loaded from the single.php template and adding the following hooks:

    1. Hook into acf/update_value and retrieve value:
      $value = get_post_meta( $post_id, $field['name']);
    2. In the same hook overwrite $value as an array:
      $value[get_current_user_id()] = $value;
    3. Hook into acf/load_field and retrieve value:
      $value = get_post_meta( get_the_ID(), $field['name']);
    4. In the same hook extract value from array:
      $field['value'] = $value[0][get_current_user_id()];