Support

Account

Home Forums General Issues Update User Repeater with Post Object Info? Reply To: Update User Repeater with Post Object Info?

  • Ok, so I figured out how to properly get the ID of the course that was completed:

    $course_id = $data['course']->ID

    So, how can I then take my course and insert it into a repeater (with a Post Object sub field)? Here’s what I have so far, which isn’t working:

    $course_id = $data['course']->ID;
    $coursePoint = get_field('field_56646f51fa48b', $course_id);
    $value = get_field('field_56644f11d62c3', $user_ID); 
    
    $value[] = array("field_566459158d2ab" => $coursePoint, "field_5664598f8d2ad" => "20151206"); //The second field in the Repeat (Date) gets into a new row fine
    
    update_field( $field_key, $value, $user_ID );

    For reference, the multidimensional array that is output by $data is structured like this:

    Array
    (
        [user] => WP_User Object
            (
                [data] => stdClass Object
                    (
                        [ID] => 30
                        [user_login] => testing
                        [user_pass] => $P$BQqHM2nDR2C3WB87v2gd83R0ZCtRug.
                        [user_nicename] => testing
                        [user_email] => testing@testsite.com
                        [user_url] =>
                        [user_registered] => 2015-11-23 15:59:37
                        [user_activation_key] =>
                        [user_status] => 0
                        [display_name] => James Test
                    )
    
                [ID] => 30
                [caps] => Array
                    (
                        [s2member_level4] => 1
                        [access_s2member_ccap_member] => 1
                    )
    
                [cap_key] => wp_lxkfgb_capabilities
                [roles] => Array
                    (
                        [0] => s2member_level4
                    )
    
                [allcaps] => Array
                    (
                        [read] => 1
                        [level_0] => 1
                        [access_s2member_level0] => 1
                        [access_s2member_level1] => 1
                        [access_s2member_level2] => 1
                        [access_s2member_level3] => 1
                        [access_s2member_level4] => 1
                        [s2member_level4] => 1
                        [access_s2member_ccap_member] => 1
                    )
    
                [filter] =>
            )
    
        [course] => WP_Post Object
            (
                [ID] => 280
                [post_author] => 1
                [post_date] => 2015-12-05 11:21:55
                [post_date_gmt] => 2015-12-05 16:21:55
                [post_content] => This is another course!
                [post_title] => Another Course
                [post_excerpt] =>
                [post_status] => publish
                [comment_status] => closed
                [ping_status] => closed
                [post_password] =>
                [post_name] => another-course
                [to_ping] =>
                [pinged] =>
                [post_modified] => 2015-12-06 12:27:39
                [post_modified_gmt] => 2015-12-06 17:27:39
                [post_content_filtered] =>
                [post_parent] => 0
                [guid] => http://testsite.com/vra/?post_type=sfwd-courses&p=280
                [menu_order] => 0
                [post_type] => sfwd-courses
                [post_mime_type] =>
                [comment_count] => 0
                [filter] => raw
            )
    
        [progress] => Array
            (
                [280] => Array
                    (
                        [lessons] => Array
                            (
                                [316] => 1
                            )
    
                        [topics] => Array
                            (
                                [316] => Array
                                    (
                                        [327] => 1
                                    )
    
                            )
    
                        [completed] => 1
                        [total] => 1
                    )
    
            )
    
    )