Touched index to force an update
authorChuck Scott <cscott@gaslightmedia.com>
Thu, 2 Jun 2016 20:17:32 +0000 (16:17 -0400)
committerChuck Scott <cscott@gaslightmedia.com>
Thu, 2 Jun 2016 20:17:32 +0000 (16:17 -0400)
models/admin/member/social.php
models/admin/social/index.php [new file with mode: 0644]
setup/adminMenus.php
setup/adminTabs.php
setup/permissions.php
setup/validActions.php
views/admin/management/social.html
views/admin/member/social.html [deleted file]
views/admin/social/index.html [new file with mode: 0644]

index d0a18f1..08a2383 100644 (file)
  * @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/
  */
 
+// Inform the social code that we're working from the member area
+define('GLM_SOCIAL_MEMBER_MENU', true);
 
-// Load Management Social data abstract
-require_once GLM_MEMBERS_SOCIAL_PLUGIN_CLASS_PATH.'/data/dataSocialUrls.php';
+// Load the events index
+require GLM_MEMBERS_SOCIAL_PLUGIN_PATH."/models/admin/social/index.php";
 
 /**
  * GlmMembersAdmin_member_social
@@ -26,10 +27,9 @@ require_once GLM_MEMBERS_SOCIAL_PLUGIN_CLASS_PATH.'/data/dataSocialUrls.php';
  * @package GLM Member DB
  * @author  Chuck Scott <cscott@gaslightmedia.com>
  * @license http://www.gaslightmedia.com Gaslightmedia
- *          @release SVN: $Id: packaging.php,v 1.0 2011/01/25 19:31:47 cscott
- *          Exp $
+ * @release  social.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
  */
