jtsternberg / DsgnWrks-Instagram-Importer

Backup your instagram photos & display your instagram archive. Supports importing to custom post-types & adding custom taxonomies.
http://wordpress.org/extend/plugins/dsgnwrks-instagram-importer/
33 stars 16 forks source link

Issue importing all photos of a post #57

Open srazi opened 5 years ago

srazi commented 5 years ago

I have an strange problem. With two account (personal) it correctly imports all photo of a post. But with my another account (business) it imports just import first photo multiple times.

Maybe the type of account is the problem here?

srazi commented 5 years ago

May this helps you: As debug purpose I added the following line of code:

$import['post_title'].=($index. '- '.$img_item->images->standard_resolution->url);

to:

protected function save_img_post() {
    ...
    switch ( $this->pic->type ) {
        ...
        case 'carousel':
        ...
            foreach ( $p->carousel_media as $img_item ) {
                ...
                switch ( $img_item->type ) {
                    ...
                    default:
                    ...
                        $sub_items[] = $this->upload_img_media( $img_item, wp_trim_words( $import['post_title'], 5, '...' ) . ' - ' . ++$index );
                        // added by me
                        $import['post_title'].=($index. '- '.$img_item->images->standard_resolution->url);

                        break;
                }
            }
    }

And the title correctly contains URLs of all photos.

srazi commented 5 years ago

Removing this hack fixed it for me. So I suggest to add an option to enable/disable hacks.