Project

General

Profile

Bug #2562

Embed Google Forms through Shortcode

Added by Jen Jack Gieseking almost 6 years ago. Updated almost 6 years ago.

Status:
Resolved
Priority name:
Normal
Assignee:
Category name:
-
Target version:
Start date:
2013-05-06
Due date:
% Done:

0%

Estimated time:

Description

I am updating the JustPublics@365 site and cannot insert an iFrame embed because it gets stripped out when I save. OpenCUNY recently had this issue. I am assigning this to Keith for now so that he could weigh in.

I believe the solution is that the iFrame shortcode plugin needs to be installed as a temporary plugin in order that iFrame

History

#1 Updated by Matt Gold almost 6 years ago

Hi Jack -- this is a feature, not a bug. iFrames present significant security risks and are thus disallowed on WP multisite installs by default. The stripping of iframes can be disabled, but I think it's a bad idea to enable that functionality.

#2 Updated by Matt Gold almost 6 years ago

Also: what are you trying to embed?

#3 Updated by Keith Miyake almost 6 years ago

I think most embeddable content that you might use an iframe for should be able to be embedded without having to use iframes, like with a plugin/shortcode (e.g., google docs plugin, jetpack for multimedia, etc.). If you're trying to include something from an external site that gives you an "embed" code, post the embed code here (use the "pre" tag to wrap the code so it doesn't get mangled) and maybe we can figure out an alternative that doesn't rely on iframes.

#4 Updated by Jen Jack Gieseking almost 6 years ago

  • Status changed from New to Resolved

It's a google form: will embed using gdoc plugin--thanks for jumping in and clarifying, both of you.

#5 Updated by Matt Gold almost 6 years ago

Great. Thanks, Jack!

#6 Updated by Matt Gold almost 6 years ago

  • Subject changed from iFrame embed stripped out to Embed Google Form
  • Status changed from Resolved to Assigned
  • Assignee changed from Keith Miyake to Boone Gorges

Hi Boone --

Jen Jack is trying to embed a google form on the JustPublics365 blog. Can you please let us know whether the embed shortcode you created for Google docs works for forms and if not, might it be possible to enable forms to be embedded through the shortcode, too?

Many thanks.

Best,

Matt

#7 Updated by Matt Gold almost 6 years ago

  • Tracker changed from Bug to Feature
  • Subject changed from Embed Google Form to Embed Google Forms through Shortcode

#8 Updated by Boone Gorges almost 6 years ago

  • Assignee changed from Boone Gorges to Raymond Hoh

It was Ray who wrote that shortcode. Ray, does it support Forms? If so, what's the syntax?

#9 Updated by Raymond Hoh almost 6 years ago

Instructions to embed a Google Doc form are listed here:
https://github.com/cuny-academic-commons/google-docs-shortcode#embedding-a-form

Let me know if it isn't clear enough.

#10 Updated by Matt Gold almost 6 years ago

Jack - please give is a shot and let us know whether it works.

Scott -- can you please add this to our site documentation if it's not there already?

Ray -- did we already discuss packaging this as a plugin? If not, I think it's worth doing that; please let me know what you think.

#11 Updated by Matt Gold almost 6 years ago

  • Tracker changed from Feature to Support

#12 Updated by Jen Jack Gieseking almost 6 years ago

Hi Ray & co.,

To clarify, this issue is only happening when trying to embed a Google Form. It is fine with all other Google docs. If you try to embed a Google Form, as I did, you will see this issue as well.

Cheers, Jack

#13 Updated by Raymond Hoh almost 6 years ago

Hi Jack,

How are you getting the form URL and how does your shortcode look like?

This example works for me:

[gdoc link="https://docs.google.com/spreadsheet/viewform?formkey=dDZLLXBEUWhVRGNIS28tYlVGa21PT0E6MQ"]


Hi Matt,

The plugin is already in the wp.org repo:
https://wordpress.org/extend/plugins/google-docs-shortcode/

#14 Updated by Boone Gorges almost 6 years ago

  • Status changed from Assigned to Reporter Feedback
  • Target version set to Not tracked

#15 Updated by Jen Jack Gieseking almost 6 years ago

  • Assignee changed from Raymond Hoh to Boone Gorges

Hi Boones and Ray & co.,

The shortcode works fine with spreadsheets and docs but my issue is specific to embedding a form. This shortcode does not work when I put it on a page:

[gdoc link="https://docs.google.com/forms/d/1OKLqWr998a7iXE8X_df0PWhR-3E7OhWeEwQhqINMObo/viewform" height="800"]

Thanks, Jack

#16 Updated by Matt Gold almost 6 years ago

Hi Ray -- I'm confirming that this isn't working for forms. See this page. Screenshots of dashboard and published views attached. Live page here - http://cunyitconference.commons.gc.cuny.edu/submit-a-proposal/

