Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Matthias Kittsteiner

    (@kittmedia)

    Hi there!

    Please don’t include the attribute itself in the regular expression if you don’t also add the whole HTML element starting with < in it. Otherwise it will be expanded as described in the documentation, which will then fail in the check.

    So just use the actual content of the src attribute in your regular expression.

    Additionally, you can use services like regex101 to test your regular expression first.

    And finally: since Embed Privacy is relatively greedy, it should be sufficient to just use a regular expression for the main part of the URL: https:\/\/open.spotify.com\/embed\/playlist\/
    There is no need to check for all URL parts here, I guess. At least I think the risk of a race condition is pretty low here.

    Best regards,
    Matthias

    Thread Starter holgee

    (@holgee)

    Hi Matthias,
    very big thanks for your fast reply!!
    I′ve also already used the “regex” test services like the one you had mentioned. Without them I would be lost :). I′ve tried it with the one you′ve provided … but – the playlist is persistent and still displayed.

    How ever – as the Spotify Players above in the website are not displayed and based on this no Spotify cookie is stored – everything would be fine for me!!

    Once again – many thanks for your help and also for providing this nice plugin!

    Best
    Holger

    Plugin Author Matthias Kittsteiner

    (@kittmedia)

    Hm, I just tested your initial code and as soon as I place the code itself to an HTML block and visit the page, it’s already handled by the included Spotify oEmbed provider and thus also gets successfully blocked by Embed Privacy. ??

    But since your version is working for you, it’s fine for me.

    Thread Starter holgee

    (@holgee)

    Hi,
    a very big thanks for your testing and your feedback!!
    Now I′m curious:) Well, yes it would be ok if the playlist ist not covered by the plugin – but on the other hand it would be also nice, if every “Spotify content” would look the same ??

    So where exactly you have placed the HTML block in the “initial” code? I have tried the following – but (unfortunately) nothing changed. (class “spotifyplayer” is the new added one).

    <div class="spotifyplayer">
    <iframe data-lazyloaded="1" src="https://open.spotify.com/embed/playlist/6SnZl0xM5jIQwk6Q2bQSX3" style="border-radius:12px" data-src="https://open.spotify.com/embed/playlist/6SnZl0xM5jIQwk6Q2bQSX3" width="100%" height="450" frameborder="0" allowfullscreen="" allow="autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture" loading="lazy" data-ll-status="loaded" class="entered litespeed-loaded"></iframe><noscript><iframe style="border-radius:12px" src="https://open.spotify.com/embed/playlist/6SnZl0xM5jIQwk6Q2bQSX3" width="100%" height="450" frameBorder="0" allowfullscreen="" allow="autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture" loading="lazy">
    </iframe></noscript>
    </div>

    Really looking forward for your reply ….
    Many thanks in advance!
    Best
    Holger

    Plugin Author Matthias Kittsteiner

    (@kittmedia)

    I just used your code from your first post and added it in the block editor as HTML block:

    Then, it is displayed the following in the frontend without any further change:

    Thread Starter holgee

    (@holgee)

    Hi,
    many thanks for your reply!
    Ok – i′ve misunderstood the “HTML Block” as i thought you′ve meant a block in the HTML source code of the corresponding page. I′ve also tried your suggestion in a “test page” and it worked perfectly. But the Startpage (where the Playlist is integrated) is not a “standard” WP Page but is loading different template files. So I would need to edit the source code of the corresponding file. I′ve compared the both source codes (test page and template part) and can′t find any big differences.

    However – the playlist is not storing a cookie (which is also a funny thing). So i wouldn′t do a “deep dive” to fix the problem – i guess it′s (as usual) only a very small part of one of a contained HTML block elements in one of the template files.

    The plugin works perfectly and therefore everything is fine for me.

    Once again – a very big thanks for your kind help and time – AND the plugin!

    Best
    Holger

    Plugin Author Matthias Kittsteiner

    (@kittmedia)

    It is not only about cookies, already loading external content without consent can be prohibited.

    If you display content otherwise than the default, it’s not possible for Embed Privacy to work as expected, as it’s relying on certain actions. You can edit your template and process the content manually. For further information, see the documentation.

    Thread Starter holgee

    (@holgee)

    Hi,
    you′re right it would be better if the user needs to give a consent (also for the playlist). Therefore a very big thanks for your suggestion to process the content “manually”!

    In this case, I only would have one question. In your documentation it′s statet “See the method Embed_Privacy::get_single_overlay() for a full list of possible arguments.” But – there′s no link to the “get_single_overlay()” arguments. So I guess this would be the shown filter posibilities underneaththis part? Or I misundertand something …

    I′ve tried this in my corresponding templatepart:

    <?php if ( class_exists( 'epiphyt\Embed_Privacy\Embed_Privacy' ) ) {
         $args = ['regex' => '/spotify\.com/',];
         $embed_provider = 'spotify';
         $logo = 'https://herroppermann.de/wp-content/plugins/embed-privacy/assets/images/embed-spotify.png?v=1.8.1';
         $content = '<iframe style="border-radius:12px" src="https://open.spotify.com/embed/playlist/6SnZl0xM5jIQwk6Q2bQSX3" width="100%" height="450" frameBorder="0" allowfullscreen="" allow="autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture" loading="lazy"></iframe>';
    $content = epiphyt\Embed_Privacy\Embed_Privacy::get_instance()->get_single_overlay( $content,$logo,$embed_provider, 'My Example', 'my-example', $args );
                            ?> 

    When using this the playlist is not shown, but also nothing else (like Logo, text, or opt-in link).

    So if you would be so kind and give me hand on this, or a link to the mentioned possible arguments – I would be VERY happy.

    A very big thanks in advance!
    Best
    Holger

    Plugin Author Matthias Kittsteiner

    (@kittmedia)

    The code is just an example and is primarily for developers. In it, you assign the content to, which contains the embed overlay, to the variable $content. To output the variable, you need to use a code like echo $content; or similar.

    Thread Starter holgee

    (@holgee)

    Hi,
    many thanks!!! I nearly come to and end, thanks to your help.
    I′ve integrated the code in the template part like this:

    <?php if ( class_exists( 'epiphyt\Embed_Privacy\Embed_Privacy' ) ) {
    $args = ['regex' => '/spotify\.com/',];
    $embed_provider = 'Spotify';
    $provider = 'Spotify';
    $url = '<iframe style="border-radius:12px" src="https://open.spotify.com/embed/playlist/6SnZl0xM5jIQwk6Q2bQSX3" width="100%" height="350" frameBorder="0" allowfullscreen="" allow="autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture" loading="lazy"></iframe>';
    							$content = epiphyt\Embed_Privacy\Embed_Privacy::get_instance()->get_single_overlay( $url,$embed_provider,$provider,'Playlist', 'playlist', $args );		}
    echo $content;						 ?>	

    and it (nearly) works fine.

    The only thing missing is the url to the privacy policy from Spotify.
    I′ve searched all the documentation, but can′t find anyhing regarding this.

    Compared to the other parts of the homepage, where the plugin is working completely correct

    It′s only the sentence “Erfahre mehr in den Datenschutzbestimmungen von Spotify” – or “Lern more in Spotify′s privacy policy” in EN and the link wich is not working / shown.

    It would be really nice, if you could give me a hint, how to integrate this last part via the code.
    Many thanks in advance!

    Plugin Author Matthias Kittsteiner

    (@kittmedia)

    The third parameter $provider needs to be lowercase. Then it should be linked properly to the available embed provider and add the privacy policy. This URL is currently only handled via postmeta (where each included provider is a custom post:

    https://github.com/epiphyt/embed-privacy/blob/main/inc/class-embed-privacy.php#L849

    Thread Starter holgee

    (@holgee)

    Hi,
    a very big thanks for your reply!
    I′ve changed the $provider name in lowercase – but it still doesn′t show the link. Therefore I′ve also tried to retrieve the link – but same. No data policy link is shown.

    <?php if ( class_exists( 'epiphyt\Embed_Privacy\Embed_Privacy' ) ) {
      $args = ['regex' => '/spotify\.com/',];
      $embed_provider = 'Spotify';
      $provider = 'spotify';
      $privacy_policy = get_post_meta( $embed_post->ID, 'privacy_policy_url', true );
     $url = '<iframe style="border-radius:12px" src="https://open.spotify.com/embed/playlist/6SnZl0xM5jIQwk6Q2bQSX3" width="100%" height="350" frameBorder="0" allowfullscreen="" allow="autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture" loading="lazy"></iframe>';
    
    $content = epiphyt\Embed_Privacy\Embed_Privacy::get_instance()->get_single_overlay( $url,$embed_provider,$provider,$privacy_policy ,'Playlist', 'playlist', $args );
    							}
    echo $content;

    But to be honest … I guess we both had spend enough time on this ?? For me the current solution is absolutely ok. And most of the visitors won′t see this ?little difference”
    Therefore – a very big thanks for all your help!

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Not working for Spotify Playlist’ is closed to new replies.