WordPress.org

Ready to get started?Download WordPress

Forums

Subscribe2
[resolved] YouTube videos in HTML notifications are just a black square (38 posts)

  1. douglerner
    Member
    Posted 2 years ago #

    I'm testing Subscribe2. In the HTML outgoing mail sent to a registered user, the embedded YouTube video appears as a black square. And the square itself is not clickable and there is no indication there is a video there to look at.

    Is there a setting or something to make this work?

    Thanks,

    doug

    http://wordpress.org/extend/plugins/subscribe2/

  2. mattyrob
    Member
    Plugin Contributor

    Posted 2 years ago #

    @Doug,

    The code used to inset a video into your content online would be different from any code that might work to play a video in a delivered email.

    Embedding videos in your emails will probably always be fraught with difficulties as email clients are not really designed to play video or accept embedded video.

    I'd suggest that you avoid trying to embed video in email and instead link your readers to a online version.

  3. douglerner
    Member
    Posted 2 years ago #

    Hi, Matty.

    Well, what I'm doing is just posting a link to the video, not the embed code. It then appears embedded at my site automatically.

    Is there a way to get WordPress to just send out the link I put in the post?

    Thanks,

    doug

  4. douglerner
    Member
    Posted 2 years ago #

    I see if I go into the media settings and turn off automatic embeds and then send a Subcribe2 preview to myself that it just sends the link, which is fine. That would be like me sending a link to my friend by email.

    It's too bad though. It would be nice if the site could display the embed, but since the actual content stored in the database is just the link that the email notifier sent the link. Best of both worlds.

    Maybe there is another notifier which can do that?

    Anyway, thanks,

    doug

  5. douglerner
    Member
    Posted 2 years ago #

    Ooh. I just noticed something.

    For the posts I made via Postie, they were posted with embed tags. Those:

    (1) Show up as embedded videos at the blog and;

    (2) Show up as embedded videos in the email notifications! At least in Mail.app on my Mac it does.

    Something to work with here.

    doug

  6. douglerner
    Member
    Posted 2 years ago #

    Yes, that's a possible solution.

    Just turn off auto-embed in the Media settings.

    Then if you either:

    (1) Use the embed tags manually or

    (2) Use Postie to post as HTML mail with just the YouTube link (easiest),

    the post shows up in the web as an embedded video and the Subscriber2 notification which goes out sends the video so it appears embedded. At least in Mac Mail. I haven't tested in other clients.

    doug

  7. mattyrob
    Member
    Plugin Contributor

    Posted 2 years ago #

    @Doug,

    I'm glad you have a working solution, maybe I'll look into embedding in a future version of Subscribe2.

  8. douglerner
    Member
    Posted 2 years ago #

    Matty,

    Well, it's not a perfect solution. While the embed tag goes out and embeds in Mail.app on the Mac, it doesn't in Gmail.

    So the notification that goes out from Subscribe2 just ends up with nothing at all where the embed was in Gmail (and also Mailplane). I imagine it's a problem in some other Mail clients as well.

    If embedded videos are a problem in many mail clients, it seems the safest thing would be to send just the links.

    Of course one way to achieve that is, as you said, to make sure that just links get posted. But it's a shame to do that when the blog itself can look nice with embedded video.

    There must be a combination of Postie and WordPress settings which work.

    頑張ります。

    doug

  9. mattyrob
    Member
    Plugin Contributor

    Posted 2 years ago #

    @Doug,

    How are you adding videos to your site? Are you using core WordPress functionality and the [embed] shortcode or are you using a plugin, or maybe just pasting in the embed code?

    Having done a little readin one solution with Subscribe2 might be to use the [embed] shortcode - that'll get stripped out in the emails leaving just the link whereas on your site it'll embed fully as the link will get filtered and translated into an embed.

  10. douglerner
    Member
    Posted 2 years ago #

    OK. Here is the "safest" combination:

    1. In WordPress > Settings > Media make sure Auto-Embeds is checked. This doesn't change the content of the saved message (which contains just a YouTube link) but when displaying it displays as an embedded YouTube.

    2. In Postie > Settings > Messages > Advanced Options make sure that Automatically convert URLs to links is turned off. If on, it converts YouTube URLS to embed tags. We don't need this because WordPress itself will display it as embedded if (1) is checked.

    With the above settings, posts via the web or via email will show the YouTube as embedded video. But Subscribe2 will just send out the YouTube link in notifications.

    doug

  11. douglerner
    Member
    Posted 2 years ago #

    Matty,

    There were two ways I was adding the videos:

    (1) Using the WordPress editor and just entering the YouTube URL. I was not using shortcode. I was depending on the In WordPress > Settings > Media setting to auto-embed. This apparently renders it as embed but leaves the URL alone. This looks to be safe with Subscribe2.

    (2) The problem was I usually post via email. I have been using Postie for this. But what Postie was doing was actually converting the simple YouTube URL to embed tags before posting. That was what was causing the problem with Subscribe2.

    By disabling that in Postie as described in my post just above, Postie just posts the URL itself. Then WordPress renders it as embedded by leaves the internal data alone. And Subscribe2 just mails out the URL. And all is right in the world.

    Thanks for checking!

    I need to go by this plugin now because I want public users also to get HTML mail.

    Thanks,

    doug

  12. mattyrob
    Member
    Plugin Contributor

    Posted 2 years ago #

    @Doug,

    Sounds like you've configured your way around this issue. Does the link still go into the HTML emails rather than an embed? I was looking at ways to maybe remove the core WordPress embed filter in the emails but if what you have works then I don't really need to do that.

  13. douglerner
    Member
    Posted 2 years ago #

    In this case just the link goes into the HTML mails, which is the safest as you point out. And with auto-embed it displays nicely in WP itself.

    Now if only the notifications themselves looked nice. They are sort of threadbare, don't you think?

    Thanks,

    doug

  14. mattyrob
    Member
    Plugin Contributor

    Posted 2 years ago #

    @Doug,

    The notifications can be configured to you own specifications. I prefer a minimalist approach to the notifications I send and receive (I always opt for plain text even when HTML is available). But, I accept no everyone thinks like me which is why HTML is available as an option giving you the tools to add as much polish and bling as you like!

  15. douglerner
    Member
    Posted 2 years ago #

    It turns out this is not resolved.

    I turned off the auto-embed that was going on, so the content of a post internally is just something like:

    http://www.youtube.com/watch?v=FGANwLBiF-k

    But I had to turn on support of shortcode recognition or the old posts wouldn't show up correctly.

    This results in:

    1. Posts like http://douglerner.net/?p=2401 showing up ok in the web but,

    2. When Subscribe2 sends out the notification instead of just sending out the URL itself (which is all that is there internally in the post) Subscribe2 sends out a message with a big black rectangle where the URL is!

    Looking at the source of the HTML mail, it looks like Subscribe2 is taking the internal YouTube URL above and sending it as:

    <span class='embed-youtube' style='text-align:center; display: block;'><iframe class='youtube-player' type='text/html' width='584' height='359' src='http://www.youtube.com/embed/FGANwLBiF-k?version=3&rel=1&fs=1&showsearch=0&showinfo=1&iv_load_policy=1&wmode=transparent' frameborder='0'></iframe></span>

    Why would it do that? That's the cause of the problem.

    The HTML source of the actual post doesn't have all that stuff in it.

    Thanks,

    doug

  16. douglerner
    Member
    Posted 2 years ago #

    I guess I can just use Jetpack on my self-hosted blog.

    I just tried it and even though Jetpack is written by wordpress.com and even though it uses wordpress.com subscription management and email, unlike the notifications from wordpress.com it sends out a valid link. And unlike the subscriptions from Subscribe2 it doesn't send out just a black square. It sends out the URL.

    I don't know why Jetpack would work correctly while the email notifications from my wordpress.com blog don't. And I don't know why Subscribe2 sends out all that code I posted above. But I've spent waaaaay too much time worrying about this.

    The email subscriptions from wordpress.com itself sends out a still image with an invalid link, so I would like to do this self-hosted

    The only things I don't like about Jetpack's notifications are (1) Like with wordpress.com you have no control over the subscribers (e.g. you can't help somebody unsubscribe) and (2) you can't customize the confirmation messages, which include "howdy" and other expressions I don't like. That's why I wanted to use Subscribe2 if possible.

    But since the email notifications from wordpress.com have that bug, and the Jetpack notifications don't, and Subscribe2 sends out a black rectangle, Jetpack might be my only choice.

    doug

  17. douglerner
    Member
    Posted 2 years ago #

    This keeps getting marked resolved even though it isn't. :)

    Anyway, I see how the code apparently works. It doesn't matter what the actual HTML content is stored in the post itself. Apparently it takes the rendered HTML that wp displays and uses that. That's what messes it up.

    doug

  18. mattyrob
    Member
    Plugin Contributor

    Posted 2 years ago #

    @Doug,

    It looked resolved 4 days ago!

    Anyway, there may be some way to code around this. On your install we may need to deactivate the embed shortcode for email sending and then re-register it after we're done. That's what I was looking at 4 days ago when you were talking about the posit configuration.

    I'll look at their again and post a code snippet later when I get time.

  19. douglerner
    Member
    Posted 2 years ago #

    Matty. Yes, it does look resolved there. As I mentioned, I keep trying to set it back to unresolved but it doesn't stick. :)

    There are some plugins which just don't seem to play well together. I think the main issue is that Subscriber doesn't use the actual content of the post (what you see when you edit and look at the HTML) but rather what WP evaluations as the result and turns into the HTML you see when you view the post.

    doug

  20. mattyrob
    Member
    Plugin Contributor

    Posted 2 years ago #

    @Doug,

    So, can I try to get this clear in my head where we are at now.

    1/ In Settings -> Media you have auto-embed checked now.
    2/ In your post content you are simply adding a link to the YouTube video - no [embed] shortcode tags.

    This results in iframe code being present in the HTML emails sent by Subscribe2 - correct?

  21. douglerner
    Member
    Posted 2 years ago #

    Matty.

    It's ok. I know I sound confusing. Sorry.

    1/ In Settings -> Media you have auto-embed checked now.

    Yes, I just now turned it on again. With it off, the post not only appears as just a URL, it is a a non hyperlinked URL. Just dead text on the page. With that setting checked it appears as an embedded video.

    In your post content you are simply adding a link to the YouTube video - no [embed] shortcode tags.

    Yes - that's what I started doing going forward. I'm using Postie to post. They have an option for turning off the shortcode embed. I have the option of doing it either way, but right now it is as you say, just a link without embed shortcode tags. I thought that would help with the Subscriber2 notifications if the shortcode wasn't in the post.

    This results in iframe code being present in the HTML emails sent by Subscribe2 - correct?

    Yes. Resulting in a black rectangle in my received email.

    It appears that Subscribe2 sends not what is in the post itself (i.e. just a URL) but the evaluated HTML that WP renders on the page.

    doug

  22. mattyrob
    Member
    Plugin Contributor

    Posted 2 years ago #

    @Doug,

    Okay, let's try a little code hacking :)

    In wp-content/plugins/subscribe2/classes you'll find a file called class-s2-core.php. Edit this file and look for the publish() function around line 429.

    Further down this function you'll find this line around line 567:
    $content = apply_filters('the_content', $content);

    That line applies all of the WordPress filters to the mail message content and I think it is here that the URL is being replaced with the iframe.

    Immediately before that line try adding this:

    global $wp_embed;
    remove_filter( 'the_content', array(&$wp_embed, 'autoembed');

    Then give it a try to see if that stopped the URL being replaced in the emails.

  23. douglerner
    Member
    Posted 2 years ago #

    Matty,

    If I try to add those two line, when I go to Subscribe2 settings I get this error:

    Parse error: syntax error, unexpected ';' in /home/doug/public_html/douglerner.net/wp-content/plugins/subscribe2/classes/class-s2-core.php on line 568

    The 4 lines beginning at 566 now read

    $content = str_replace('[gallery', $gallid, $post->post_content);
    global $wp_embed;
    remove_filter( 'the_content', array(&$wp_embed, 'autoembed');
    $content = apply_filters('the_content', $content);

    I don't see any unexpected semi-colons, do you?

    Thanks,

    doug

  24. mattyrob
    Member
    Plugin Contributor

    Posted 2 years ago #

    @Doug,

    No, but I have missed a closing bracket! Sorry. Try this instead:

    global $wp_embed;
    remove_filter( 'the_content', array(&$wp_embed, 'autoembed') );
  25. douglerner
    Member
    Posted 2 years ago #

    Matty,

    Ah. I should have noticed that.

    Anyway, the plain text preview is sending:

    Doug-at-Large has posted a new item, 'Test Two of video post Thai Fish'
    
    http://www.youtube.com/watch?v=FGANwLBiF-k
    
    From Tanabe.

    but the HTML is still sending the black rectangle with this in it:

    <span class='embed-youtube' style='text-align:center; display: block;'><iframe class='youtube-player' type='text/html' width='584' height='359' src='http://www.youtube.com/embed/FGANwLBiF-k?version=3&rel=1&fs=1&showsearch=0&showinfo=1&iv_load_policy=1&wmode=transparent' frameborder='0'></iframe></span>

    doug

    p.s. What time zone are you in?

  26. mattyrob
    Member
    Plugin Contributor

    Posted 2 years ago #

    @Doug,

    Right, I'll have to have a look on one of my test site later. I can't figure out why that doesn't work from just reading the code.

    I'm on GMT +1.

  27. douglerner
    Member
    Posted 2 years ago #

    Matt,

    Ah, so it's mid-morning there. I'm on GMT +9.

    Thanks,

    doug

  28. douglerner
    Member
    Posted 2 years ago #

    Please let me know if there are more tests I can try on my self-hosted server.

    Thanks,

    doug

  29. mattyrob
    Member
    Plugin Contributor

    Posted 2 years ago #

    @Doug,

    I've had a hold up on this because I could not get the auto-embed to work on my main production sites!!!

    I've got it working on a test site in the last 5 minutes so I now need to track down the filter.

  30. douglerner
    Member
    Posted 2 years ago #

    Matty,

    Did you have some interfering other plugin that was preventing the auto-embed to work?

    Anyway, thanks!

    doug

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags