Utilizing the data abstract
authorLaury GvR <laury@gaslightmedia.com>
Thu, 10 Mar 2016 20:00:59 +0000 (15:00 -0500)
committerLaury GvR <laury@gaslightmedia.com>
Thu, 10 Mar 2016 20:00:59 +0000 (15:00 -0500)
16 files changed:
classes/data/dataRecords.php [new file with mode: 0644]
classes/data/dataSocial.php [deleted file]
classes/data/dataUrls.php [new file with mode: 0644]
models/admin/info/index.php [deleted file]
models/admin/member/social.php
models/admin/settings/social.php
models/admin/social/index.php [deleted file]
models/admin/social/more.php [deleted file]
setup/adminMenus.php
setup/databaseScripts/create_database_V0.0.1.sql
setup/validActions.php
views/admin/info/index.html [deleted file]
views/admin/member/social.html
views/admin/settings/social.html
views/admin/social/index.html [deleted file]
views/admin/social/more.html [deleted file]

diff --git a/classes/data/dataRecords.php b/classes/data/dataRecords.php
new file mode 100644 (file)
index 0000000..1ac163d
--- /dev/null
@@ -0,0 +1,203 @@
+<?php
+/**
+ * GLM Member-DB WordPress Add-On Plugin
+ * Data Class Social
+ *
+ * PHP version 5.3
+ *
+ * @category Data
+ * @package  GLM Member-DB
+ * @author   Gaslight Media <dev@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @release  SVN: $Id: dataSocial.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+/**********************************************************************
+ *  NOTE: THIS IS A SOCIAL FILE - DO NOT USE UNMODIFIED
+ *
+ *  Please change all references to social, Social, or SOCIAL to a name
+ *  appropriate for your new Add-On.
+ *
+ *  Data fields in this file are social only.
+ *
+ *  Remove this message before using this file in production!
+ **********************************************************************/
+
+// Member Info Data required
+require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMemberInfo.php');
+
+/**
+ * GlmDataRecords class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package GLM Member DB
+ * @author   Gaslight Media <dev@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ *          @release SVN: $Id: dataMembers.php,v 1.0 2011/01/25 19:31:47 cscott
+ *          Exp $
+ */
+class GlmDataRecords extends GlmDataAbstract
+{
+
+    /**
+     * WordPress Database Object
+     *
+     * @var $wpdb
+     * @access public
+     */
+    public $wpdb;
+    /**
+     * Plugin Configuration Data
+     *
+     * @var $config
+     * @access public
+     */
+    public $config;
+    /**
+     * Data Table Name
+     *
+     * @var $table
+     * @access public
+     */
+    public $table;
+    /**
+     * Field definitions
+     *
+     * 'type' is type of field as defined by the application
+     * text Regular text field
+     * pointer Pointer to an entry in another table
+     * 'filters' is the filter name for a particular filter ID in PHP filter
+     * functions
+     * See PHP filter_id()
+     *
+     * 'use' is when to use the field
+     * l = List
+     * g = Get
+     * n = New
+     * i = Insert
+     * e = Edit
+     * u = Update
+     * d = Delete
+     * a = All
+     *
+     * @var $ini
+     * @access public
+     */
+    public $fields = false;
+    /**
+     * MemberInfo DB object
+     *
+     * @var $MemberInfo
+     * @access public
+     */
+    public $MemberInfo;
+
+    /**
+     * Constructor
+     *
+     * @param object $d database connection
+     * @param array $config Configuration array
+     * @param bool $limitedEdit Flag to say indicate limited edit requested
+     *
+     * @return void
+     * @access public
+     */
+    public function __construct($wpdb, $config, $limitedEdit = false)
+    {
+
+        // If this class is not being extended along with existing $wpdb and $config
+        if (!$this->wpdb) {
+
+            // Save WordPress Database object
+            $this->wpdb = $wpdb;
+
+            // Save plugin configuration object
+            $this->config = $config;
+
+        }
+
+        /*
+         * Table Name
+         */
+        $this->table = GLM_MEMBERS_SOCIAL_PLUGIN_DB_PREFIX . 'records';
+
+        /*
+         * Table Data Fields
+         */
+
+        $this->fields = array (
+
+            // Social ID
+            'id' => array (
+                'field' => 'id',
+                'type' => 'integer',
+                'view_only' => true,
+                'use' => 'a'
+            ),
+
+            // Name of the social record
+            'name' => array (
+                'field' => 'name',
+                'type' => 'text',
+                'default' => true,
+                'use' => 'a'
+            ),
+            
+            // X Position of icon in sprite
+            'xpos' => array (
+                'field' => 'xpos',
+                'type' => 'integer',
+                'view_only' => true,
+                'use' => 'a'
+            ),
+
+            // Y Position of icon in sprite
+            'ypos' => array(
+                'field' => 'ypos',
+                'type' => 'integer',
+                'required' => true,
+                'use' => 'a'
+            ),
+
+            // Base url of the social record
+            'baseurl' => array(
+                'field' => 'baseurl',
+                'type' => 'text',
+                'required' => true,
+                'use' => 'a'
+            ),
+
+            // Active flag
+            'active' => array (
+                'field' => 'active',
+                'type' => 'checkbox',
+                'default' => true,
+                'use' => 'a'
+            )
+        );
+    }
+
+    /*
+     * Entry Post Processing Call-Back Method
+     *
+     * Perform post-processing for all result entries.
+     *
+     * In this case we're using it to append an array of category
+     * data to each member result and also sort by member name.
+     *
+     * @param array $r Array of field result data for a single entry
+     * @param string $a Action being performed (l, i, g, ...)
+     *
+     * @return object Class object
+     *
+     */
+    public function entryPostProcessing($r, $a)
+    {
+        return $r;
+    }
+
+}
+
+?>
\ No newline at end of file
diff --git a/classes/data/dataSocial.php b/classes/data/dataSocial.php
deleted file mode 100644 (file)
index 4f1b998..0000000
+++ /dev/null
@@ -1,172 +0,0 @@
-<?php
-/**
- * GLM Member-DB WordPress Add-On Plugin
- * Data Class Social
- *
- * PHP version 5.3
- *
- * @category Data
- * @package  GLM Member-DB
- * @author   Gaslight Media <dev@gaslightmedia.com>
- * @license  http://www.gaslightmedia.com Gaslightmedia
- * @release  SVN: $Id: dataSocial.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
- */
-
-/**********************************************************************
- *  NOTE: THIS IS A SOCIAL FILE - DO NOT USE UNMODIFIED
- *
- *  Please change all references to social, Social, or SOCIAL to a name
- *  appropriate for your new Add-On.
- *
- *  Data fields in this file are social only.
- *
- *  Remove this message before using this file in production!
- **********************************************************************/
-
-// Member Info Data required
-require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMemberInfo.php');
-
-/**
- * GlmDataSocial class
- *
- * PHP version 5
- *
- * @category Data
- * @package GLM Member DB
- * @author   Gaslight Media <dev@gaslightmedia.com>
- * @license http://www.gaslightmedia.com Gaslightmedia
- *          @release SVN: $Id: dataMembers.php,v 1.0 2011/01/25 19:31:47 cscott
- *          Exp $
- */
-class GlmDataSocial extends GlmDataAbstract
-{
-
-    /**
-     * WordPress Database Object
-     *
-     * @var $wpdb
-     * @access public
-     */
-    public $wpdb;
-    /**
-     * Plugin Configuration Data
-     *
-     * @var $config
-     * @access public
-     */
-    public $config;
-    /**
-     * Data Table Name
-     *
-     * @var $table
-     * @access public
-     */
-    public $table;
-    /**
-     * Field definitions
-     *
-     * 'type' is type of field as defined by the application
-     * text Regular text field
-     * pointer Pointer to an entry in another table
-     * 'filters' is the filter name for a particular filter ID in PHP filter
-     * functions
-     * See PHP filter_id()
-     *
-     * 'use' is when to use the field
-     * l = List
-     * g = Get
-     * n = New
-     * i = Insert
-     * e = Edit
-     * u = Update
-     * d = Delete
-     * a = All
-     *
-     * @var $ini
-     * @access public
-     */
-    public $fields = false;
-    /**
-     * MemberInfo DB object
-     *
-     * @var $MemberInfo
-     * @access public
-     */
-    public $MemberInfo;
-
-    /**
-     * Constructor
-     *
-     * @param object $d database connection
-     * @param array $config Configuration array
-     * @param bool $limitedEdit Flag to say indicate limited edit requested
-     *
-     * @return void
-     * @access public
-     */
-    public function __construct($wpdb, $config, $limitedEdit = false)
-    {
-
-        // If this class is not being extended along with existing $wpdb and $config
-        if (!$this->wpdb) {
-
-            // Save WordPress Database object
-            $this->wpdb = $wpdb;
-
-            // Save plugin configuration object
-            $this->config = $config;
-
-        }
-
-        /*
-         * Table Name
-         */
-        $this->table = GLM_MEMBERS_SOCIAL_PLUGIN_DB_PREFIX . 'socialtable';
-
-        /*
-         * Table Data Fields
-         */
-
-        $this->fields = array (
-
-            'id' => array (
-                'field' => 'id',
-                'type' => 'integer',
-                'view_only' => true,
-                'use' => 'a'
-            ),
-
-            // Active flag
-            'active' => array (
-                'field' => 'active',
-                'type' => 'checkbox',
-                'default' => true,
-                'use' => 'a'
-            )
-
-         );
-
-    }
-
-    /*
-     * Entry Post Processing Call-Back Method
-     *
-     * Perform post-processing for all result entries.
-     *
-     * In this case we're using it to append an array of category
-     * data to each member result and also sort by member name.
-     *
-     * @param array $r Array of field result data for a single entry
-     * @param string $a Action being performed (l, i, g, ...)
-     *
-     * @return object Class object
-     *
-     */
-    public function entryPostProcessing($r, $a)
-    {
-        return $r;
-    }
-
-}
-
-?>
\ No newline at end of file
diff --git a/classes/data/dataUrls.php b/classes/data/dataUrls.php
new file mode 100644 (file)
index 0000000..f0e16db
--- /dev/null
@@ -0,0 +1,258 @@
+<?php
+/**
+ * GLM Member-DB WordPress Add-On Plugin
+ * Data Class Social
+ *
+ * PHP version 5.3
+ *
+ * @category Data
+ * @package  GLM Member-DB
+ * @author   Gaslight Media <dev@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @release  SVN: $Id: dataSocial.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+/**********************************************************************
+ *  NOTE: THIS IS A SOCIAL FILE - DO NOT USE UNMODIFIED
+ *
+ *  Please change all references to social, Social, or SOCIAL to a name
+ *  appropriate for your new Add-On.
+ *
+ *  Data fields in this file are social only.
+ *
+ *  Remove this message before using this file in production!
+ **********************************************************************/
+
+// Member Info Data required
+require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMemberInfo.php');
+
+/**
+ * GlmDataUrls class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package GLM Member DB
+ * @author   Gaslight Media <dev@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ *          @release SVN: $Id: dataMembers.php,v 1.0 2011/01/25 19:31:47 cscott
+ *          Exp $
+ */
+class GlmDataUrls extends GlmDataAbstract
+{
+
+    /**
+     * WordPress Database Object
+     *
+     * @var $wpdb
+     * @access public
+     */
+    public $wpdb;
+    /**
+     * Plugin Configuration Data
+     *
+     * @var $config
+     * @access public
+     */
+    public $config;
+    /**
+     * Data Table Name
+     *
+     * @var $table
+     * @access public
+     */
+    public $table;
+    /**
+     * Field definitions
+     *
+     * 'type' is type of field as defined by the application
+     * text Regular text field
+     * pointer Pointer to an entry in another table
+     * 'filters' is the filter name for a particular filter ID in PHP filter
+     * functions
+     * See PHP filter_id()
+     *
+     * 'use' is when to use the field
+     * l = List
+     * g = Get
+     * n = New
+     * i = Insert
+     * e = Edit
+     * u = Update
+     * d = Delete
+     * a = All
+     *
+     * @var $ini
+     * @access public
+     */
+    public $fields = false;
+    /**
+     * MemberInfo DB object
+     *
+     * @var $MemberInfo
+     * @access public
+     */
+    public $MemberInfo;
+
+    /**
+     * Constructor
+     *
+     * @param object $d database connection
+     * @param array $config Configuration array
+     * @param bool $limitedEdit Flag to say indicate limited edit requested
+     *
+     * @return void
+     * @access public
+     */
+    public function __construct($wpdb, $config, $limitedEdit = false)
+    {
+
+        // If this class is not being extended along with existing $wpdb and $config
+        if (!$this->wpdb) {
+
+            // Save WordPress Database object
+            $this->wpdb = $wpdb;
+
+            // Save plugin configuration object
+            $this->config = $config;
+
+        }
+
+        /*
+         * Table Name
+         */
+        $this->table = GLM_MEMBERS_SOCIAL_PLUGIN_DB_PREFIX . 'urls';
+
+        /*
+         * Table Data Fields
+         */
+
+        $this->fields = array (
+
+            // Social ID
+            'id' => array (
+                'field' => 'id',
+                'type' => 'integer',
+                'view_only' => true,
+                'use' => 'a'
+            ),
+
+            // The member's URL for facebook
+            'facebook' => array (
+                'field' => 'facebook',
+                'type' => 'text',
+                'default' => true,
+                'use' => 'a'
+            ),
+            // The member's URL for twitter
+            'twitter' => array (
+                'field' => 'twitter',
+                'type' => 'text',
+                'default' => true,
+                'use' => 'a'
+            ),
+            
+            // The member's URL for pinterest
+            'pinterest' => array (
+                'field' => 'pinterest',
+                'type' => 'text',
+                'default' => true,
+                'use' => 'a'
+            ),
+            
+            // The member's URL for googleplus
+            'googleplus' => array (
+                'field' => 'googleplus',
+                'type' => 'text',
+                'default' => true,
+                'use' => 'a'
+            ),
+            
+            // The member's URL for digg
+            'digg' => array (
+                'field' => 'digg',
+                'type' => 'text',
+                'default' => true,
+                'use' => 'a'
+            ),
+            
+            // The member's URL for linkedin
+            'linkedin' => array (
+                'field' => 'linkedin',
+                'type' => 'text',
+                'default' => true,
+                'use' => 'a'
+            ),
+            
+            // The member's URL for instagram
+            'instagram' => array (
+                'field' => 'instagram',
+                'type' => 'text',
+                'default' => true,
+                'use' => 'a'
+            ),
+            
+            // The member's URL for rss
+            'rss' => array (
+                'field' => 'rss',
+                'type' => 'text',
+                'default' => true,
+                'use' => 'a'
+            ),
+            
+            // The member's URL for youtube
+            'youtube' => array (
+                'field' => 'youtube',
+                'type' => 'text',
+                'default' => true,
+                'use' => 'a'
+            ),
+            
+            // The member's URL for flickr
+            'flickr' => array (
+                'field' => 'flickr',
+                'type' => 'text',
+                'default' => true,
+                'use' => 'a'
+            ),
+            
+            // The member's URL for blog
+            'blog' => array (
+                'field' => 'blog',
+                'type' => 'text',
+                'default' => true,
+                'use' => 'a'
+            ),
+            
+            // The member's URL for photobucket
+            'photobucket' => array (
+                'field' => 'photobucket',
+                'type' => 'text',
+                'default' => true,
+                'use' => 'a'
+            )
+        );
+    }
+
+    /*
+     * Entry Post Processing Call-Back Method
+     *
+     * Perform post-processing for all result entries.
+     *
+     * In this case we're using it to append an array of category
+     * data to each member result and also sort by member name.
+     *
+     * @param array $r Array of field result data for a single entry
+     * @param string $a Action being performed (l, i, g, ...)
+     *
+     * @return object Class object
+     *
+     */
+    public function entryPostProcessing($r, $a)
+    {
+        return $r;
+    }
+
+}
+
+?>
\ No newline at end of file
diff --git a/models/admin/info/index.php b/models/admin/info/index.php
deleted file mode 100644 (file)
index 2440b68..0000000
+++ /dev/null
@@ -1,125 +0,0 @@
-<?php
-/**
- * Gaslight Media Members Database
- * Admin Member User Profile
- *
- * PHP version 5.5
- *
- * @category glmWordPressPlugin
- * @package  glmMembersDatabase
- * @author   Gaslight Media <dev@gaslightmedia.com>
- * @license  http://www.gaslightmedia.com Gaslightmedia
- * @release  index.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
- * @link     http://dev.gaslightmedia.com/
- */
-
-// Load Contacts data abstract
-//require_once(GLM_MEMBERS_CONTACTS_PLUGIN_CLASS_PATH.'/data/dataContacts.php');
-
-class GlmMembersAdmin_info_index // extends GlmDataContacts
-{
-
-    /**
-     * WordPress Database Object
-     *
-     * @var $wpdb
-     * @access public
-     */
-    public $wpdb;
-    /**
-     * Plugin Configuration Data
-     *
-     * @var $config
-     * @access public
-     */
-    public $config;
-    /**
-     * Contact Info
-     *
-     * @var $contactInfo
-     * @access public
-     */
-    public $contactInfo = false;
-    /**
-     * Member ID
-     *
-     * @var $memberID
-     * @access public
-     */
-    public $memberID = false;
-    /**
-     * Contact ID
-     *
-     * @var $contactID
-     * @access public
-     */
-    public $contactID = false;
-
-
-    /*
-     * Constructor
-     *
-     * This contructor performs the work for this model. This model returns
-     * an array containing the following.
-     *
-     * 'status'
-     *
-     * True if successfull and false if there was a fatal failure.
-     *
-     * 'view'
-     *
-     * A suggested view name that the contoller should use instead of the
-     * default view for this model or false to indicate that the default view
-     * should be used.
-     *
-     * 'data'
-     *
-     * Data that the model is returning for use in merging with the view to
-     * produce output.
-     *
-     * @wpdb object WordPress database object
-     *
-     * @return array Array containing status, suggested view, and any data
-     */
-    public function __construct ($wpdb, $config)
-    {
-
-        // Save WordPress Database object
-        $this->wpdb = $wpdb;
-
-        // Save plugin configuration object
-        $this->config = $config;
-
-        /*
-         * Run constructor for the Contacts data class
-         *
-         * Note, the third parameter is a flag that indicates to the Contacts
-         * data class that it should flag a group of fields as 'view_only'.
-         */
-//        parent::__construct(false, false, true);
-
-
-    }
-
-    public function modelAction($actionData = false)
-    {
-
-        $displayData = 'This is the Social Add-On "Info" model talking to you from inside WordPress.';
-
-        // Compile template data
-        $templateData = array(
-            'displayData' => $displayData
-        );
-
-        // Return status, any suggested view, and any data to controller
-        return array(
-                'status' => true,
-                'modelRedirect' => false,
-                'view' => 'admin/info/index.html',
-                'data' => $templateData
-        );
-
-    }
-
-
-}
index e898656..20a3236 100644 (file)
@@ -14,9 +14,9 @@
  */
 
 // Load Contacts data abstract