#18 Updated by Raymond Hoh almost 6 years ago

  • Assignee changed from Boone Gorges to Raymond Hoh

Sorry guys, I didn't get an email notification about this.

I think Google Docs might have changed their form URLs, so I'll have to update the way I parse that information. Looking into it.

#19 Updated by Raymond Hoh almost 6 years ago

  • Status changed from Reporter Feedback to Assigned

#20 Updated by Matt Gold almost 6 years ago

Great - thanks, Ray.

André, any idea why Ray didn't receive an email notification?

#21 Updated by Raymond Hoh almost 6 years ago

I was removed as the assignee in comment:15 and then didn't receive subsequent email updates.

So I reassigned myself just now and am now receiving emails for this issue again.

#22 Updated by Matt Gold almost 6 years ago

Aha! Got it. thanks. André, I'll take you off of the watch list.

#23 Updated by Raymond Hoh almost 6 years ago

  • Status changed from Assigned to Resolved

Google Docs did update the Forms format. All newly-created Forms had a different form URL and this broke embedding for these new forms. Older forms continued to work.

Fortunately, this was an easy fix! Commit 0e7a984 should address this and will make its way into the next CAC release.

#24 Updated by Matt Gold almost 6 years ago

Awesome -- thanks, Ray! When the fix goes live, am I right to assume that everything should simply work without our having to change the embed code?

#25 Updated by Raymond Hoh almost 6 years ago

  • Tracker changed from Support to Bug

When the fix goes live, am I right to assume that everything should simply work without our having to change the embed code?

That's right! Let me know if it works.

#26 Updated by Matt Gold almost 6 years ago

Hi Ray -- I'm still seeing the issue here -- http://cunyitconference.commons.gc.cuny.edu/submit-a-proposal/ . Any ideas?

And Jack, are you still experience an issue?

#27 Updated by Raymond Hoh almost 6 years ago

Thanks for the report, Matt.

I looked at your shortcode:
[gdoc link="https://docs.google.com/spreadsheet/embeddedform?formkey=dDZOTlhUbnBwSTdiOWtJS0c0by1EQ2c6MA"]

It should be:
[gdoc link="https://docs.google.com/spreadsheet/viewform?formkey=dDZOTlhUbnBwSTdiOWtJS0c0by1EQ2c6MA"]

Let me know if these instructions need amending:
https://github.com/cuny-academic-commons/google-docs-shortcode#embedding-a-form

#28 Updated by Jen Jack Gieseking almost 6 years ago

Thanks, Ray! This works beautifully for my form: http://justpublics365.commons.gc.cuny.edu/mediacamp-august/.

FYI: I used the following shortcode and it worked perfectly:
[gdoc link="https://docs.google.com/forms/d/1OKLqWr998a7iXE8X_df0PWhR-3E7OhWeEwQhqINMObo/edit"]

#29 Updated by Matt Gold almost 6 years ago

Ray, that code didn't work for me. Jack, where/how did you find that link code on the form?

#30 Updated by Jen Jack Gieseking almost 6 years ago

Matt, I grabbed the code from the browser so the form I was working on is located at:
https://docs.google.com/forms/d/1OKLqWr998a7iXE8X_df0PWhR-3E7OhWeEwQhqINMObo/edit.

I believe the "spreadsheet" code you are loading may be the data from the form instead of the form itself. Possible?

#31 Updated by Matt Gold almost 6 years ago

Okay, so there are two things that I don't understand here:

1. Ray, why is Jack's shortcode working when it doesn't seem to match the setup that you put together?

2. Why is my own attempt to match Jack's code - [gdoc link="https://docs.google.com/forms/d/dDZOTlhUbnBwSTdiOWtJS0c0by1EQ2c6MA"] - not working? I'm getting the form code from the public URL of the form, as Jack did - https://docs.google.com/spreadsheet/viewform?fromEmail=true&formkey=dDZOTlhUbnBwSTdiOWtJS0c0by1EQ2c6MA

Thanks for your help.

#32 Updated by Raymond Hoh almost 6 years ago

Jack's code is different because that form is based off a newer iteration of Google Docs Forms. Your form is based off an older version of Google Docs Forms. My shortcode plugin should support both.

Can I ask if you checked out these instructions and if they are clear enough?
https://github.com/cuny-academic-commons/google-docs-shortcode#embedding-a-form

About why your shortcode is not working, maybe Google Docs Shortcode is not enabled on your subsite? Can you double-check? I tested your shortcode and it works on my site. I've attached a screenshot.

#33 Updated by Matt Gold almost 6 years ago

Aha -- I thought the shortcode was activated automatically, so I never enabled it. Everything is working now, and the directions are clear. Many thanks.

Also available in: Atom PDF