From: Laury GvR Date: Fri, 26 Feb 2016 18:00:45 +0000 (-0500) Subject: Adding the Option switch, default option, select current vals X-Git-Tag: v1.0.0^2~17 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/index.cgi?a=commitdiff_plain;h=5f3d5a415873a9664570a6e5a65baff92ce5923b;p=WP-Plugins%2Fglm-member-db-social.git Adding the Option switch, default option, select current vals --- diff --git a/models/admin/member/social.php b/models/admin/member/social.php index b13e242..415bfe0 100644 --- a/models/admin/member/social.php +++ b/models/admin/member/social.php @@ -185,7 +185,7 @@ class GlmMembersAdmin_member_social extends GlmDataSocial if (isset($_REQUEST['option'])) { $option = trim(filter_var($_REQUEST['option'],FILTER_SANITIZE_STRING)); } else { - echo "FAIL option REQUEST"; + $option = "default"; } if (isset($_REQUEST['socialname-facebook'])) { $socialUrl = trim(filter_var($_REQUEST['socialname-facebook'],FILTER_SANITIZE_STRING)); @@ -250,41 +250,59 @@ class GlmMembersAdmin_member_social extends GlmDataSocial ); } + + + switch ($option) { + case "submit": + // if (isset($_REQUEST['option']) && $_REQUEST['option'] == 'submit') { -// if (isset($_REQUEST['option']) && $_REQUEST['option'] == 'submit') { - if ($option == 'submit') { - - $socialData = $this->updateEntry($memberID); + $socialData = $this->updateEntry($memberID); - if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) { - glmMembersAdmin::addNotice("  Social Update: $memberID", 'Process'); - } -// echo $option; -// echo $socialUrl; -// echo $memberID; - // If update was successful then use editEntry() to setup for the edit again. - if ($socialData) { - $social = 'facebook'; - $socialData = $this->editEntry($memberID); - $socialUpdated = true; + if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) { + glmMembersAdmin::addNotice("  Social Update: $memberID", 'Process'); + } + // echo $option; + // echo $socialUrl; + // echo $memberID; + // If update was successful then use editEntry() to setup for the edit again. + if ($socialData) { + $social = 'facebook'; + $socialData = $this->editEntry($memberID); + $socialUpdated = true; - // Also update all member info records with any possible name change - $sql = " - INSERT INTO ".GLM_MEMBERS_SOCIAL_PLUGIN_DB_PREFIX."socialURL - (member_id,".$social."_url) - VALUES (".$memberID.", '".$socialUrl."') - ;"; - echo "
".$sql."
"; - $sql2 = " - UPDATE ".GLM_MEMBERS_SOCIAL_PLUGIN_DB_PREFIX."socialURL - SET ".$social."_url = '".$socialUrl."' - WHERE member_id = $memberID + // Also update all member info records with any possible name change + $sql = " + INSERT INTO ".GLM_MEMBERS_SOCIAL_PLUGIN_DB_PREFIX."socialURL + (member_id,".$social."_url) + VALUES (".$memberID.", '".$socialUrl."') ;"; - echo "
".$sql2."
"; - $this->wpdb->query($sql); - $this->wpdb->query($sql2); + echo "
".$sql."
"; + $sql2 = " + UPDATE ".GLM_MEMBERS_SOCIAL_PLUGIN_DB_PREFIX."socialURL + SET ".$social."_url = '".$socialUrl."' + WHERE member_id = $memberID + ;"; + echo "
".$sql2."
"; + $this->wpdb->query($sql); + $this->wpdb->query($sql2); - } + } + break; + default: + $sql = " + SELECT * + FROM ".GLM_MEMBERS_SOCIAL_PLUGIN_DB_PREFIX."socialURL + ;"; + $existingUrls = $this->wpdb->get_results($sql, ARRAY_A); + echo ""; + foreach($existingUrls[0] as $key=>$value) { + echo(""); + } + echo "
$key$value
"; + echo "
";
+                var_dump($existingUrls);
+                echo "
"; + break; } // If we had a fatal error, redirect to the error page