Add contact settings and update edit contact page.
authorSteve Sutton <steve@gaslightmedia.com>
Wed, 24 Apr 2019 18:21:38 +0000 (14:21 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Wed, 24 Apr 2019 18:21:38 +0000 (14:21 -0400)
Adding new options
enable_billing_info
enable_contact_info
enable_profile_image
enable_organization

classes/data/dataSettings.php [new file with mode: 0644]
index.php
models/admin/settings/contacts.php [new file with mode: 0644]
setup/adminTabs.php
setup/databaseScripts/create_database_V0.0.7.sql [deleted file]
setup/databaseScripts/create_database_V0.0.8.sql [new file with mode: 0644]
setup/databaseScripts/dbVersions.php
setup/databaseScripts/update_database_V0.0.8.sql [new file with mode: 0644]
setup/validActions.php
views/admin/contacts/edit.html
views/admin/settings/contacts.html [new file with mode: 0644]

diff --git a/classes/data/dataSettings.php b/classes/data/dataSettings.php
new file mode 100644 (file)
index 0000000..e35917e
--- /dev/null
@@ -0,0 +1,165 @@
+<?php
+/**
+ * GLM Member-DB WordPress Add-On Plugin
+ * Contacts data class
+ *
+ * PHP version 5.3
+ *
+ * @category Data
+ * @package  GLM Member-DB
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @release  SVN: $Id: dataContacts.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+/**
+ * GlmDataContacts class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package EventManagement
+ * @author Chuck Scott <cscott@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 GlmDataContactSettings 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;
+    public $postProcess = true;
+
+    /**
+     * 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_CONTACTS_PLUGIN_DB_PREFIX . 'settings';
+
+        /*
+         * Table Data Fields
+         */
+
+        $this->fields = array (
+
+            'id' => array (
+                'field' => 'id',
+                'type' => 'integer',
+                'view_only' => true,
+                'use' => 'a'
+            ),
+
+            'enable_custom_contact' => array (
+                'field' => 'enable_custom_contact',
+                'type' => 'checkbox',
+                'default' => true,
+                'use' => 'a'
+            ),
+
+            'enable_contact_info' => array (
+                'field' => 'enable_contact_info',
+                'type' => 'checkbox',
+                'default' => false,
+                'use' => 'a'
+            ),
+
+            'enable_profile_image' => array (
+                'field' => 'enable_profile_image',
+                'type' => 'checkbox',
+                'default' => false,
+                'use' => 'a'
+            ),
+
+            'enable_billing_info' => array (
+                'field' => 'enable_billing_info',
+                'type' => 'checkbox',
+                'default' => false,
+                'use' => 'a'
+            ),
+
+            'enable_organization' => array (
+                'field' => 'enable_organization',
+                'type' => 'checkbox',
+                'default' => false,
+                'use' => 'a'
+            ),
+
+        );
+
+    }
+
+    public function entryPostProcessing($r, $a)
+    {
+
+        return $r;
+    }
+
+
+}
index aaade85..bd68e22 100644 (file)
--- a/index.php
+++ b/index.php
@@ -40,7 +40,7 @@ if (!defined('ABSPATH')) {
  *  version nunmber of that release for the DB version.
  */
 define('GLM_MEMBERS_CONTACTS_PLUGIN_VERSION', '1.1.11');
-define('GLM_MEMBERS_CONTACTS_PLUGIN_DB_VERSION', '0.0.7');
+define('GLM_MEMBERS_CONTACTS_PLUGIN_DB_VERSION', '0.0.8');
 
 // This is the minimum version of the GLM Members DB plugin require for this plugin.
 define('GLM_MEMBERS_CONTACTS_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION', '1.0.58');
@@ -129,6 +129,12 @@ if (version_compare($glmMembersDatabasePluginVersion, GLM_MEMBERS_CONTACTS_PLUGI
 require_once GLM_MEMBERS_CONTACTS_PLUGIN_SETUP_PATH.'/validActions.php';
 require_once GLM_MEMBERS_CONTACTS_PLUGIN_SETUP_PATH.'/shortcodes.php';
 require_once GLM_MEMBERS_CONTACTS_PLUGIN_DB_SCRIPTS.'/dbVersions.php';
+
+// Load Events Management Settings data
+$contactsSettings = $wpdb->get_row( "SELECT * FROM ".GLM_MEMBERS_CONTACTS_PLUGIN_DB_PREFIX."settings WHERE id = 1", ARRAY_A );
+
+unset($contactsSettings['id']);
+
 function glmMembersRegisterContacts($addOns) {
 
     // Add this add-on to the add-ons array
@@ -138,6 +144,9 @@ function glmMembersRegisterContacts($addOns) {
             'short_name' => GLM_MEMBERS_CONTACTS_PLUGIN_SHORT_NAME,
             'slug' => GLM_MEMBERS_CONTACTS_PLUGIN_SLUG,
             'actions' => $GLOBALS['glmMembersContactsAddOnValidActions'],
+            'config' => array(
+                'settings' => $GLOBALS['contactsSettings']
+            ),
             'database' => array(
                 'dbPrefix' => GLM_MEMBERS_CONTACTS_PLUGIN_DB_PREFIX,
                 'dbCurrentVersion' => GLM_MEMBERS_CONTACTS_PLUGIN_DB_VERSION,
diff --git a/models/admin/settings/contacts.php b/models/admin/settings/contacts.php
new file mode 100644 (file)
index 0000000..6866752
--- /dev/null
@@ -0,0 +1,148 @@
+<?php
+/**
+ * Gaslight Media Members Database
+ * Admin Event Email Notification
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersDatabase
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @version  0.1
+ */
+
+// Load Event Categories data abstract
+require_once GLM_MEMBERS_CONTACTS_PLUGIN_CLASS_PATH.'/data/dataSettings.php';
+
+/*
+ * This class performs the work for the default action of the "Members" menu
+ * option, which is to display the members dashboard.
+ *
+ */
+class GlmMembersAdmin_settings_contacts extends GlmDataContactSettings
+{
+
+    /**
+     * WordPress Database Object
+     *
+     * @var $wpdb
+     * @access public
+     */
+    public $wpdb;
+    /**
+     * Plugin Configuration Data
+     *
+     * @var $config
+     * @access public
+     */
+    public $config;
+
+    /*
+     * Constructor
+     *
+     * This contructor sets up this model. At this time that only includes
+     * storing away the WordPress data object.
+     *
+     * @return object Class object
+     *
+     */
+    public function __construct ($wpdb, $config)
+    {
+
+        // Save WordPress Database object
+        $this->wpdb = $wpdb;
+
+        // Save plugin configuration object
+        $this->config = $config;
+
+        // Run constructor for members data class
+        parent::__construct(false, false);
+
+    }
+
+    /*
+     * Perform Model Action
+     *
+     * This method does the work for this model and returns any resulting data
+     *
+     * @return array Status and data array
+     *
+     * 'status'
+     *
+     * True if successfull and false if there was a fatal failure.
+     *
+     * 'menuItemRedirect'
+     *
+     * If not false, provides a menu item the controller should
+     * execute after this one. Normally if this is used, there would also be a
+     * modelRedirect value supplied as well.
+     *
+     * 'modelRedirect'
+     *
+     * If not false, provides an action the controller should execute after
+     * this one.
+     *
+     * 'view'
+     *
+     * A suggested view name that the controller 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.
+     *
+     */
+    public function modelAction ($actionData = false)
+    {
+
+        $success         = true;
+        $error           = false;
+        $contactSettings = false;
+
+        $contactSettings = $this->getEntry( 1 );
+
+        // If there's an action option
+        if ( isset( $_REQUEST['option'] ) ) {
+
+            switch( $_REQUEST['option'] ) {
+
+                case 'update':
+                    $this->updateEntry( 1 );
+
+                    break;
+            }
+
+        }
+
+        $contactSettings = $this->getEntry( 1 );
+        // If we had a fatal error, redirect to the error page
+        if ( $error ) {
+            return array(
+                'status' => $success,
+                'menuItemRedirect' => 'error',
+                'modelRedirect'    => 'index',
+                'view'             => 'admin/error/index.html',
+                'data'             => false
+            );
+        }
+
+        // Compile template data
+        $templateData = array(
+            'contactSettings' => $contactSettings
+        );
+
+        // Return status, suggested view, and data to controller
+        return array(
+            'status'           => $success,
+            'menuItemRedirect' => false,
+            'modelRedirect'    => false,
+            'view'             => 'admin/settings/contacts.html',
+            'data'             => $templateData
+        );
+
+    }
+
+}
index 52a0947..402de43 100644 (file)
@@ -127,6 +127,21 @@ if (current_user_can('glm_members_members')) {
         );
     }
 
+    add_filter('glm-member-db-add-tab-for-settings',
+        function($addOnTabs) {
+            $newTabs = array(
+                array(
+                    'text'   => 'Contacts',
+                    'menu'   => 'settings',
+                    'action' => 'contacts'
+                ),
+
+            );
+            $addOnTabs = array_merge($addOnTabs, $newTabs);
+            return $addOnTabs;
+        }
+    );
+
 }
 if (current_user_can('glm_members_management')) {
     add_filter('glm-member-db-add-tab-for-import',
diff --git a/setup/databaseScripts/create_database_V0.0.7.sql b/setup/databaseScripts/create_database_V0.0.7.sql
deleted file mode 100644 (file)
index 13b8205..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
--- Gaslight Media Members Database
--- File Created: 12/09/14 15:27:15
--- Database Version: 0.0.7
--- Database Creation Script - Contacts Add-On
---
--- To permit each query below to be executed separately,
--- all queries must be separated by a line with four dashes
---
--- **** BE SURE TO ALSO UPDATE drop_database_Vxxx.sql FILE WHEN CHANGING TABLES ****
---
-
--- Contacts - used by various entities
-CREATE TABLE {prefix}contacts (
-  id INT NOT NULL AUTO_INCREMENT,
-  active BOOLEAN NULL,                      -- Contact is active flag
-  access INT NULL,                          -- Access type - See access table in plugin.ini
-  primary_contact BOOLEAN NULL,             -- Contact is the "Primary Contact" for mailings to entity (ref_type/ref_dest)
-  fname TINYTEXT NULL,                      -- First name of contact
-  lname TINYTEXT NULL,                      -- Last name of contact
-  contact_type INT NULL,                    -- Contact type - see contact_type table (individual, role, ...)
-  contact_role INT NULL,                    -- Contact WordPress user Role
-  org TINYTEXT NULL,                        -- Organization name
-  title TINYTEXT NULL,                      -- Title/Position
-  descr TEXT NULL,                          -- Description of position/responsibilities - Displayed
-  image TINYTEXT NULL,                      -- Image
-  addr1 TINYTEXT NULL,                      -- Address line 1 - Address is for contact, not necessarily for organization
-  addr2 TINYTEXT NULL,                      -- Address line 2
-  county TINYTEXT NULL,                     -- County
-  city INT NULL,                            -- Pointer to city in cities table
-  state TINYTEXT NULL,                      -- Two character state code - matches states.ini entries
-  country TINYTEXT NULL,                    -- Two character country code - matches countries.ini entries
-  zip TINYTEXT NULL,                        -- ZIP/Postal Code
-  lat FLOAT NULL,                           -- Latitude of contact location
-  lon FLOAT NULL,                           -- Longitude of contact location
-  url TINYTEXT NULL,                        -- URL to information regarding this contact
-  home_phone TINYTEXT NULL,                 -- Home phone number - or after-hours phone number
-  mobile_phone TINYTEXT NULL,               -- Mobile phone number
-  alt_phone TINYTEXT NULL,                  -- An alternate phone number
-  email TINYTEXT NULL,                      -- E-Mail address
-  alt_email TINYTEXT NULL,                  -- Alternate E-Mail address - Also used to log-in
-  username TINYTEXT NULL,                   -- Optional username to use for login
-  password TINYTEXT NULL,                   -- Encrypted password
-  notes TEXT NULL,                          -- Notes - Not displayed on front-end
-  create_time TIMESTAMP NULL,               -- Create date/time
-  modify_time TIMESTAMP NULL,               -- Last modified date/time
-  ref_type INT NULL,                        -- Type of entity this contact is associated with
-  ref_dest INT NULL,                        -- Pointer to the specific entity of ref_type this contact is associated with
-  business_fname TINYTEXT NULL,             -- Org First Name
-  business_lname TINYTEXT NULL,             -- Org Last Name
-  business_addr1 TINYTEXT NULL,             -- Org Address 1
-  business_addr2 TINYTEXT NULL,             -- Org Address 2
-  business_city INT NULL,                   -- Org City
-  business_state TINYTEXT NULL,             -- Org State
-  business_zip TINYTEXT NULL,               -- Org Zip
-  business_country TINYTEXT NULL,           -- Org Country
-  business_email TINYTEXT NULL,             -- Org Email
-  business_phone TINYTEXT NULL,             -- Org Phone in Directory
-  office_phone TINYTEXT NULL,               -- Org Office phone number
-  business_mobile TINYTEXT NULL,            -- Org Mobile
-  fax TINYTEXT NULL,                        -- Org FAX number (do people still use these?)
-  contact_publish BOOLEAN NULL,             -- Flag to publish Contact Info to Directory
-  contact_use_billing BOOLEAN NULL,         -- Flag to use Contact Info as Billing
-  business_publish BOOLEAN NULL,            -- Flag to publish Business to Directory
-  business_use_billing BOOLEAN NULL,        -- Flag to use Business as Billing
-  mailing_address_type TINYTEXT NULL,       -- Mailing Address Type
-  mailto_label TINYTEXT NULL,               -- Mail To Label
-  PRIMARY KEY (id),
-  INDEX(fname(20)),
-  INDEX(lname(20)),
-  INDEX(city),
-  INDEX(zip(10)),
-  INDEX(lat),
-  INDEX(lon),
-  INDEX(email(20))
-);
diff --git a/setup/databaseScripts/create_database_V0.0.8.sql b/setup/databaseScripts/create_database_V0.0.8.sql
new file mode 100644 (file)
index 0000000..af7da90
--- /dev/null
@@ -0,0 +1,93 @@
+-- Gaslight Media Members Database
+-- File Created: 12/09/14 15:27:15
+-- Database Version: 0.0.8
+-- Database Creation Script - Contacts Add-On
+--
+-- To permit each query below to be executed separately,
+-- all queries must be separated by a line with four dashes
+--
+-- **** BE SURE TO ALSO UPDATE drop_database_Vxxx.sql FILE WHEN CHANGING TABLES ****
+--
+
+-- Contacts - used by various entities
+CREATE TABLE {prefix}contacts (
+    id INT NOT NULL AUTO_INCREMENT,
+    active BOOLEAN NULL,                      -- Contact is active flag
+    access INT NULL,                          -- Access type - See access table in plugin.ini
+    primary_contact BOOLEAN NULL,             -- Contact is the "Primary Contact" for mailings to entity (ref_type/ref_dest)
+    fname TINYTEXT NULL,                      -- First name of contact
+    lname TINYTEXT NULL,                      -- Last name of contact
+    contact_type INT NULL,                    -- Contact type - see contact_type table (individual, role, ...)
+    contact_role INT NULL,                    -- Contact WordPress user Role
+    org TINYTEXT NULL,                        -- Organization name
+    title TINYTEXT NULL,                      -- Title/Position
+    descr TEXT NULL,                          -- Description of position/responsibilities - Displayed
+    image TINYTEXT NULL,                      -- Image
+    addr1 TINYTEXT NULL,                      -- Address line 1 - Address is for contact, not necessarily for organization
+    addr2 TINYTEXT NULL,                      -- Address line 2
+    county TINYTEXT NULL,                     -- County
+    city INT NULL,                            -- Pointer to city in cities table
+    state TINYTEXT NULL,                      -- Two character state code - matches states.ini entries
+    country TINYTEXT NULL,                    -- Two character country code - matches countries.ini entries
+    zip TINYTEXT NULL,                        -- ZIP/Postal Code
+    lat FLOAT NULL,                           -- Latitude of contact location
+    lon FLOAT NULL,                           -- Longitude of contact location
+    url TINYTEXT NULL,                        -- URL to information regarding this contact
+    home_phone TINYTEXT NULL,                 -- Home phone number - or after-hours phone number
+    mobile_phone TINYTEXT NULL,               -- Mobile phone number
+    alt_phone TINYTEXT NULL,                  -- An alternate phone number
+    email TINYTEXT NULL,                      -- E-Mail address
+    alt_email TINYTEXT NULL,                  -- Alternate E-Mail address - Also used to log-in
+    username TINYTEXT NULL,                   -- Optional username to use for login
+    password TINYTEXT NULL,                   -- Encrypted password
+    notes TEXT NULL,                          -- Notes - Not displayed on front-end
+    create_time TIMESTAMP NULL,               -- Create date/time
+    modify_time TIMESTAMP NULL,               -- Last modified date/time
+    ref_type INT NULL,                        -- Type of entity this contact is associated with
+    ref_dest INT NULL,                        -- Pointer to the specific entity of ref_type this contact is associated with
+    business_fname TINYTEXT NULL,             -- Org First Name
+    business_lname TINYTEXT NULL,             -- Org Last Name
+    business_addr1 TINYTEXT NULL,             -- Org Address 1
+    business_addr2 TINYTEXT NULL,             -- Org Address 2
+    business_city INT NULL,                   -- Org City
+    business_state TINYTEXT NULL,             -- Org State
+    business_zip TINYTEXT NULL,               -- Org Zip
+    business_country TINYTEXT NULL,           -- Org Country
+    business_email TINYTEXT NULL,             -- Org Email
+    business_phone TINYTEXT NULL,             -- Org Phone in Directory
+    office_phone TINYTEXT NULL,               -- Org Office phone number
+    business_mobile TINYTEXT NULL,            -- Org Mobile
+    fax TINYTEXT NULL,                        -- Org FAX number (do people still use these?)
+    contact_publish BOOLEAN NULL,             -- Flag to publish Contact Info to Directory
+    contact_use_billing BOOLEAN NULL,         -- Flag to use Contact Info as Billing
+    business_publish BOOLEAN NULL,            -- Flag to publish Business to Directory
+    business_use_billing BOOLEAN NULL,        -- Flag to use Business as Billing
+    mailing_address_type TINYTEXT NULL,       -- Mailing Address Type
+    mailto_label TINYTEXT NULL,               -- Mail To Label
+    PRIMARY KEY (id),
+    INDEX(fname(20)),
+    INDEX(lname(20)),
+    INDEX(city),
+    INDEX(zip(10)),
+    INDEX(lat),
+    INDEX(lon),
+    INDEX(email(20))
+    );
+
+----
+
+-- Settings
+CREATE TABLE {prefix}settings (
+    id INT NOT NULL AUTO_INCREMENT,
+    enable_custom_contact BOOLEAN DEFAULT false,    -- Enable / Disable Custom Contact
+    enable_contact_info BOOLEAN DEFAULT true,       -- Enable / Disable Contact Info
+    enable_profile_image BOOLEAN DEFAULT true,      -- Enable / Disable Profile Image
+    enable_billing_info BOOLEAN DEFAULT false,      -- Enable / Disable Billing Info
+    enable_organization BOOLEAN DEFAULT false,      -- Enable / Disable Organization
+    PRIMARY KEY (id)
+);
+
+----
+
+-- Insert into settings
+INSERT INTO {prefix}settings ( id,enable_custom_contact, enable_contact_info, enable_profile_image, enable_billing_info, enable_organization ) VALUES ( 1, false, true, true, false, false );
index 0e35b6e..1d78618 100644 (file)
@@ -34,6 +34,7 @@ $glmMembersContactsDbVersions = array(
     '0.0.5' => array('version' => '0.0.5', 'tables' => 1, 'date' => '07/26/2018'),
     '0.0.6' => array('version' => '0.0.6', 'tables' => 1, 'date' => '07/26/2018'),
     '0.0.7' => array('version' => '0.0.7', 'tables' => 1, 'date' => '08/09/2018'),
+    '0.0.8' => array('version' => '0.0.8', 'tables' => 2, 'date' => '04/24/2019'),
 );
 
 
diff --git a/setup/databaseScripts/update_database_V0.0.8.sql b/setup/databaseScripts/update_database_V0.0.8.sql
new file mode 100644 (file)
index 0000000..775cf80
--- /dev/null
@@ -0,0 +1,23 @@
+-- Gaslight Media Members Database  - Contacts Add-On
+-- File Created: 04/24/19
+-- Database Version: 0.0.8
+-- Database Update From Previous Version Script
+--
+-- To permit each query below to be executed separately,
+-- all queries must be separated by a line with four dashes
+
+-- Settings
+CREATE TABLE {prefix}settings (
+    id INT NOT NULL AUTO_INCREMENT,
+    enable_custom_contact BOOLEAN DEFAULT false,    -- Enable / Disable Custom Contact
+    enable_contact_info BOOLEAN DEFAULT true,       -- Enable / Disable Contact Info
+    enable_profile_image BOOLEAN DEFAULT true,      -- Enable / Disable Profile Image
+    enable_billing_info BOOLEAN DEFAULT false,      -- Enable / Disable Billing Info
+    enable_organization BOOLEAN DEFAULT false,      -- Enable / Disable Organization
+    PRIMARY KEY (id)
+);
+
+----
+
+-- Insert into settings
+INSERT INTO {prefix}settings ( id,enable_custom_contact, enable_contact_info, enable_profile_image, enable_billing_info, enable_organization ) VALUES ( 1, false, true, true, false, false );
index 7755cfd..c7f433c 100644 (file)
@@ -51,6 +51,9 @@ $glmMembersContactsAddOnValidActions = array(
         'management' => array(
             'contacts' => GLM_MEMBERS_CONTACTS_PLUGIN_SLUG,
         ),
+        'settings' => array(
+            'contacts' => GLM_MEMBERS_CONTACTS_PLUGIN_SLUG,
+        ),
         'import' => array(
             'contacts' => GLM_MEMBERS_CONTACTS_PLUGIN_SLUG,
         ),
index af864f9..426319b 100644 (file)
@@ -1,3 +1,4 @@
+{* This view is used for both admin/manager and contact own entity manager *}
 <div id="glm-admin-contact-wrapper">
 
     {if !$contactEditOwnRecord}
         <form action="{$thisUrl}?page=glm-members-admin-menu-contacts" method="post" enctype="multipart/form-data">
             <input type="hidden" name="glm_action" value="index">
     {/if}
+            <input type="hidden" name="business_publish" value="on">
             <input type="hidden" name="member" value="{$memberData.id}">
         {if $option == 'create'}
             <input type="hidden" name="option" value="addNew">
                     <div id="glm-contact-account-profile">
 
                         <table class="glm-admin-table glm-admin-table-inner">
-                <!--            <table class="glm-admin-table glm-shrink">-->
                             <tr>
                         {if $haveMember}
                                 <th>
 
                         {/if}
 
-                            <tr>
+                            <tr{if !$settings.enable_profile_image} class="glm-hidden"{/if}>
                                 <th {if $contactInfo.fieldRequired.image}class="glm-required"{/if}>Profile Image</th>
                                 <td {if $contactInfo.fieldFail.image}class="glm-form-bad-input"{/if}>
                         {if $contactInfo.fieldData.image}
                     </div>
                 </div>
 
-                <div id="glm-contact-company-info-toggle" class="glm-contact-content-toggle">
+                <div id="glm-contact-company-info-toggle" class="glm-contact-content-toggle{if !$settings.enable_organization} glm-hidden{/if}">
                     <h3 class="section-title">Organization / Company Information</h3>
                 </div>
                 <div id="glm-contact-company-info-container" class="glm-admin-form-section glm-contact-content-data">
                     <div id="glm-contact-company-info">
                         <table class="glm-admin-table glm-admin-table-inner">
-                            <tr>
-                                <td>
-                                    <span class="glm-label">Publish on Front End</span>
-                                    <input type="checkbox" class="glm-contacts-checkbox" name="business_publish" {if $contactInfo.fieldData.business_publish.value} checked{/if}>
-                                </td>
-                            </tr>
                             <tr>
                                 <td>
                                     <span class="glm-label">Use for Billing Information</span>
                 </div>
 
             {if apply_filters( 'glm-members-billing-enabled', false )}
-                <div id="glm-contact-billing-fields-toggle" class="glm-contact-content-toggle">
+                <div id="glm-contact-billing-fields-toggle" class="glm-contact-content-toggle{if !$settings.enable_billing_info} glm-hidden{/if}">
                     <h3 class="section-title">Billing Info</h3>
                 </div>
                 <div id="glm-contact-billing-fields-container" class="glm-admin-form-section glm-contact-content-data">
             {/if}
 
 
-                <div id="glm-contact-account-contact-toggle" class="glm-contact-content-toggle">
+                <div id="glm-contact-account-contact-toggle" class="glm-contact-content-toggle{if !$settings.enable_account_info} glm-hidden{/if}">
                     <h3 class="section-title">Account Contact Info</h3>
                 </div>
                 <div id="glm-contact-account-contact-container" class="glm-admin-form-section glm-contact-content-data">
                     <div id="glm-contact-account-contact">
 
                         <table class="glm-admin-table glm-admin-table-inner">
-                            <tr>
-                                <td>
-                                    <span class="glm-label">Publish on Front End</span>
-                                    <input type="checkbox" class="glm-contacts-checkbox" name="contact_publish" {if $contactInfo.fieldData.contact_publish.value} checked{/if}>
-                                </td>
-                            </tr>
                             <tr>
                                 <td>
                                     <span class="glm-label">Use for Billing Information</span>
diff --git a/views/admin/settings/contacts.html b/views/admin/settings/contacts.html
new file mode 100644 (file)
index 0000000..defa1d6
--- /dev/null
@@ -0,0 +1,49 @@
+{* Contact Setting View *}
+{include file='admin/settings/header.html'}
+
+<form action="{$thisUrl}?page={$thisPage}" method="post" enctype="multipart/form-data">
+    <input type="hidden" name="glm_action" value="contacts" />
+    <input type="hidden" name="option" value="update" />
+    <div class="glm-row">
+        <div class="glm-small-12 glm-medium-9 glm-columns email-notification-editor">
+            <label>
+                <input class="glm-form-text-input-medium-long" name="enable_custom_contact" type="checkbox" {if $contactSettings.enable_custom_contact.value}checked{/if} />
+            Enable Custom Contact
+            </label>
+        </div>
+        <div class="glm-small-12 glm-medium-9 glm-columns email-notification-editor">
+            <label>
+                <input class="glm-form-text-input-medium-long" name="enable_contact_info" type="checkbox" {if $contactSettings.enable_contact_info.value}checked{/if} />
+            Enable Contact Info
+            </label>
+        </div>
+        <div class="glm-small-12 glm-medium-9 glm-columns email-notification-editor">
+            <label>
+                <input class="glm-form-text-input-medium-long" name="enable_profile_image" type="checkbox" {if $contactSettings.enable_profile_image.value}checked{/if} />
+            Enable Profile Image
+            </label>
+        </div>
+        <div class="glm-small-12 glm-medium-9 glm-columns email-notification-editor">
+            <label>
+                <input class="glm-form-text-input-medium-long" name="enable_billing_info" type="checkbox" {if $contactSettings.enable_billing_info.value}checked{/if} />
+            Enable Billing Info
+            </label>
+        </div>
+        <div class="glm-small-12 glm-medium-9 glm-columns email-notification-editor">
+            <label>
+                <input class="glm-form-text-input-medium-long" name="enable_organization" type="checkbox" {if $contactSettings.enable_organization.value}checked{/if} />
+            Enable Organization/Company Info
+            </label>
+        </div>
+    </div>
+
+     <input type="submit" value="Update Settings" class="button-primary">
+</form>
+
+<script type="text/javascript">
+    jQuery(document).ready(function($) {
+
+    });
+</script>
+
+{include file='admin/footer.html'}