Support

Account

Home Forums ACF PRO multiple forms in front end user account

Unread

multiple forms in front end user account

  • Hi all.

    I’m building a website that is for booking events, the e-commerce platform is woocommerce. I’ve acted an action to add a new page to the user account called family, where I want the user to be able to manage their family members and contact info.

    So far I’ve added the page, created a repeater for user where they can add a family member and fill in that members information, it saves and all works great.

    Now I’d like to add an ACF group before the repeater that has main information such as emergency contact details and next of kin, but I can’t figure out how to display two fields (the group and the repeater) within the one action and only have one save button to save the details to the users account.

    This is what I have so far that works for the repeater, but if anyone could steer me in the right direction as to how to add the group field, it’d be hugely appreciated.

    <?php
      acf_form_head();
      get_header(); 
    ?>
    
    Family
    
    <div class="family-members-form"><?php 
    
     if ( !is_user_logged_in() ){ 
     echo 'You are not logged in. <br /> <a href="' . get_permalink(31) .'">Log In &rarr;</a>';
    
     } else {
    
     $user = wp_get_current_user();
     
    
    $options = array(
      // 'field_groups' => ['group_5cbd99ef0f584'],
      'fields' => ['field_5f24194f719ca'],
      'form_attributes' => array(
        'method' => 'POST',
        'action' => admin_url("admin-post.php"),
      ),
      'html_before_fields' => sprintf(
        '<input type="hidden" name="action" value="adaptiveweb_save_profile_form">
        <input type="hidden" name="user_id" value="user_%s">',
        $user->ID
      ),
      'post_id' => "user_{$user->ID}",
      'form' => true,
      'html_submit_button' => '<button type="submit" class="acf-button button button-primary button-large" value="Update Profile">Update Profile</button>',
    );
    
    acf_form($options);
     }
    
     ?>
     
     </div>
Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.