From: laury Date: Wed, 20 Jul 2016 13:17:53 +0000 (-0400) Subject: Iframe videos are now deleted from the description field in admin X-Git-Tag: v2.3.0^2~1^2~4 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=a63b40c677e39daf119a1f5faf9d49aeb4e0d086;p=WP-Plugins%2Fglm-member-db.git Iframe videos are now deleted from the description field in admin Whenever a video is taken from the iframe in the description field, it is now deleted from it after the video_url is updated. --- diff --git a/models/admin/management/videos.php b/models/admin/management/videos.php index 1e71a4a9..e6eb1f63 100644 --- a/models/admin/management/videos.php +++ b/models/admin/management/videos.php @@ -120,7 +120,7 @@ class GlmMembersAdmin_management_videos $sql = " SELECT id,descr,video_url FROM " . GLM_MEMBERS_PLUGIN_DB_PREFIX . "member_info - WHERE descr like '%youtube.com/embed%' + WHERE descr like '%youtube.com/embed%' ORDER BY id"; $results = $this->wpdb->get_results( $sql, ARRAY_A ); //echo '
$results: ' . print_r($results, true) . '
'; @@ -136,6 +136,20 @@ class GlmMembersAdmin_management_videos if ( preg_match( '%youtube.com/embed/([^?"]*)%', $matches[1], $srcMatches ) ) { echo '
$srcMatches: ' . print_r($srcMatches, true) . '
'; } + $sqlUpdate = " + UPDATE " . GLM_MEMBERS_PLUGIN_DB_PREFIX . "member_info + SET video_url='" . $srcMatches[0] . "' + WHERE id='" . $member['id'] . "'"; + $this->wpdb->query($sqlUpdate); + + $filteredString = str_replace($iframeCode,"",$descr); + + $sqlDelete = " + UPDATE " . GLM_MEMBERS_PLUGIN_DB_PREFIX . "member_info + SET descr='" . $filteredString . "' + WHERE id='" . $member['id'] . "'"; + $this->wpdb->query($sqlDelete); + //$resultMessage .= '
$matches: ' . print_r($matches, true) . '
'; } } @@ -151,7 +165,7 @@ class GlmMembersAdmin_management_videos ORDER BY id"; $count = $this->wpdb->get_var( $sql ); //echo '
$count: ' . print_r($count, true) . '
'; - $resultMessage = "There are {$count} Members with embed code in their descr field."; + $resultMessage = "There are {$count} Members with embedded youtube code in their descr field."; break; }