-class GlmMembersAdmin_member_social extends GlmDataSocialUrls
+class GlmMembersAdmin_member_social extends GlmMembersAdmin_social_index
 {
     /**
      * WordPress Database Object
@@ -72,206 +72,8 @@ class GlmMembersAdmin_member_social extends GlmDataSocialUrls
         $this->config = $config;
 
         // Run constructor for social data class
-        parent::__construct(false, false);
+        parent::__construct($wpdb, $config);
 
     }
 
-    public function modelAction($actionData = false)
-    {
-
-        $success       = true;
-        $urlUpdated    = false;
-        $haveMember    = true;
-        $socialError   = false;
-        $option        = false;
-        $debug         = false;
-        $statusMessage = "Update complete";
-        $urlList = $socialList = array();
-
-        // Get the Member ID
-        $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
-            );
-        }
-
-        // Get the base member data
-        require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMembers.php');
-        $Members = new GlmDataMembers($this->wpdb, $this->config);
-        $memberData = $Members->getEntry($memberID);
-        $memberName = $memberData['name'];
-
-        $urlList = $this->getList("ref_dest = " . $memberID);
-        if ($urlList) {
-            $haveURls = true;
-        }
-
-        require_once(GLM_MEMBERS_SOCIAL_PLUGIN_CLASS_PATH.'/data/dataSocials.php');
-        $Socials    = new GlmDataSocials($this->wpdb, $this->config);
-        $socialList = $Socials->getList();
-
-        // Get the option or set to default
-        if (isset($_REQUEST['option'])) {
-            $option = trim(filter_var($_REQUEST['option'],FILTER_SANITIZE_STRING));
-        } else {
-            $option = "default";
-        }
-
-
-        switch ($option) {
-            case "submit":
-                // loop thru the socialList to see if there's a new value for that media
-                // if there no value then see if there's a record and delete it
-                // if there's no record then add it
-                // if there's a record then update it
-
-                // If we have a list of social media types
-                if ($socialList) {
-
-                    $memberSocialUrlList = array();
-
-                    // Scan the urlList to see if any of them are now blank
-                    if (!empty($urlList)) {
-                        foreach ($urlList as $url) {
-
-                            // If there's no input for an existing url record
-                            if (   !isset($_REQUEST['socialUrl'][$url['social']]) 
-                                || trim($_REQUEST['socialUrl'][$url['social']]) == ''
-                            ) {
-
-                                // delete record here
-                                $this->wpdb->delete(
-                                    $this->table,
-                                    array( 'id' => $url['id']),
-                                    array( '%d' )
-                                );
-
-                            } else {
-                                $memberSocialUrlList[$url['social']] = $url['id'];
-                            }
-                        }
-                    }
-
-                    // Scan the Social List to see if there's any that do have data
-                    foreach ($socialList as $socialData) {
-
-                        // Was there any input for this social media type
-                        if (   isset($_REQUEST['socialUrl'][$socialData['id']]) 
-                            && trim($_REQUEST['socialUrl'][$socialData['id']]) != ''
-                        ) {
-
-                            $url = $_REQUEST['socialUrl'][$socialData['id']];
-
-                            // See if there's a record for it
-                            if (isset($memberSocialUrlList[$socialData['id']])) {
-
-                                // There is, so just update record here
-                                $this->wpdb->update(
-                                    $this->table,
-                                    array('url' => $url),
-                                    array(
-                                        'ref_type' => $this->config['ref_type_numb']['MemberInfo'], 
-                                        'ref_dest' => $memberID, 
-                                        'social'   => $socialData['id']
-                                    ),
-                                    array('%s'),
-                                    array('%d', '%d', '%s' )
-                                );
-
-                            // There is no record for it, so insert one
-                            } else {
-
-                                // add record here
-                                $newId = $this->wpdb->insert(
-                                    $this->table,
-                                    array(
-                                        'url'      => $url,
-                                        'ref_type' => $this->config['ref_type_numb']['MemberInfo'],
-                                        'ref_dest' => $memberID,
-                                        'social'   => $socialData['id']
-                                    ),
-                                    array( '%s', '%d', '%d', '%s' )
-                                );
-                            }
-                        }
-                    }
-                }
-
-                $statusMessage = "Social Media URLs Updated";
-
-                // Get our updated list
-                $urlList = $this->getList("ref_dest = " . $memberID);
-
-                $urlUpdated = true;
-
-                break;
-
-            case "social":
-            default:
-                break;
-        }
-
-        // 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
-            );
-        }
-
-        // Refresh the Url list before returning it
-        if (!empty($urlList)) {
-            foreach ($urlList as $url) {
-                $socialList[$url['social']]['url'] = $url['url'];
-            }
-        }
-
-
-        if ($debug) {
-            echo '<pre>$urlList: ' . print_r($urlList, true) . '</pre>';
-            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 "<hr />sociallist:<table>";
-            echo "<pre>".print_r($socialList, true)."</pre>";
-            echo "</table>";
-        }
-
-        $templateData = array(
-            'memberName'    => $memberName,
-            'socials'       => $socialList,
-            'assetsUrl'     => GLM_MEMBERS_SOCIAL_PLUGIN_ASSETS_URL,
-            'urlUpdated'    => $urlUpdated,
-            'socialError'   => $socialError,
-            'haveMember'    => $haveMember,
-            'memberID'      => $memberID,
-            'option'        => $option,
-            'statusMessage' => $statusMessage
-        );
-
-        // Return status, any suggested view, and any data to controller
-        return array(
-            'status'        => true,
-            'modelRedirect' => false,
-            'view'          => 'admin/member/social.html',
-            'data'          => $templateData
-        );
-    }
 }
diff --git a/models/admin/social/index.php b/models/admin/social/index.php
new file mode 100644 (file)
index 0000000..d0f4bf4
--- /dev/null
@@ -0,0 +1,280 @@
+<?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 Management Social data abstract
+require_once GLM_MEMBERS_SOCIAL_PLUGIN_CLASS_PATH.'/data/dataSocialUrls.php';
+
+/**
+ * GlmMembersAdmin_member_social
+ *
+ * PHP version 5
+ *
+ * @category Model
+ * @package GLM Member DB
+ * @author  Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ *          @release SVN: $Id: packaging.php,v 1.0 2011/01/25 19:31:47 cscott
+ *          Exp $
+ */
+class GlmMembersAdmin_social_index extends GlmDataSocialUrls
+{
+    /**
+     * WordPress Database Object
+     *
+     * @var $wpdb
+     * @access public
+     */
+    public $wpdb;
+    /**
+     * Plugin Configuration Data
+     *
+     * @var $config
+     * @access public
+     */
+    public $config;
+    /**
+     * Member ID
+     *
+     * @var $memberID
+     * @access public
+     */
+    public $memberID = false;
+
+    /*
+     * Constructor
+     *
+     * 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 social data class
+        parent::__construct($wpdb, $config);
+
+    }
+
+    public function modelAction($actionData = false)
+    {
+
+        $lockedToMember = false;
+        $socialWhereT = 'true';
+        $socialWhere = 'true';
+        $success       = true;
+        $urlUpdated    = false;
+        $haveMember    = true;
+        $socialError   = false;
+        $option        = false;
+        $statusMessage = "Update complete";
+        $urlList = $socialsList = array();
+
+            // Check if there's a logged in user who is locked to their own entity
+        $lockedToMember = apply_filters('glm_members_locked_to_member_id', false);
+        if ($lockedToMember) {
+            $memberID = $lockedToMember;
+            $lockedToMember = $memberID;
+        } else {
+
+            // Get the Member ID
+            $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
+                );
+            }
+
+        }
+
+        // *** Note that ref_type should be Member (10) rather than MemberInfo(20), but this works ***
+        $socialWhereT = 'T.ref_type = '.$this->config['ref_type_numb']['MemberInfo'].' AND T.ref_dest = '.$memberID;
+        $socialWhere = 'ref_type = '.$this->config['ref_type_numb']['MemberInfo'].' AND ref_dest = '.$memberID;
+
+        // Get the base member data
+        require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMembers.php');
+        $Members = new GlmDataMembers($this->wpdb, $this->config);
+        $memberData = $Members->getEntry($memberID);
+        $memberName = $memberData['name'];
+
+        // Get a list of currently selected social media types for this member
+        $urlList = $this->getList($socialWhere);
+        if ($urlList) {
+            $haveURls = true;
+        }
+
+        // Get list of all available social media types
+        require_once(GLM_MEMBERS_SOCIAL_PLUGIN_CLASS_PATH.'/data/dataSocials.php');
+        $Socials    = new GlmDataSocials($this->wpdb, $this->config);
+        $socialsList = $Socials->getList();
+
+        // Get the option or set to default
+        if (isset($_REQUEST['option'])) {
+            $option = trim(filter_var($_REQUEST['option'],FILTER_SANITIZE_STRING));
+        } else {
+            $option = "default";
+        }
+
+
+        switch ($option) {
+            case "submit":
+                // loop thru the socialsList to see if there's a new value for that media
+                // if there no value then see if there's a record and delete it
+                // if there's no record then add it
+                // if there's a record then update it
+
+                // If we have a list of social media types
+                if ($socialsList) {
+
+                    $memberSocialUrlList = array();
+
+                    // Scan the urlList to see if any of them are now blank
+                    if (!empty($urlList)) {
+                        foreach ($urlList as $url) {
+
+                            // If there's no input for an existing url record
+                            if (   !isset($_REQUEST['socialUrl'][$url['social']])
+                                || trim($_REQUEST['socialUrl'][$url['social']]) == ''
+                            ) {
+
+                                // delete record here
+                                $this->wpdb->delete(
+                                    $this->table,
+                                    array( 'id' => $url['id']),
+                                    array( '%d' )
+                                );
+
+                            } else {
+                                $memberSocialUrlList[$url['social']] = $url['id'];
+                            }
+                        }
+                    }
+
+                    // Scan the Social List to see if there's any that do have data
+                    foreach ($socialsList as $socialData) {
+
+                        // Was there any input for this social media type
+                        if (   isset($_REQUEST['socialUrl'][$socialData['id']])
+                            && trim($_REQUEST['socialUrl'][$socialData['id']]) != ''
+                        ) {
+
+                            $url = $_REQUEST['socialUrl'][$socialData['id']];
+
+                            // See if there's a record for it
+                            if (isset($memberSocialUrlList[$socialData['id']])) {
+
+                                // There is, so just update record here
+                                $this->wpdb->update(
+                                    $this->table,
+                                    array('url' => $url),
+                                    array(
+                                        'ref_type' => $this->config['ref_type_numb']['MemberInfo'],
+                                        'ref_dest' => $memberID,
+                                        'social'   => $socialData['id']
+                                    ),
+                                    array('%s'),
+                                    array('%d', '%d', '%s' )
+                                );
+
+                            // There is no record for it, so insert one
+                            } else {
+
+                                // add record here
+                                $newId = $this->wpdb->insert(
+                                    $this->table,
+                                    array(
+                                        'url'      => $url,
+                                        'ref_type' => $this->config['ref_type_numb']['MemberInfo'],
+                                        'ref_dest' => $memberID,
+                                        'social'   => $socialData['id']
+                                    ),
+                                    array( '%s', '%d', '%d', '%s' )
+                                );
+                            }
+                        }
+                    }
+                }
+
+                $statusMessage = "Social Media URLs Updated";
+
+                // Get our updated list
+                $urlList = $this->getList("ref_dest = " . $memberID);
+
+                $urlUpdated = true;
+
+                break;
+
+            case "social":
+            default:
+                break;
+        }
+
+        // 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
+            );
+        }
+
+        // Refresh the Url list before returning it
+        if (!empty($urlList)) {
+            foreach ($urlList as $url) {
+                $socialsList[$url['social']]['url'] = $url['url'];
+            }
+        }
+
+        $templateData = array(
+            'lockedToMember' => $lockedToMember,
+            'memberName'    => $memberName,
+            'socials'       => $socialsList,
+            'assetsUrl'     => GLM_MEMBERS_SOCIAL_PLUGIN_ASSETS_URL,
+            'urlUpdated'    => $urlUpdated,
+            'socialError'   => $socialError,
+            'haveMember'    => $haveMember,
+            'memberID'      => $memberID,
+            'option'        => $option,
+            'statusMessage' => $statusMessage
+        );
+
+        // Return status, any suggested view, and any data to controller
+        return array(
+            'status'        => true,
+            'modelRedirect' => false,
+            'view'          => 'admin/social/index.html',
+            'data'          => $templateData
+        );
+    }
+}
index 7a5e3e2..6e91272 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');}
-//);
+
+// If a contact is logged in (ownEntity isn't false), add Contact Profile menu item
+if ($this->config['loggedInUser']['contactUser']) {
+
+    add_submenu_page(
+        $mainMenuSlug,
+        'Social Media',
+        'Social Media',
+        'glm_members_edit_my_entity',
+        'glm-members-admin-menu-social-index',
+        function() {$this->controller('social');}
+    );
+
+}
index 087500c..2caf00d 100644 (file)
  *
  */
 
-add_filter('glm-member-db-add-tab-for-member',
-    function($addOnTabs) {
-        $newTabs = array(
-            array(
-                'text' => 'Social',
-                'menu' => 'member',
-                'action' => 'social'
-            )
-        );
-        $addOnTabs = array_merge($addOnTabs, $newTabs);
-        return $addOnTabs;
-    }
-);
+// If user can manage all members
+if (current_user_can('glm_members_members')) {
+    add_filter('glm-member-db-add-tab-for-member',
+        function($addOnTabs) {
+            $newTabs = array(
+                array(
+                    'text' => 'Social Media',
+                    'menu' => 'member',
+                    'action' => 'social'
+                )
+            );
+            $addOnTabs = array_merge($addOnTabs, $newTabs);
+            return $addOnTabs;
+        }
+    );
+}
+
 add_filter('glm-member-db-add-tab-for-management',
     function($addOnTabs) {
         $newTabs = array(
             array(
-                'text' => 'Social',
+                'text' => 'Social Media',
                 'menu' => 'settings',
                 'action' => 'social'
             )
index e66d3d7..940ac7d 100644 (file)
  * @link     http://dev.gaslightmedia.com/
  */
 
-
-/**********************************************************************
- *  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.
- *
- *  This file is used to add permission checks that can be used throught
- *  the main plugin and add-ons. If no such permissions are needed by
- *  this add-on, this file should be omitted.
- *
- *  Remove this message before using this file in production!
- **********************************************************************/
-
 /*
  * Below are permission checks for various specific things in this add-on and
  * elsewhere in the Member DB main plugin and add-ons.
  *
  * Of course any of these may test more than one capability if that's desired.
  */
+
+// Logged in all members manager user may edit Social media for all members
+add_filter('glm_members_permit_admin_members_social',
+    function($permit) {
+        if (!$permit) { return false; }
+        return current_user_can('glm_members_edit_any_member');
+    }
+);
+
+// Logged in member user may edit an social media only for their own entity
+add_filter('glm_members_permit_admin_member_social',
+    function($permit) {
+        if (!$permit) { return false; }
+        return current_user_can('glm_members_edit_my_member');
+    }
+);
+
index 92d210b..0c5e3ee 100644 (file)
@@ -49,6 +49,9 @@ $glmMembersSocialAddOnValidActions = array(
         'member' => array(
             'social' => GLM_MEMBERS_SOCIAL_PLUGIN_SLUG,
         ),
+        'social' => array(
+            'index' => GLM_MEMBERS_SOCIAL_PLUGIN_SLUG,
+        ),
         'management' => array(
             'social' => GLM_MEMBERS_SOCIAL_PLUGIN_SLUG
         )
@@ -56,7 +59,6 @@ $glmMembersSocialAddOnValidActions = array(
     'frontActions' => array(
         'social' => array(
             'list' => GLM_MEMBERS_SOCIAL_PLUGIN_SLUG,
-    //        'detail' => GLM_MEMBERS_SOCIAL_PLUGIN_SLUG
         )
     )
 );
index 9bc2ed4..969ab52 100644 (file)
     <div id="glm-admin-content-container">
 
             <table class="wp-list-table striped glm-admin-table">
-                <tr>
-                    <th>Name</th>
-                    <th>Active</th>
-                    <th>Image</th>
-                    <th>Base URL</th>
-                    <th>&nbsp;</th>
-                </tr>
+                <thead>
+                    <tr>
+                        <th>Name</th>
+                        <th>Active</th>
+                        <th>Image</th>
+                        <th>Base URL</th>
+                        <th>&nbsp;</th>
+                    </tr>
+                </thead>
+                <tbody>
         {foreach $socials as $s}
-                <tr>
-                    <td class="glm-member-db-social-management-name">
-                        <a class="editSocial" data-socialID="{$s.id}" data-socialActive="{$s.active.value}">{$s.name}</a>
-                    </td>
-                    <td class="glm-member-db-social-management-checkbox">
-                        {$s.active.name}
-                    </td>
-                    <td>
-            {if $s.b64icon}                    
-                        <img alt="Embedded Image" src="data:image/png;base64,{$s.b64icon}">
-            {else}
-                        (no image)
-            {/if}
-                    </td>
-                    <td id="editSocialUrl_{$s.id}">
-                        {$s.baseurl}
-                    </td>
-                    <td>
-                        <div class="deleteSocialButton button button-secondary glm-button-small" data-socialID="{$s.id}">Delete</div>
-                    </td>
-                </tr>
+                    <tr>
+                        <td class="glm-member-db-social-management-name">
+                            <a class="editSocial" data-socialID="{$s.id}" data-socialActive="{$s.active.value}">{$s.name}</a>
+                        </td>
+                        <td class="glm-member-db-social-management-checkbox">
+                            {$s.active.name}
+                        </td>
+                        <td>
+                {if $s.b64icon}                    
+                            <img alt="Embedded Image" src="data:image/png;base64,{$s.b64icon}">
+                {else}
+                            (no image)
+                {/if}
+                        </td>
+                        <td id="editSocialUrl_{$s.id}">
+                            {$s.baseurl}
+                        </td>
+                        <td>
+                            <div class="deleteSocialButton button button-secondary glm-button-small" data-socialID="{$s.id}">Delete</div>
+                        </td>
+                    </tr>
         {/foreach}
+                </tbody>
             </table>
         </form>
     </div>
diff --git a/views/admin/member/social.html b/views/admin/member/social.html
deleted file mode 100644 (file)
index 4af11b3..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-{include file='admin/member/header.html'}
-<h2>{if $urlUpdated}<span class="glm-notice glm-flash-updated glm-right">{$statusMessage}</span>{/if}</h2>
-    <h3>Member Social Tab</h3>
-    
-    <div id="glm-admin-content-container">
-        <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">
-            {foreach from=$socials key=k item=socialItem}
-                {if !$socialItem.active.value}
-                <input type="hidden" name="socialUrl[{$socialItem.id}]" value="{if isset($socialItem.url)}{$socialItem.url}{/if}">
-                {/if}
-            {/foreach}
-            <table class="wp-list-table striped glm-admin-table">
-                <tr><th>Social Media Type</th><th>Icon</th><th>URL</th></tr>
-            {foreach from=$socials key=k item=socialItem}
-                {if $socialItem.active.value}
-                    {$socialField = $socialItem.name|lower}
-                    <tr>
-                        <th>
-                            <div id="glm-member-db-admin-social-{$socialItem.name|lower}" title="{$socialItem.name}" class="glm-member-db-social-icon">
-                            </div>
-                            <a class="editMemberType" data-memberTypeID="{$socialItem.id}">{$socialItem.name}</a>
-                        </th>
-                        <td>
-                            <img alt="Embedded Image" src="data:image/png;base64,{$socialItem.b64icon}">
-                        </td>
-                        <td>
-                            <input type="text" id="{$socialItem.name|lower}" placeholder="{if $socialItem.baseurl!=''}http://{$socialItem.baseurl}/...{else}{$socialItem.name}{/if}" name="socialUrl[{$socialItem.id}]" class="glm-form-text-input" value="{if isset($socialItem.url)}{$socialItem.url}{/if}">
-                        </td>
-                    </tr>
-                {/if}
-            {/foreach}
-            </table>
-            <input type="submit" class="button glm-button submit" value="submit" name='submit'>
-        </form>
-    </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);
-        
-        // Image pop-up dialog box
-        $("#editMemberTypeDialog").dialog({
-            autoOpen: false,
-            minWidth: 400,
-            dialogClass: "glm-dialog-no-close"
-        });
-        $('.editMemberType').click( function() {
-        var typeID = $(this).attr('data-memberTypeID');
-        var typeName = $(this).text();
-        
-        
-//        var typeDescr = $('#editMemberTypeDescr_' + typeID).html();
-        $('#glmSocName').text(typeName);
-        $('#editMemberTypeName').val(typeName.trim());
-//        $('#editMemberTypeDescr').val(typeDescr.trim());
-        $("#editMemberTypeDialog").dialog("open");
-        });
-        $('#editMemberTypeCancel').click( function() {
-            $("#editMemberTypeDialog").dialog("close");
-        });
-
-    });
-
-</script>
-{include file='admin/footer.html'}
diff --git a/views/admin/social/index.html b/views/admin/social/index.html
new file mode 100644 (file)
index 0000000..a2fb00a
--- /dev/null
@@ -0,0 +1,77 @@
+{if $lockedToMember}
+<div class="wrap">
+       
+    <h2>
+        {if $haveMember}
+            {$terms.term_member_cap}: <span class="glm-notice">{$memberName}</span>
+        {else}
+            New {$terms.term_member_cap}
+        {/if}
+    </h2>
+
+    <div id="glm-admin-content-container">
+    
+{else}
+    {include file='admin/member/header.html'}
+{/if}
+<h2>{if $urlUpdated}<span class="glm-notice glm-flash-updated glm-right">{$statusMessage}</span>{/if}</h2>
+    <h3>Social Media URLs</h3>
+    
+    <div id="glm-admin-content-container">
+{if $lockedToMember}
+        <form action="{$thisUrl}?page={$thisPage}&glm_action=index" method="post" enctype="multipart/form-data">
+{else}
+        <form action="{$thisUrl}?page={$thisPage}&glm_action=social&member={$memberID}" method="post" enctype="multipart/form-data">
+{/if}
+            <input type="hidden" name="option" value="submit">
+            {foreach from=$socials key=k item=socialItem}
+                {if !$socialItem.active.value}
+                <input type="hidden" name="socialUrl[{$socialItem.id}]" value="{if isset($socialItem.url)}{$socialItem.url}{/if}">
+                {/if}
+            {/foreach}
+            <table class="wp-list-table striped glm-admin-table">
+                <thead>
+                    <tr>
+                        <th>Social Media Type</th>
+                        <th>Icon</th>
+                        <th>URL</th>
+                    </tr>
+                </thead>
+                <tbody>
+            {foreach from=$socials key=k item=socialItem}
+                {if $socialItem.active.value}
+                    {$socialField = $socialItem.name|lower}
+                    <tr>
+                        <th>
+                            {$socialItem.name}
+                        </th>
+                        <td>
+                            <img alt="Embedded Image" src="data:image/png;base64,{$socialItem.b64icon}">
+                        </td>
+                        <td>
+                            <input type="text" id="{$socialItem.name|lower}" 
+                                name="socialUrl[{$socialItem.id}]" 
+                                class="glm-form-text-input" 
+                                value="{if isset($socialItem.url)}{$socialItem.url}{/if}"
+                                placeholder="{if $socialItem.baseurl!=''}http://{$socialItem.baseurl}/...{else}{$socialItem.name}{/if}"> 
+                        </td>
+                    </tr>
+                {/if}
+            {/foreach}
+                </tbody>
+            </table>
+            <input type="submit" class="button glm-button submit" value="submit" name='submit'>
+        </form>
+    </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>
+{include file='admin/footer.html'}