Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • I have the same issue. I’ve looked into it and I’ve written a fix.

    In js/yppv3-main.js, delete the following code at the end of the file:

    
    /**
     * Change YouTube video based on playlist selection
     */
    document.querySelector('.yt-api-video-item').addEventListener('click', function () {
        var ytUri = 'https://www.youtube.com',
            thisId = this.dataset.id;
    
        document.getElementById('vid_frame').src = ytUri + '/embed/' + thisId + '?autoplay=1&rel=0&showinfo=1&autohide=1';
    });
    

    Add the following after the forEach loop that adds each video to the page (after line 23):

    
    /**
     * Change YouTube video based on playlist selection
     */
    var videoNode = document.querySelectorAll('.yt-api-video-item');
    for (var i = 0; i < videoNode.length; i++) {
        videoNode[i].addEventListener('click', function() {
            var ytUri = 'https://www.youtube.com';
            document.getElementById('vid_frame').src = ytUri + '/embed/' + this.dataset.id + '?autoplay=1&rel=0&showinfo=1&autohide=1';
        });
    }
    

    The issue is caused by trying to assign an event listener to each thumbnail before the the thumbnails have been loaded. This code reorganises the logic to add event listeners after thumbnails have been created.

    • This reply was modified 6 years, 7 months ago by capitalt.
    • This reply was modified 6 years, 7 months ago by Jan Dembowski.

    The issue is caused by the check that takes place before the user is forwarded to the link encoded in the ‘urlpassed’ get parameter.

    Line 33 of controllers/front/stat.php :

    if (preg_match('/'. preg_replace('/\//', '\\/', $WJ_Stats->subscriber_clicked()) .'/', $email_object['body']) ||

    As you can see, preg_replace is used to convert $WJ_Stats->subscriber_clicked() (which is the decoded url from the ‘urlpassed’ parameter value) into a suitable regular expression that can be used to see if the url exists within the contents of the email.

    However, all it is doing is escaping forward slashes. Makes sense in a way – escape forward slashes since the regex delimiter is a forward slash. However, this doesn’t account for characters in the url which are also special regex characters – such as a question mark.

    To fix this, change line 33 to:

    if (preg_match('|'. preg_quote($WJ_Stats->subscriber_clicked()) .'|', $email_object['body']) ||

    Here, we use a pipe as a more effective delimiter for a regex designed to look for a URL, and we use preg_quote to escape any regex special characters.

    Works for me! Hopefully MailPoet will resolve this in the next update so that it my emails continue to work post update.

Viewing 2 replies - 1 through 2 (of 2 total)