-require_once(GLM_MEMBERS_SOCIAL_PLUGIN_CLASS_PATH.'/data/dataSocial.php');
+require_once(GLM_MEMBERS_SOCIAL_PLUGIN_CLASS_PATH.'/data/dataUrls.php');
 
-class GlmMembersAdmin_member_social extends GlmDataSocial
+class GlmMembersAdmin_member_social extends GlmDataUrls
 {
     
     /**
@@ -103,23 +103,23 @@ class GlmMembersAdmin_member_social extends GlmDataSocial
 
     
     
-    public function updateUrlList(&$existingUrls) {        
-        $getExistingUrls = "
-            SELECT * 
-            FROM ".GLM_MEMBERS_SOCIAL_PLUGIN_DB_PREFIX."media_urls
-            ;";
-        $existingUrls = $this->wpdb->get_results($getExistingUrls, ARRAY_A);
-//        $existingUrls = $queryUrls[0];
-        return;
-    }
+//    public function updateUrlList(&$existingUrls) {        
+//        $getExistingUrls = "
+//            SELECT * 
+//            FROM ".GLM_MEMBERS_SOCIAL_PLUGIN_DB_PREFIX."urls
+//            ;";
+//        $existingUrls = $this->wpdb->get_results($getExistingUrls, ARRAY_A);
+////        $existingUrls = $queryUrls[0];
+//        return;
+//    }
     
-    public function printSocialList(&$array,$name="Array list") {
-        echo "<hr />$name:<table>";
-        foreach($array[0] as $key=>$value) {
-            echo("<tr><td>$key</td><td>$value</td></tr>");
-        }
-        echo "</table>";
-    }
+//    public function printSocialList(&$array,$name="Array list") {
+//        echo "<hr />$name:<table>";
+//        foreach($array[0] as $key=>$value) {
+//            echo("<tr><td>$key</td><td>$value</td></tr>");
+//        }
+//        echo "</table>";
+//    }
     
     public function modelAction($actionData = false)
     {
@@ -129,40 +129,33 @@ class GlmMembersAdmin_member_social extends GlmDataSocial
         $socialUpdated = false;
         $haveMember = false;
         $socialError = false;
-        $newSocial = false;
         $option = false;
         $debug = true;
-
-        // The above array needs to be inserted into the Database
-        $getExistingSocials = "
-            SELECT * 
-            FROM ".GLM_MEMBERS_SOCIAL_PLUGIN_DB_PREFIX."media_record
-            ;";
-        $existingSocials = $this->wpdb->get_results($getExistingSocials, ARRAY_A);
-        $getExistingUrls = "
-            SELECT * 
-            FROM ".GLM_MEMBERS_SOCIAL_PLUGIN_DB_PREFIX."media_urls
-            ;";
-        $existingUrls = $this->wpdb->get_results($getExistingUrls, ARRAY_A);
-        // If there's an action option
+        $statusMessage = "debug mode";
+        
+        $Urls = new GlmDataUrls($this->wpdb, $this->config);
+        $urlStats = $Urls->getStats();
+        $haveUrls = ($urlStats > 0);
+        
+        if ($urlStats && $urlStats > 0) {
+            $haveUrls = true;
+        }
+        
+        $urlList = $Urls->getList();
+        
+        require_once(GLM_MEMBERS_SOCIAL_PLUGIN_CLASS_PATH.'/data/dataRecords.php');
+        $Records = new GlmDataRecords($this->wpdb, $this->config);
+        
         if (isset($_REQUEST['option'])) {
             $option = trim(filter_var($_REQUEST['option'],FILTER_SANITIZE_STRING));
         } else {
             $option = "default";
         }
-
-        echo "<hr />Request:<table>";
-        foreach($_REQUEST as $key=>$value) {
-            echo("<tr><td>$key</td><td>$value</td></tr>");
-        }
-        echo "</table>";
         
-//        $formUrls = array_filter($_REQUEST, function($k) {
-//            return preg_match('/^socialname-/',$k);
-//        }, ARRAY_FILTER_USE_KEY);
-
+        $recordList = $Records->getList();
+        
         // Get the Member ID
-        $memberID = 0;
+        $memberID = '0';
         if (isset($_REQUEST['member']) && ($_REQUEST['member']-0) > 0) {
             $memberID = $_REQUEST['member'] - 0;
         }
@@ -175,70 +168,36 @@ class GlmMembersAdmin_member_social extends GlmDataSocial
                 'view' => 'admin/error/index.html',
                 'data' => false
             );
-
         }
         
+        echo "<hr />Request:<table>";
+        foreach($_REQUEST as $key=>$value) {
+            echo("<tr><td>$key</td><td>$value</td></tr>");
+        }
+        echo "</table>";
+        echo "<hr />UrlList:<table>";
+        echo "<pre>".print_r($urlList[$memberID], true)."</pre>";
+        echo "</table>";
+
+        if (!$Urls->getEntry($memberID)){
+            $sql = "
+                INSERT INTO ".$Urls->table."
+                    (id)
+                    VALUES ($memberID)
+            ;";
+            $this->wpdb->query($sql);
+            echo "sql: $sql";
+        }
+
         switch ($option) {
             case "submit":
-                if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
-                    glmMembersAdmin::addNotice("<b>&nbsp;&nbsp;Social Update:</b> $memberID", 'Process');
-                }
+                $Urls->updateEntry($memberID);
+                
                 
-                // Refresh the list of URLs based on the Database values
-                $this->updateUrlList($existingUrls);
-                if ($debug) {
-                    $this->printSocialList($existingUrls,"Existing Urls Pre Submit");
-                }
-                $socialUpdated = false;
-                $statusMessage="";
                 
-                foreach($existingUrls[0] as $social=>$socialUrl) {
-                    // Reset the query
-                    $sql = "";
-                    
-                    // Grab the URL for the current Social Media from the form
-                    if (isset($_REQUEST['socialname-'.$social])) {
-                        $formUrl = trim(filter_var($_REQUEST['socialname-'.$social],FILTER_SANITIZE_STRING));
-                    } else {
-                        $formUrl = 1;
-                        if ($debug) {
-                            echo "<div>FAILED socialUrl REQUEST for ".$social."</div>";
-                        }
-                    }
-                    if ($socialUrl == 1 || $formUrl == $socialUrl || $formUrl == 1) {
-                        // If it encounters the Member ID from the DB, the error code for the form, 
-                        // or the form does not differ from the database: skip this iteration
-                        continue;
-                    } else {
-                        $sql = "
-                            UPDATE ".GLM_MEMBERS_SOCIAL_PLUGIN_DB_PREFIX."media_urls
-                               SET ".$social." = '".$formUrl."'
-                             WHERE member_id = $memberID
-                        ;";
-                        $statusMessage = "The selected social links have been updated.";
-                        $socialUpdated = true;
-                        $this->wpdb->query($sql);
-                    }
-                    if ($socialUpdated) {
-                        echo "<hr><div>".$statusMessage."</div>";
-                        if ($debug){
-                            echo "<div>Social:".$social."</div>";
-                            echo "<div>Social url:".$socialUrl."</div>";
-                            echo "<div>statement:".$sql."</div>";
-                        } 
-                    }
-                }               
-                if ($debug) {
-                    $this->updateUrlList($existingUrls);
-                    $this->printSocialList($existingUrls,"Existing Urls Post Submit");
-                }
                 break;
             case "social";    
             default:
-                if ($debug) {
-                    $this->updateUrlList($existingUrls);
-                    $this->printSocialList($existingUrls,"Existing Urls Default:");
-                }
                 break;
         }
         
@@ -254,23 +213,16 @@ class GlmMembersAdmin_member_social extends GlmDataSocial
             );
         }
 
-        if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
-            glmMembersAdmin::addNotice($memberTypes, 'DataBlock', 'Member Types Data');
-        }
-        // Refresh the URL list before sending it to the front
-        $this->updateUrlList($existingUrls);
-        // Compile template data
         $templateData = array(
             'displayData' => $displayData,
-            'existingSocials' => $existingSocials,
+            'socials' => $recordList,
+            'urlList' => $urlList[$memberID],
             'assetsUrl' => GLM_MEMBERS_SOCIAL_PLUGIN_ASSETS_URL,
-            'socials' => $socials,
             'socialUpdated' => $socialUpdated,
             'socialError' => $socialError,
             'haveMember' => $haveMember,
             'memberID' => $memberID,
             'option' => $option,
-            'existingUrls' => $existingUrls[0],
             'statusMessage' => $statusMessage
         );
 
index 1276e59..adb6a8a 100644 (file)
@@ -71,59 +71,56 @@ class GlmMembersAdmin_settings_social // extends GlmDataContacts
         // Save plugin configuration object
         $this->config = $config;
 
-        /*
-         * Run constructor for the Contacts data class
-         *
-         * Note, the third parameter is a flag that indicates to the Contacts
-         * data class that it should flag a group of fields as 'view_only'.
-         */
-//        parent::__construct(false, false, true);
-
-
     }
 
     
     
