Home Forums Plugin Support WP User Frontend Pro Repeat field out of order

This topic is: resolved

This topic contains 2 replies, has 1 voice, and was last updated by  DeanT765 5 years, 12 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #5984

    DeanT765
    Participant
    Post count: 14

    Any time I go to make an edit on a post from a form with a repeat field, the data is out of order upon editing. Some of my repeat fields are alphabetized on display anyway but some of them need to displayed as ordered, and any edits ruin the order.

    Any tips on this?

    #6200

    DeanT765
    Participant
    Post count: 14

    Actually it appears to just reverse with each edit of a form…they're stored from the the top down and populate the edit fields from the bottom up? And then stored that way, then reversed on editing.

    I think I can track this one down on my own actually I'll update if I do.

    #6202

    DeanT765
    Participant
    Post count: 14

    Found a quick fix…in frontend_form_post.php in the function update_post_meta I just copied and pasted this code again

    foreach ($multi_repeated as $repeat_key => $repeat_value) {
                // first, delete any previous repeatable fields
                delete_post_meta( $post_id, $repeat_key );
    
                // now add them
                foreach ($repeat_value as $repeat_field) {
                    add_post_meta( $post_id, $repeat_key, $repeat_field );
                }
    

    And that solved the problem…if only by way of reversing twice for each time the post is saved so it's always in the right order. I didn't want to deal with reordering keys or anything so that is fine with me.

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Repeat field out of order’ is closed to new replies.