Added function to append http scheme to member videos stripped from member desc
authorlaury <laury@gaslightmedia.com>
Fri, 22 Jul 2016 15:29:20 +0000 (11:29 -0400)
committerlaury <laury@gaslightmedia.com>
Fri, 22 Jul 2016 15:29:20 +0000 (11:29 -0400)
models/admin/management/videos.php
models/front/members/detail.php
setup/adminHooks.php

index bac41a8..cc06d80 100644 (file)
@@ -138,7 +138,7 @@ class GlmMembersAdmin_management_videos
                         }
                         $sqlUpdate = "
                         UPDATE " . GLM_MEMBERS_PLUGIN_DB_PREFIX . "member_info
-                           SET video_url='" . $srcMatches[0] . "'
+                           SET video_url='" . $this->addScheme($srcMatches[0]) . "'
                             WHERE id='" . $member['id'] . "'";
                         $this->wpdb->query($sqlUpdate);
                         
index 09fab02..a572b81 100644 (file)
@@ -295,7 +295,7 @@ class GlmMembersFront_members_detail extends GlmDataMemberInfo
             // Create embed code based on video type. Parse the url for the proper code.
             //  - 1 = youtube
             //  - 2 = vimeo
-            $video_url = $memberData['video_url'];
+            $video_url = $this->addScheme($memberData['video_url']);
             
             if (strpos($video_url, 'youtube') !== false) {
                 if (strpos($video_url, 'embed') !== false) {
index 157dd99..23a750a 100644 (file)
@@ -104,5 +104,13 @@ if(!empty($locations))
 //        ));
 //    }
 //}
+
+if (!function_exists('addScheme')) {
+    function addScheme($url, $scheme = 'http://')
+    {
+      return parse_url($url, PHP_URL_SCHEME) === null ?
+        $scheme . $url : $url;
+    }
+}
  
 ?>
\ No newline at end of file