-    public function updateSocialList(&$existingSocials) {        
-        $getExistingSocials = "
-            SELECT * 
-            FROM ".GLM_MEMBERS_SOCIAL_PLUGIN_DB_PREFIX."media_record
-            ;";
-        $existingSocials = $this->wpdb->get_results($getExistingSocials, ARRAY_A);
-    }
-    
-    public function printSocialList($array,$name="Array list") {
-        echo "<hr />$name<table>";
-        $i = 0;
-        foreach($array as $key=>$socialRecord) {
-            foreach($socialRecord as $recordKey=>$recordValue)
-            echo("<tr><td>$recordKey</td><td>$recordValue</td></tr>");
-            $i++;
-        }
-        echo "</table><hr>";
-    }
+//    public function updateSocialList(&$existingSocials) {        
+//        $getExistingSocials = "
+//            SELECT * 
+//            FROM ".GLM_MEMBERS_SOCIAL_PLUGIN_DB_PREFIX."media_records
+//            ;";
+//        $existingSocials = $this->wpdb->get_results($getExistingSocials, ARRAY_A);
+//    }
+//    
+//    public function printSocialList($array,$name="Array list") {
+//        echo "<hr />$name<table>";
+//        $i = 0;
+//        foreach($array as $key=>$socialRecord) {
+//            foreach($socialRecord as $recordKey=>$recordValue)
+//            echo("<tr><td>$recordKey</td><td>$recordValue</td></tr>");
+//            $i++;
+//        }
+//        echo "</table><hr>";
+//    }
     
     public function modelAction($actionData = false)
     {
         $displayData = 'Hello, World! This is the Social Add-On "settings" model talking to you from inside WordPress.';
         $success = true;
-        $socials = false;
         $socialUpdated = false;
         $socialError = false;
         $option = false;
         $debug = true;
         $statusMessage = 'Social Updated';
-        $getExistingSocials = "
-            SELECT * 
-            FROM ".GLM_MEMBERS_SOCIAL_PLUGIN_DB_PREFIX."media_record
-            ;";
-        $existingSocials = $this->wpdb->get_results($getExistingSocials, ARRAY_A);
+//        $getExistingSocials = "
+//            SELECT * 
+//            FROM ".GLM_MEMBERS_SOCIAL_PLUGIN_DB_PREFIX."media_records
+//            ;";
+//        $existingSocials = $this->wpdb->get_results($getExistingSocials, ARRAY_A);
         // If there's an action option
         if (isset($_REQUEST['option'])) {
             $option = trim(filter_var($_REQUEST['option'],FILTER_SANITIZE_STRING));
         } else {
             $option = "default";
         }
+        
+        $socials = new GlmDataSocial($this->wpdb, $this->config);
+        $socialInfo = $socials->getEntry();
+        
+        
+        $urls = new GlmDataUrls($this->wpdb, $this->config);
+        $urlList = $urls->getEntry($memberID);
 
         echo "<hr />Request:<table>";
         foreach($_REQUEST as $socialRecord=>$value) {
@@ -142,19 +139,19 @@ class GlmMembersAdmin_settings_social // extends GlmDataContacts
                     $sql = "";
                     
                     $recordBool = $socialRecord['active'];
-                    if(isset($_REQUEST['checkname-'.strtolower($socialRecord['social_name'])])){
+                    if(isset($_REQUEST['checkname-'.strtolower($socialRecord['name'])])){
                         $socialBool = 1;
                     } else {
                         $socialBool = 0;
                     }
-//                    echo " | checkname-".strtolower($socialRecord['social_name'])." | ";
-//                    $socialChecked = $_REQUEST['checkname-'.strtolower($socialRecord['social_name'])];
+//                    echo " | checkname-".strtolower($socialRecord['name'])." | ";
+//                    $socialChecked = $_REQUEST['checkname-'.strtolower($socialRecord['name'])];
                     if ($socialBool != $recordBool) {
                         echo " - Unequal, rec:$recordBool and soc:$socialBool<hr>";
                             $sql = "
-                            UPDATE ".GLM_MEMBERS_SOCIAL_PLUGIN_DB_PREFIX."media_record
+                            UPDATE ".GLM_MEMBERS_SOCIAL_PLUGIN_DB_PREFIX."media_records
                             SET active = $socialBool
-                            WHERE social_id = ".$socialRecord['social_id']."
+                            WHERE id = ".$socialRecord['id']."
                         ;";                    
                         $socialUpdated = true;
                         $this->wpdb->query($sql);
@@ -204,7 +201,6 @@ class GlmMembersAdmin_settings_social // extends GlmDataContacts
         $templateData = array(
             'displayData' => $displayData,
             'assetsUrl' => GLM_MEMBERS_SOCIAL_PLUGIN_ASSETS_URL,
-            'socials' => $socials,
             'socialUpdated' => $socialUpdated,
             'socialError' => $socialError,
             'option' => $option,
diff --git a/models/admin/social/index.php b/models/admin/social/index.php
deleted file mode 100644 (file)
index 6679d73..0000000
+++ /dev/null
@@ -1,298 +0,0 @@
-<?php
-/**
- * Gaslight Media Members Database
- * Admin Member User Profile
- *
- * PHP version 5.5
- *
- * @category glmWordPressPlugin
- * @package  glmMembersDatabase
- * @author   Gaslight Media <dev@gaslightmedia.com>
- * @license  http://www.gaslightmedia.com Gaslightmedia
- * @release  index.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
- * @link     http://dev.gaslightmedia.com/
- */
-
-// Load Contacts data abstract
-//require_once(GLM_MEMBERS_CONTACTS_PLUGIN_CLASS_PATH.'/data/dataContacts.php');
-
-   
-
-
-class GlmMembersAdmin_social_index // extends GlmDataContacts
-{
-
-    /**
-     * WordPress Database Object
-     *
-     * @var $wpdb
-     * @access public
-     */
-    public $wpdb;
-    /**
-     * Plugin Configuration Data
-     *
-     * @var $config
-     * @access public
-     */
-    public $config;
-    /**
-     * Contact Info
-     *
-     * @var $contactInfo
-     * @access public
-     */
-    public $contactInfo = false;
-    /**
-     * Member ID
-     *
-     * @var $memberID
-     * @access public
-     */
-    public $memberID = false;
-    /**
-     * Contact ID
-     *
-     * @var $contactID
-     * @access public
-     */
-    public $contactID = false;
-
-
-    /*
-     * Constructor
-     *
-     * This contructor performs the work for this model. This model returns
-     * an array containing the following.
-     *
-     * 'status'
-     *
-     * True if successfull and false if there was a fatal failure.
-     *
-     * 'view'
-     *
-     * A suggested view name that the contoller should use instead of the
-     * default view for this model or false to indicate that the default view
-     * should be used.
-     *
-     * 'data'
-     *
-     * Data that the model is returning for use in merging with the view to
-     * produce output.
-     *
-     * @wpdb object WordPress database object
-     *
-     * @return array Array containing status, suggested view, and any data
-     */
-    public function __construct ($wpdb, $config)
-    {
-
-        // Save WordPress Database object
-        $this->wpdb = $wpdb;
-
-        // Save plugin configuration object
-        $this->config = $config;
-
-        /*
-         * Run constructor for the Contacts data class
-         *
-         * Note, the third parameter is a flag that indicates to the Contacts
-         * data class that it should flag a group of fields as 'view_only'.
-         */
-//        parent::__construct(false, false, true);
-
-
-    }
-
-    public function modelAction($actionData = false)
-    {
-        $displayData = 'Hello, World! This is the Social Add-On "social" model talking to you from inside WordPress.';
-        $success = true;
-        $socials = false;
-        $socialUpdated = false;
-        $haveMember = false;
-        $socialError = false;
-        $newSocial = false;
-        $option = false;
-        
-        $socialArray = array(
-            'facebook' => array(
-                'name' => 'Facebook',
-                'xpos' => -5,
-                'ypos' => -5,
-                'baseurl' => 'www.facebook.com'
-            ),
-            'twitter' => array(
-                'name' => 'Twitter',
-                'xpos' => -44,
-                'ypos' => -5,
-                'baseurl' => 'www.twitter.com'
-            ),
-            'pinterest' => array(
-                'name' => 'Pinterest',
-                'xpos' => -84,
-                'ypos' => -5,
-                'baseurl' => 'www.pinterest.com'
-            ),
-            'googleplus' => array(
-                'name' => 'Google Plus',
-                'xpos' => -124,
-                'ypos' => -5,
-                'baseurl' => 'www.google.com'
-            ),
-            'digg' => array(
-                'name' => 'Digg',
-                'xpos' => -163,
-                'ypos' => -5,
-                'baseurl' => 'www.digg.com'
-            ),
-            'linkedin' => array(
-                'name' => 'LinkedIn',
-                'xpos' => -203,
-                'ypos' => -5,
-                'baseurl' => 'www.linkedin.com'
-            ),
-            'instagram' => array(
-                'name' => 'Instagram',
-                'xpos' => -242,
-                'ypos' => -5,
-                'baseurl' => 'www.instagram.com'
-            ),
-            'youtube' => array(
-                'name' => 'YouTube',
-                'xpos' => -322,
-                'ypos' => -5,
-                'baseurl' => 'www.youtube.com'
-            ),
-            'flickr' => array(
-                'name' => 'Flickr',
-                'xpos' => -44,
-                'ypos' => -44,
-                'baseurl' => 'www.flickr.com'
-            ),
-            'blog' => array(
-                'name' => 'blog',
-                'xpos' => -124,
-                'ypos' => -45,
-                'baseurl' => '#'
-            ),
-            'photobucket' => array(
-                'name' => 'Photobucket',
-                'xpos' => -282,
-                'ypos' => -45,
-                'baseurl' => 'www.photobucket.com'
-            ),
-        );
-        
-        // If there's an action option
-        if (isset($_REQUEST['option'])) {
-            $option = trim($_REQUEST['option']);
-        }
-        
-        $socialData = $this->editEntry($memberID);
-        
-        if (!$socialData) {
-            $socialData = $this->newEntry($memberID);
-            $newSocial = true;
-            
-        }
-//        switch($option) {
-//            case 'update':
-//            default:
-//                $this->updateEntry($memberID);
-//                if ($socialData) {
-//                    $socialUpdated = true;
-//                } else {
-//                    $socialError = true;
-//                }
-//                
-//                $option = 'update';
-//                break;
-//        }
-                
-        $memberID = 0;
-        if (isset($_REQUEST['member']) && ($_REQUEST['member']-0) > 0) {
-            $memberID = $_REQUEST['member'] - 0;
-        }
-        if ($memberID == 0) {
-
-            // There should have been a member ID - So failure
-            return array(
-                'status' => false,
-                'menuItemRedirect' => 'error',
-                'modelRedirect' => 'index',
-                'view' => 'admin/error/index.html',
-                'data' => false
-            );
-
-        }
-        
-//        if (isset($_REQUEST['option']) && $_REQUEST['option'] == 'submit') {
-        if ($option == 'submit') {
-
-            $socialData = $this->updateEntry($memberID);
-
-            if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
-                glmMembersAdmin::addNotice("<b>&nbsp;&nbsp;Social Update:</b> $memberID", 'Process');
-            }
-
-            // If update was successful then use editEntry() to setup for the edit again.
-            if ($socialData) {
-
-                $socialData = $this->editEntry($memberID);
-                $socialUpdated = true;
-
-                // Also update all member info records with any possible name change
-                $sql = "
-                    UPDATE ".GLM_MEMBERS_SOCIAL_PLUGIN_DB_PREFIX."media_urls
-                       SET facebook_url = www.testval.com
-                     WHERE member_id = 1
-                ;";
-//                $sql = "
-//                    UPDATE ".GLM_MEMBERS_SOCIAL_PLUGIN_DB_PREFIX."media_urls
-//                       SET facebook_url = '".addslashes($socialData['fieldData']['name'])."'
-//                     WHERE member_id = $memberID
-//                ;";
-                $this->wpdb->query($sql);
-
-            }
-        }
-        
-        // If we had a fatal error, redirect to the error page
-        if ($socialError) {
-            return array(
-                    'status' => $success,
-                    'option' => $option,
-                    'menuItemRedirect' => 'error',
-                    'modelRedirect' => 'index',
-                    'view' => 'admin/error/index.html',
-                    'data' => false
-            );
-        }
-
-        if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
-            glmMembersAdmin::addNotice($memberTypes, 'DataBlock', 'Member Types Data');
-        }
-        
-        // Compile template data
-        $templateData = array(
-            'displayData' => $displayData,
-            'socialArray' => $socialArray,
-            'assetsUrl' => GLM_MEMBERS_SOCIAL_PLUGIN_ASSETS_URL,
-            'socials' => $socials,
-            'socialUpdated' => $socialUpdated,
-            'socialError' => $socialError,
-            'haveMember' => $haveMember,
-            'memberID' => $memberID,
-            'option' => $option
-        );
-
-        // Return status, any suggested view, and any data to controller
-        return array(
-                'status' => true,
-                'modelRedirect' => false,
-                'view' => 'admin/social/index.html',
-                'data' => $templateData
-        );
-    }
-}
diff --git a/models/admin/social/more.php b/models/admin/social/more.php
deleted file mode 100644 (file)
index a94575c..0000000
+++ /dev/null
@@ -1,148 +0,0 @@
-<?php
-/**
- * Gaslight Media Members Database
- * Admin Member User Profile
- *
- * PHP version 5.5
- *
- * @category glmWordPressPlugin
- * @package  glmMembersDatabase
- * @author   Gaslight Media <dev@gaslightmedia.com>
- * @license  http://www.gaslightmedia.com Gaslightmedia
- * @release  index.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
- * @link     http://dev.gaslightmedia.com/
- */
-
-// Load Contacts data abstract
-//require_once(GLM_MEMBERS_CONTACTS_PLUGIN_CLASS_PATH.'/data/dataContacts.php');
-
-class GlmMembersAdmin_social_more // extends GlmDataContacts
-{
-
-    /**
-     * WordPress Database Object
-     *
-     * @var $wpdb
-     * @access public
-     */
-    public $wpdb;
-    /**
-     * Plugin Configuration Data
-     *
-     * @var $config
-     * @access public
-     */
-    public $config;
-    /**
-     * Contact Info
-     *
-     * @var $contactInfo
-     * @access public
-     */
-    public $contactInfo = false;
-    /**
-     * Member ID
-     *
-     * @var $memberID
-     * @access public
-     */
-    public $memberID = false;
-    /**
-     * Contact ID
-     *
-     * @var $contactID
-     * @access public
-     */
-    public $contactID = false;
-
-
-    /*
-     * Constructor
-     *
-     * This contructor performs the work for this model. This model returns
-     * an array containing the following.
-     *
-     * 'status'
-     *
-     * True if successfull and false if there was a fatal failure.
-     *
-     * 'view'
-     *
-     * A suggested view name that the contoller should use instead of the
-     * default view for this model or false to indicate that the default view
-     * should be used.
-     *
-     * 'data'
-     *
-     * Data that the model is returning for use in merging with the view to
-     * produce output.
-     *
-     * @wpdb object WordPress database object
-     *
-     * @return array Array containing status, suggested view, and any data
-     */
-    public function __construct ($wpdb, $config)
-    {
-
-        // Save WordPress Database object
-        $this->wpdb = $wpdb;
-
-        // Save plugin configuration object
-        $this->config = $config;
-
-        /*
-         * Run constructor for the Contacts data class
-         *
-         * Note, the third parameter is a flag that indicates to the Contacts
-         * data class that it should flag a group of fields as 'view_only'.
-         */
-//        parent::__construct(false, false, true);
-
-
-    }
-
-    public function modelAction($actionData = false)
-    {
-
-        $displayData = 'Welcome to more information!<br>This is the Social Add-On "social" model with action "more" talking to you from inside WordPress.';
-        $socialArray = array(
-            'member1' => array(
-                'facebookurl' => 'www.facebook.com',
-                'youtubeurl' => 'www.youtube.com',
-                'googleurl' => 'www.google.com',
-                'gaslighturl' => 'www.gaslightmedia.com'           
-            ),
-            
-            'member2' => array(
-                'facebookurl' => 'www.facebook.com',
-                'youtubeurl' => 'www.youtube.com',
-                'googleurl' => 'www.google.com',
-                'gaslighturl' => 'www.gaslightmedia.com'           
-            ),
-            
-            'member2' => array(
-                'facebookurl' => 'www.facebook.com',
-                'youtubeurl' => 'www.youtube.com',
-                'googleurl' => 'www.google.com',
-                'gaslighturl' => 'www.gaslightmedia.com'           
-            )
-            
-        );
-        // Compile template data
-        $templateData = array(
-            'displayData' => $displayData,
-            'socialArray' => $socialArray
-        );
-
-        // Return status, any suggested view, and any data to controller
-        return array(
-                'status' => true,
-                'modelRedirect' => false,
-                'view' => 'admin/social/more.html',
-                'data' => $templateData
-        );
-
-    }
-
-
-}
index 90c84c5..7a5e3e2 100644 (file)
  */
 
 // Add a main menu item
-add_menu_page(
-    'GLM Social',                                       // Page Title
-    'GLM Social',                                       // Menu Title
-    'glm-members-members',                              // Capability
-    'glm-members-admin-menu-social',                    // Menu Slug
-    function() {$this->controller('social');},          // Called function
-    false,                                              // Icon URL
-    '92'                                                // Menu Position
-);
-
-add_submenu_page(
-    'glm-members-admin-menu-social',                    // Parent slug
-    'Social',                                           // Page title
-    'Social',                                           // Menu Title
-    'glm_members_members',                              // Capability required
-    'glm-members-admin-menu-social-social',             // Menu slug
-    function() {$this->controller('social');}
-);
-
-add_submenu_page(
-    'glm-members-admin-menu-social',                    // Parent slug
-    'Info',                                             // Page title
-    'Info',                                             // Menu Title
-    'glm_members_members',                              // Capability required
-    'glm-members-admin-menu-social-info',               // Menu slug
-    function() {$this->controller('info');}
-);
+//add_menu_page(
+//    'GLM Social',                                       // Page Title
+//    'GLM Social',                                       // Menu Title
+//    'glm-members-members',                              // Capability
+//    'glm-members-admin-menu-social',                    // Menu Slug
+//    function() {$this->controller('social');},          // Called function
+//    false,                                              // Icon URL
+//    '92'                                                // Menu Position
+//);
+//
+//add_submenu_page(
+//    'glm-members-admin-menu-social',                    // Parent slug
+//    'Social',                                           // Page title
+//    'Social',                                           // Menu Title
+//    'glm_members_members',                              // Capability required
+//    'glm-members-admin-menu-social-social',             // Menu slug
+//    function() {$this->controller('social');}
+//);
+//
+//add_submenu_page(
+//    'glm-members-admin-menu-social',                    // Parent slug
+//    'Info',                                             // Page title
+//    'Info',                                             // Menu Title
+//    'glm_members_members',                              // Capability required
+//    'glm-members-admin-menu-social-info',               // Menu slug
+//    function() {$this->controller('info');}
+//);
index 090600e..9912c57 100644 (file)
@@ -11,8 +11,8 @@
 -- To permit each query below to be executed separately,
 -- all queries must be separated by a line with four dashes
 
-CREATE TABLE {prefix}media_urls (
-  member_id INT NULL,
+CREATE TABLE {prefix}urls (
+  id INT NULL,
   facebook TEXT NULL,
   twitter TEXT NULL,
   pinterest TEXT NULL,
@@ -25,27 +25,27 @@ CREATE TABLE {prefix}media_urls (
   flickr TEXT NULL,
   blog TEXT NULL,
   photobucket TEXT NULL,
-  PRIMARY KEY (member_id),
-  INDEX(member_id)
+  PRIMARY KEY (id),
+  INDEX(id)
 );
 
 ----
 
-CREATE TABLE {prefix}media_record (
-  social_id INT NOT NULL AUTO_INCREMENT,
-  social_name TINYTEXT NULL,
-  social_xpos int NULL,
-  social_ypos int NULL,
-  social_baseurl TINYTEXT NULL,
+CREATE TABLE {prefix}records (
+  id INT NOT NULL AUTO_INCREMENT,
+  name TINYTEXT NULL,
+  xpos int NULL,
+  ypos int NULL,
+  baseurl TINYTEXT NULL,
   active BOOLEAN NOT NULL DEFAULT '1',
-  PRIMARY KEY (social_id),
-  INDEX(social_id)
+  PRIMARY KEY (id),
+  INDEX(id)
 );
 
 ----
 
-INSERT INTO {prefix}media_record
-  (social_name, social_xpos, social_ypos, social_baseurl, active)
+INSERT INTO {prefix}records
+  (name, xpos, ypos, baseurl, active)
   VALUES ('Facebook',-5,-5,'www.facebook.com',true),
          ('Twitter',-44,-5,'www.twitter.com',true),
          ('Pinterest',-84,-5,'www.pinterest.com',true),
index e8626e8..4d54cde 100644 (file)
@@ -49,13 +49,6 @@ $glmMembersSocialAddOnValidActions = array(
         'member' => array(
             'social' => GLM_MEMBERS_SOCIAL_PLUGIN_SLUG,
         ),
-        'social' => array(
-            'index' => GLM_MEMBERS_SOCIAL_PLUGIN_SLUG,
-            'more' => GLM_MEMBERS_SOCIAL_PLUGIN_SLUG,
-        ),
-        'info' => array(
-            'index' => GLM_MEMBERS_SOCIAL_PLUGIN_SLUG
-        ),
         'settings' => array(
             'social' => GLM_MEMBERS_SOCIAL_PLUGIN_SLUG
         )
diff --git a/views/admin/info/index.html b/views/admin/info/index.html
deleted file mode 100644 (file)
index eab9b97..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<div class="wrap">
-    <div id="glm-admin-content-container">
-        <h3>Info Sub-menu Model</h3>
-        <p>{$displayData}</p>
-    </div>
-</div>
\ No newline at end of file
index a97192f..9b7e021 100644 (file)
@@ -3,23 +3,23 @@
     <h3>Member Social Tab</h3>
     <p>{$displayData}</p>
     <div id="glm-admin-content-container">
-        <a href="{$thisURL}?page={$thisPage}&glm_action=more">Click me to see more!</a>
-        <form action="{$thisURL}?page={$thisPage}&glm_action=social&member=1" method="post" enctype="multipart/form-data">
+        <a href="{$thisUrl}?page={$thisPage}&glm_action=more">Click me to see more!</a>
+        <form action="{$thisUrl}?page={$thisPage}&glm_action=social&member={$memberID}" method="post" enctype="multipart/form-data">
             <input type="submit" class="button glm-button submit" value="submit" name='submit'>
             <input type="hidden" name="option" value="submit">
             <div class="button glm-button right">Update</div>
             <table class="glm-admin-table">
-            {foreach from=$existingSocials key=k item=socialItem}
+            {foreach from=$socials key=k item=socialItem}
                 {if $socialItem.active}
-                    {$socialField = $socialItem.social_name|lower}
+                    {$socialField = $socialItem.name|lower}
                     <tr>
                         <th>
-                            <div id="glm-member-db-admin-social-{$socialItem.social_name|lower}" title="{$socialItem.social_name}" class="glm-member-db-social-icon" style="background: url('{$assetsUrl}/social-few-full-sprite.jpg') repeat scroll {$socialItem.social_xpos}px {$socialItem.social_ypos}px;height:33px;width:33px;display:block;">
+                            <div id="glm-member-db-admin-social-{$socialItem.name|lower}" title="{$socialItem.name}" class="glm-member-db-social-icon" style="background: url('{$assetsUrl}/social-few-full-sprite.jpg') repeat scroll {$socialItem.xpos}px {$socialItem.ypos}px;height:33px;width:33px;display:block;">
                             </div>
-                            {$socialItem.social_name}
+                            {$socialItem.name}
                         </th>
                         <td>
-                            <input type="text" placeholder="{$socialItem.social_name} URL" name="socialname-{$socialItem.social_name|lower}" class="glm-form-text-input" value="{$existingUrls.$socialField}">
+                            <input type="text" id="{$socialItem.name|lower}" placeholder="{$socialItem.name} url" name="{$socialItem.name|lower}" class="glm-form-text-input" value="{$urlList.$socialField}">
                         </td>
                     </tr>
                 {/if}
     </div>
     
 
-    <script type="text/javascript">
-        jQuery(document).ready(function($) {
-            // Flash certain elements for a short time after display      
-            $(".glm-flash-updated").fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500);
-        });
+<script type="text/javascript">
+    jQuery(document).ready(function($) {
+        // Flash certain elements for a short time after display      
+        $(".glm-flash-updated").fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500);
+    });
 </script>
 {include file='admin/footer.html'}
\ No newline at end of file
index a5c662f..0a47b77 100644 (file)
@@ -3,31 +3,31 @@
     <h3>Member Social Tab</h3>
     <p>{$displayData}</p>
     <div id="glm-admin-content-container">
-        <a href="{$thisURL}?page={$thisPage}&glm_action=more">Click me to see more!</a>
-        <form id="glm-member-db-social-management" action="{$thisURL}?page={$thisPage}&glm_action=social&member=1" method="post" enctype="multipart/form-data">
+        <a href="{$thisUrl}?page={$thisPage}&glm_action=more">Click me to see more!</a>
+        <form id="glm-member-db-social-management" action="{$thisUrl}?page={$thisPage}&glm_action=social&member=1" method="post" enctype="multipart/form-data">
             <input type="submit" class="button glm-button submit" value="submit" name='submit'>
             <input type="hidden" name="option" value="submit">
             <div class="button glm-button right">Update</div>
             <table class="glm-admin-table">
             {foreach from=$existingSocials key=k item=socialItem}
-                {$socialField = $socialItem.social_name|lower}
+                {$socialField = $socialItem.name|lower}
                 <tr>
                     <th class="glm-member-db-social-management-checkbox">
-                        <input type="checkbox" name="checkname-{$socialItem.social_name|lower}" class="glm-form-text-input" value="{$socialField}" {if $socialItem.active}checked{/if}>
+                        <input type="checkbox" name="checkname-{$socialItem.name|lower}" class="glm-form-text-input" value="{$socialField}" {if $socialItem.active}checked{/if}>
                     </th>
                     <td class="glm-member-db-social-management-icon">
-                        <div id="glm-member-db-admin-social-{$socialItem.social_name|lower}" title="{$socialItem.social_name}" class="glm-member-db-social-icon" style="background: url('{$assetsUrl}/social-few-full-sprite.jpg') repeat scroll {$socialItem.social_xpos}px {$socialItem.social_ypos}px;height:33px;width:33px;display:block;">
+                        <div id="glm-member-db-admin-social-{$socialItem.name|lower}" title="{$socialItem.name}" class="glm-member-db-social-icon" style="background: url('{$assetsUrl}/social-few-full-sprite.jpg') repeat scroll {$socialItem.xpos}px {$socialItem.ypos}px;height:33px;width:33px;display:block;">
                         </div>
                     </td>
                     <td class="glm-member-db-social-management-name">
-                        {$socialItem.social_name}
+                        {$socialItem.name}
                     </td>
 <!--                    <td>
                         <input type="button" class="button glm-button submit" value="Change Icon" name="newSocialIcon">
                     </td>
                     <td>
                         <div class="glm-galleryImage" data-id="logo">
-                            <img src="{$glmPluginMediaURL}/images/small/{$member.fieldData.logo}">
+                            <img src="{$glmPluginMediaUrl}/images/small/{$member.fieldData.logo}">
                         </div>
                         <div id="glm-galleryImageLarger_logo" class="glm-imageDialog">
                             <div id="glm-member-db-admin-social-{$socialItem.name|lower}" title="{$socialItem.name}" class="glm-member-db-social-icon" style="background: url('{$assetsUrl}/social-few-full-sprite.jpg') repeat scroll {$socialItem.xpos}px {$socialItem.ypos}px;height:33px;width:33px;display:block;">
diff --git a/views/admin/social/index.html b/views/admin/social/index.html
deleted file mode 100644 (file)
index 244479e..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<div class="wrap">
-    <div id="glm-admin-content-container">
-        <h3>Social Model</h3>
-        <p>{$displayData}</p>
-        <a href="{$thisURL}?page={$thisPage}&glm_action=more">Click me to see more!</a>
-        
-        <form action="{$thisURL}?page={$thisPage}" method="post" enctype="multipart/form-data">
-            <input type="submit" class="button glm-button submit" value="{if $memberInfoID && $memberInfo}Update member information{else}Add new member information{/if}">
-            <div class="button glm-button right">Update</div>
-            <table class="glm-admin-table">
-            {foreach from=$socialArray key=k item=socialItem}
-                <tr>
-                    <th>
-                        <div id="glm-member-db-admin-social-{$socialItem.name|lower}" title="{$socialItem.name}" class="glm-member-db-social-icon" style="background: url('{$assetsUrl}/social-few-full-sprite.jpg') repeat scroll {$socialItem.xpos}px {$socialItem.ypos}px;height:33px;width:33px;display:block;">
-                        </div>
-                        {$socialItem.name}
-                    </th>
-                    <td>
-                        <input type="text" placeholder="{$socialItem.name} URL" name="{$socialItem.name|lower}" class="glm-form-text-input">
-                    </td>
-                </tr>
-            {/foreach}
-            </table>
-            <input type="submit" class="button glm-button submit" value="{if $memberInfoID && $memberInfo}Update member information{else}Add new member information{/if}">
-        </form>
-        
-    </div>
-</div>
\ No newline at end of file
diff --git a/views/admin/social/more.html b/views/admin/social/more.html
deleted file mode 100644 (file)
index bd2ae50..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<div class="wrap">
-    <div id="glm-admin-content-container">
-        <h3>Social Model - More Information</h3>
-        <p>{$displayData}</p>
-    </div>
-</div>
\ No newline at end of file