espresto/reclaim-social-media

youtube import : trunkated post_content

Closed this issue · 5 comments

Hi,
since the latest update for youtube.class.php, the post_content is not working -
(from mysql) :

<div class="ytembed yt"></div>

The part youtube iframe is missing.
line135 seems not to work correctly.

yes, it's an issue that i think is related to wordpress. the wp_cron runs the script as anonymous user. content containing <script> or <iframe> tags, is stripped. so the autoimport fails, but the force sync works.

i worked around this in the instagram class:
https://github.com/espresto/reclaim-social-media/blob/master/mods/instagram.class.php#L324 (see 22db45c)

i'll add that workaround to the other classes as well. maybe someone has a better idea?

Huh, do you have any idea what is stripping the iframes?

another idea to work around this a little more cleanly: if an embed-code contains iframe or script tags:

  • save the embed code to a post meta field "embed_code" (some mods do that anyways)
  • define a shortcode [embed_code] in mod.class.php, that put the post meta data into the content

it's little more elegant, than defining shortcodes fro each mod, like i tried in the instagram class code. did not try this out yet, it might be possible that wordpress also filters that input.

should be solved with 205f1dd and 0fc11c3