airesvsg / acf-youtubepicker

Search and select videos on YouTube without leaving the page.
https://wordpress.org/plugins/acf-youtube-picker
50 stars 7 forks source link

Field returns data in form of multiple videos even if "select multiple videos" is set no #10

Closed roopemerikukka closed 8 years ago

roopemerikukka commented 8 years ago

Hi,

I just updated the plugin to 3.0.0 and I noticed that the field returns array which has array inside it as it would have multiple videos selected even if I have the "select multiple videos" set to no.

So as I have selected the video id before by using $video["vid"] now I get it by using $video[0]["vid"]

Is this normal behaviour of a bug?

I also noticed that when I sync in ACF it creates completely new Field Group instead of syncing and I can't remove the old one.

BTW Thanks for amazing plugin!

airesvsg commented 8 years ago

Hi @roopemerikukka, please export your acf field group and attach here. I'll test them. Thanks

roopemerikukka commented 8 years ago

Hi and sorry for the delayed answer. Here is the field group of our cover video:

{
    "key": "group_56c4864cd019a",
    "title": "Required cover video",
    "fields": [
        {
            "key": "field_56c4865199b43",
            "label": "Video",
            "name": "cover_video",
            "type": "youtubepicker",
            "instructions": "",
            "required": 1,
            "conditional_logic": 0,
            "wrapper": {
                "width": "",
                "class": "",
                "id": ""
            },
            "api_key": "AIzaSyAuHQVhEmD4m2AXL6TvADwZIxZjNogVRF0",
            "multiple": 0,
            "yp_advanced_options": 1,
            "answerOptions": [
                "title",
                "vid",
                "url",
                "thumbs",
                "iframe"
            ],
            "channelId": "",
            "channelType": "",
            "eventType": "",
            "order": "relevance",
            "safeSearch": "none",
            "videoCaption": "any",
            "videoDefinition": "any",
            "videoDimension": "any",
            "videoDuration": "any",
            "videoEmbeddable": "true",
            "videoLicense": "any",
            "videoSyndicated": "any",
            "videoType": "any",
            "videoCategoryId": "",
            "relatedVideoId": "",
            "topicId": "",
            "regionCode": "",
            "relevanceLanguage": "",
            "maxResults": ""
        }
    ],
    "location": [
        [
            {
                "param": "post_type",
                "operator": "==",
                "value": "post"
            },
            {
                "param": "post_taxonomy",
                "operator": "==",
                "value": "fs-journal-post-format:video"
            }
        ]
    ],
    "menu_order": 2,
    "position": "normal",
    "style": "default",
    "label_placement": "top",
    "instruction_placement": "label",
    "hide_on_screen": "",
    "active": 1,
    "description": "",
    "modified": 1460373170
}
airesvsg commented 8 years ago

Hi @roopemerikukka, I'll test soon. Thanks

roopemerikukka commented 8 years ago

I deleted the whole fieldgroup and recreated it again to see if there was some database cache problems but with no luck. Have you had time to test this?

airesvsg commented 8 years ago

Hi @roopemerikukka, what's version of ACF? Thanks

roopemerikukka commented 8 years ago

I have ACF version 5.3.3.1 installed. I'll try to update it and check if that fixes the problem.

roopemerikukka commented 8 years ago

Nope. That didn't fix the issue. I found that this happens because in the file fields/acf-youtubepicker.php the check if ( 'api' === $format ) { on row 456 fails and the else part (rows 486-488) creates the array in format of multiple videos. Didn't have time to find where the $format comes from but maybe you can answer? :)

sarukuku commented 8 years ago

Any updates on this?

roopemerikukka commented 8 years ago

Superb 👍