Looking through the module, there appears to be no way to force https in the Instagram block. This is a problem for secure sites in that it throws a security warning and confuses the user in to thinking something is wrong with the site certificate. Is there a known solution for this?

Peace,
Michael Clendening

Comments

Anonymous’s picture

It looks the folks over in the Drupagram issue queue have already solved the https problem for their module. I am no developer, maybe someone here can take a look what they did and adapt it to this module.
https://www.drupal.org/node/1971098

Peace,
Michael Clendening

Anonymous’s picture

Anyone interested in getting Instagram Block working on secure pages? While I am not a programmer, it seems the recipe to get this working is over in the Drupagram queue.

Peace,
Michael Clendening

pix_’s picture

Hi mclendening
here's a quick patch that allows instagram_block to make https request when drupal is under https. I followed the same approach as Drupagram folks because looks quick and easy.
This patch should apply fine against both dev and current stable version (7.x-1.1).
Hope it helps!

joelpittet’s picture

Status: Active » Needs review
StatusFileSize
new1.12 KB

What about simply using // for the protocol and it will take the protocol that the site is using?

Saves from preg_match and the global. Also fixed a typo in the template.

joelpittet’s picture

StatusFileSize
new1.13 KB

well strtr didn't work as I expected, back to trusty str_replace() :) almost as fast.. (9% slower ish #microoptimization)

yanniboi’s picture

StatusFileSize
new1.36 KB

I like it, but I'm a bit weary of hardcoding the url scheme... Maybe something a little more like this?

joelpittet’s picture

Status: Needs review » Reviewed & tested by the community

That seems robust, I'm not sure the performance implications of parse_url() though I bet it's minor, specially if the block is showing 9 images.

For some reason your patch didn't apply with patch -p1... just applied it manually though to test.

joelpittet’s picture

Status: Reviewed & tested by the community » Needs work

Whoops spoke too soon, would you mind rerolling that @yanniboi?

+++ b/instagram_block.module
@@ -130,12 +130,15 @@ function instagram_block_block_view($delta = '') {
+          '#src' => str_replace($components['scheme'], '//', $url),

scheme doesn't have "://" so the url becomes: "//://scontent..."

yanniboi’s picture

Status: Needs work » Needs review
StatusFileSize
new1.37 KB

No problem! sorry about the cowboy coding, but I haven't got time atm to actually spin up a site an test myself :P

yanniboi’s picture

StatusFileSize
new1.35 KB

Patch (7) #9 no longer applies so I am re-rolling.

yanniboi’s picture

Status: Needs review » Reviewed & tested by the community

I am happy to commit this.

  • 2d60020 committed on 7.x-1.x
    Issue #2337769 by yanniboi, joelpittet, Pix_ | mclendening: Fixed Non-...
yanniboi’s picture

Status: Reviewed & tested by the community » Fixed
joelpittet’s picture

Thanks @yanniboi!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.