Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+3 votes
1.9k views
in Plugins by
recategorized by
So, now that I figured out why my YouTube code was being scrubbed, I thought I would create a function to automatically convert YouTube links into YouTube embed code.  This uses the new YouTube iframe code, not the old embed code.  The plugin is here:

https://github.com/NoahY/q2a-embed

It works with the markdown editor generated code, but I haven't tested it with the wysiwyg generated code.  Should be fine.  It checks for the url in both questions and answers, with or without <a> tags surrounding them, and replaces them with the iframe content.  It doesn't change the database entry, and can be switched off via the control panel. It can be extended to include other video sites, if someone can give me the two variables, i.e. the hyperlink and the code to replace it with.

1 Answer

0 votes
by

 

Thanks, but strange it works only together with badges plugin, without badges plugin i have error at admin section:
 
Fatal error: Call to undefined function qa_get_badge_list() in /xxx/xxx/xxx/xxx/xxx/qa-plugin/embed/qa-embed-admin.php on line 16

 

by
oh dear... forgot to remove that :) gone now.
by
Works thanks but now i getting error at login, register and feedback pages:

Warning: Invalid argument supplied for foreach() in /xxx/xxx/xxx/xxx/xxx/qa-include/qa-page.php on line 396

Warning: Invalid argument supplied for foreach() in /xxx/xxx/xxx/xxx/xxx/qa-include/qa-page.php on line 481

Warning: Invalid argument supplied for foreach() in /xxx/xxx/xxx/xxx/xxx/qa-include/qa-page.php on line 498
by
I don't know where those errors are coming from.  It's something about caching that I don't understand.  I must be doing something it doesn't like.  Anyway, you can safely ignore those errors, and error display should be off on production sites anyway (that's what the error log is for).
...