--- /dev/null
+<?php
+
+/**
+ * Gaslight Media Members Database Leads Add-On Plugin
+ * Activate Plugin Tasks
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabaseLeads
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release activate.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link http://dev.gaslightmedia.com/
+ */
+
+// Check that we're being called by WordPress.
+if (!defined('ABSPATH')) {
+ die("Please do not call this code directly!");
+}
+
+/*
+ * This class performs all necessary additional work when this
+ * plugin is activated.
+ *
+ * Currently the only actions are to add role capability to display and modify
+ * prototypes.
+ */
+class glmMembersLeadsPluginActivate
+{
+
+ /**
+ * WordPress Database Object
+ *
+ * @var $wpdb
+ * @access public
+ */
+ public $wpdb;
+ /**
+ * Plugin Configuration Data
+ *
+ * @var $config
+ * @access public
+ */
+ public $config;
+
+ /*
+ * Constructor
+ *
+ * Note that the $noDatabaseCheck is used to access the database versions
+ * without triggering a database check.
+ *
+ * Performs all the work for this model
+ */
+ public function __construct ($wpdb, $config)
+ {
+
+ // Make sure the current user has this capability
+ if (! current_user_can('activate_plugins')) {
+ $this->addNotice("Interesting, you don't have permission to activate plugins.");
+ die();
+ }
+
+ // Save WordPress Database object
+ $this->wpdb = $wpdb;
+
+ // Save plugin configuration object
+ $this->config = $config;
+
+ // Set current plugin version
+ update_option('glmMembersDatabaseLeadsPluginVersion', GLM_MEMBERS_LEADS_PLUGIN_VERSION);
+
+ // Set Roles and Capabilities for this plugin
+ require_once(GLM_MEMBERS_LEADS_PLUGIN_SETUP_PATH.'/rolesAndCapabilities.php');
+ }
+
+ /*
+ * Add a capability to all current roles
+ *
+ * @param string $capability Name of capability to add
+ * @param array $default Whether capability should be on by default
+ * array(
+ * 'author' => false,
+ * 'contributor' => false,
+ * 'editor' => false,
+ * 'subscriber' => false
+ * )
+ *
+ * @return void
+ * @access private
+ */
+ private function addRoleCapability($capability, $default)
+ {
+ // Get list of role objects
+ $roleObjects = $GLOBALS['wp_roles']->role_objects;
+
+ // Get list of roles we can edit
+ $roles = get_editable_roles();
+
+ // For each role object
+ foreach ($roleObjects as $key => $role) {
+
+ // Check if the role exists in list of editable roles and
+ // the capability does not exist
+ if (isset($roles[$key]) && ! isset($role->capabilities[$capability])) {
+
+ // Check if a default value has been specified in the $default array
+ $enabled = false;
+ if (isset($default[$role->name])) {
+
+ // It has, so use that
+ $enabled = $default[$role->name];
+
+ }
+
+ // Add the role
+ $role->add_cap($capability, $enabled);
+
+ }
+ }
+ }
+
+
+ /*
+ * Delete a capability from all current roles
+ *
+ * @param string $capability Name of capability to add
+ *
+ * @return void
+ * @access private
+ */
+ private function deleteRoleCapability($capability)
+ {
+ // Get list of role objects
+ $roleObjects = $GLOBALS['wp_roles']->role_objects;
+
+ // Get list of roles we can edit
+ $roles = get_editable_roles();
+
+ // For each role object
+ foreach ($roleObjects as $key => $role) {
+
+ if ( isset($role->capabilities[$capability])) {
+ $role->remove_cap($capability);
+ }
+
+ }
+
+ }
+
+
+
+}
--- /dev/null
+Assets folder for things like images and other
+files that might need to be read directly.
\ No newline at end of file
--- /dev/null
+<?php
+/**
+ * GLM Member-DB WordPress Add-On Plugin
+ * Data Class Leads
+ *
+ * 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: dataLeads.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+/**
+ * GlmDataLeads class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package GLM Member DB
+ * @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 GlmDataLeads 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;
+
+ /**
+ * 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_LEADS_PLUGIN_DB_PREFIX . 'leads';
+
+ /*
+ * 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
--- /dev/null
+;
+; Main Configuration File
+; Gaslight Media Members Database Leads Add-On Plugin
+;
+; Place any static configuration parameters here.
+;
+
+[common]
--- /dev/null
+Add admin.css and/or front.css to this directory to have those registered automatically.
\ No newline at end of file
--- /dev/null
+<?php
+/**
+ * Gaslight Media Members Database Leads Add-On Plugin
+ * Deactivate Plugin Tasks
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabaseLeads
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release admin.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link http://dev.gaslightmedia.com/
+ */
+
+// Check that we're being called by WordPress.
+if (!defined('ABSPATH')) {
+ die("Please do not call this code directly!");
+}
+
+/*
+ * This class performs all necessary additional work when this
+ * plugin is deactivated.
+ */
+class glmMembersLeadsPluginDeactivate
+{
+
+ /**
+ * WordPress Database Object
+ *
+ * @var $wpdb
+ * @access public
+ */
+ public $wpdb;
+ /**
+ * Plugin Configuration Data
+ *
+ * @var $config
+ * @access public
+ */
+ public $config;
+
+ /*
+ * Constructor
+ *
+ * Performs all the work for this model
+ */
+ public function __construct ($wpdb, $config)
+ {
+
+ // Save WordPress Database object
+ $this->wpdb = $wpdb;
+
+ // Save plugin configuration object
+ $this->config = $config;
+
+ // Delete our version from WordPress Options
+ delete_option('glmMembersDatabaseLeadsPluginVersion');
+ }
+
+}
--- /dev/null
+<?php
+/**
+ * Gaslight Media Members Database Leads Child Plugin
+ *
+ * Set standard defined parameters
+ */
+
+// NOTE: Plugin & Database versions are defined in "/glm-member-db.php".
+
+define('GLM_MEMBERS_LEADS_PLUGIN_NAME', 'Gaslight Media Members Database Leads');
+define('GLM_MEMBERS_LEADS_PLUGIN_SHORT_NAME', 'Leads');
+define('GLM_MEMBERS_LEADS_PLUGIN_SLUG', 'glm-member-db-leads');
+
+// Database table prefixes - change if using add-on tables
+global $wpdb;
+define('GLM_MEMBERS_LEADS_PLUGIN_DB_PREFIX', $wpdb->prefix.'glm_membersLeads_');
+define('GLM_MEMBERS_LEADS_PLUGIN_ACTIVE_DB_OPTION', 'glmMembersLeadsDbVersion');
+
+// Determine which system we're running on - If not provided, assume PRODUCTION
+$host = getenv('GLM_HOST_ID');
+if (trim($host) == '') {
+ $host = 'PRODUCTION';
+}
+define('GLM_MEMBER_LEADS_PLUGIN_HOST', $host);
+
+// Determine current http/https protocol
+$pageProtocol = 'http';
+if (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == '443') {
+ $pageProtocol = 'https';
+}
+define('GLM_MEMBERS_LEADS_PLUGIN_HTTP_PROTOCOL', $pageProtocol);
+
+// Get various pieces of the URL
+$urlParts = parse_url(get_bloginfo('url'));
+$pageUri = explode('?', $_SERVER['REQUEST_URI']); // Bust this up to access URL path and script name only
+
+$WPUploadDir = wp_upload_dir();
+
+// URLs
+define('GLM_MEMBERS_LEADS_SITE_BASE_URL', home_url('/') );
+define('GLM_MEMBERS_LEADS_PLUGIN_URL', plugin_dir_url(__FILE__));
+define('GLM_MEMBERS_LEADS_PLUGIN_ADMIN_URL', admin_url('admin.php'));
+define('GLM_MEMBERS_LEADS_PLUGIN_BASE_URL', WP_PLUGIN_URL.'/'.GLM_MEMBERS_LEADS_PLUGIN_SLUG);
+define('GLM_MEMBERS_LEADS_PLUGIN_CURRENT_URL', $urlParts['scheme'].'://'.$urlParts['host'].$pageUri[0]);
+
+// Directories
+define('GLM_MEMBERS_LEADS_PLUGIN_PATH', dirname(__FILE__));
+define('GLM_MEMBERS_LEADS_PLUGIN_SETUP_PATH', GLM_MEMBERS_LEADS_PLUGIN_PATH.'/setup');
+define('GLM_MEMBERS_LEADS_PLUGIN_DB_SCRIPTS', GLM_MEMBERS_LEADS_PLUGIN_SETUP_PATH.'/databaseScripts');
+define('GLM_MEMBERS_LEADS_PLUGIN_CLASS_PATH', GLM_MEMBERS_LEADS_PLUGIN_PATH.'/classes');
+define('GLM_MEMBERS_LEADS_PLUGIN_CONFIG_PATH', GLM_MEMBERS_LEADS_PLUGIN_PATH.'/config');
+
+// Parameters related to the Main GLM Member DB plugin - Depending on what's going on these may already defined by the main plugin
+$pluginsPath = str_replace(GLM_MEMBERS_LEADS_PLUGIN_SLUG, '', GLM_MEMBERS_LEADS_PLUGIN_PATH);
+define('GLM_MEMBERS_LEADS_MAIN_PLUGIN_PATH', $pluginsPath.'/glm-member-db');
+define('GLM_MEMBERS_LEADS_PLUGIN_LIB_PATH', GLM_MEMBERS_LEADS_MAIN_PLUGIN_PATH.'/lib');
+
<?php
/**
- * Plugin Name: GLM Members Database Sample
+ * Plugin Name: GLM Members Database Leads
* Plugin URI: http://www.gaslightmedia.com/
* Description: Gaslight Media Members Database.
* Version: 0.0.7
* License: GPL2
*/
-/**********************************************************************
- * NOTE: THIS IS A SAMPLE FILE - DO NOT USE UNMODIFIED
- *
- * Please change all references to sample, Sample, or SAMPLE to a name
- * appropriate for your new Add-On.
- *
- * This is the main file for this add-on. It is the file called by
- * WordPress to run aspects of this add-on.
- *
- * NOTE: Versions in this file must be reset as appropriate when
- * creating a new add-on. Be sure to preserve the versions listed
- * for "...MIN_MEMBERS_REQUIRED_VERSION".
- *
- * Remove this message before using this file in production!
- **********************************************************************/
-
/**
- * Gaslight Media Members Database Sample Add-On
+ * Gaslight Media Members Database Leads Add-On
* Index
*
* PHP version 5.5
*
* @category glmWordPressPluginChild
- * @package glmMembersDatabaseSampleAddOn
+ * @package glmMembersDatabaseLeadsAddOn
* @author Chuck Scott <cscott@gaslightmedia.com>
* @license http://www.gaslightmedia.com Gaslightmedia
* @version 1.1.1
* so that we're sure the other add-ons see an up to date
* version from this plugin.
*/
-define('GLM_MEMBERS_SAMPLE_PLUGIN_VERSION', '0.0.7');
-// define('GLM_MEMBERS_SAMPLE_PLUGIN_DB_VERSION', '0.0.1');
+define('GLM_MEMBERS_LEADS_PLUGIN_VERSION', '0.0.1');
+define('GLM_MEMBERS_LEADS_PLUGIN_DB_VERSION', '0.0.1');
// This is the minimum version of the GLM Members DB plugin require for this plugin.
-define('GLM_MEMBERS_SAMPLE_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION', '1.0.57');
+define('GLM_MEMBERS_LEADS_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION', '2.0.5');
// Check if plugin version is not current in WordPress option and if needed updated it
-if (GLM_MEMBERS_SAMPLE_PLUGIN_VERSION != get_option('glmMembersDatabaseSamplePluginVersion')) {
- update_option('glmMembersDatabaseSamplePluginVersion', GLM_MEMBERS_SAMPLE_PLUGIN_VERSION);
+if (GLM_MEMBERS_LEADS_PLUGIN_VERSION != get_option('glmMembersDatabaseLeadsPluginVersion')) {
+ update_option('glmMembersDatabaseLeadsPluginVersion', GLM_MEMBERS_LEADS_PLUGIN_VERSION);
}
/*
*/
// Check if database version should be defined and it isn't - This would be a plugin/add-on setup issue
-if (is_file(GLM_MEMBERS_SAMPLE_PLUGIN_PATH.'/setup/databaseScripts/dbVersions.php') && !defined('GLM_MEMBERS_SAMPLE_PLUGIN_DB_VERSION')) {
+if (is_file(GLM_MEMBERS_LEADS_PLUGIN_PATH.'/setup/databaseScripts/dbVersions.php') && !defined('GLM_MEMBERS_LEADS_PLUGIN_DB_VERSION')) {
die('You have database scripts but have not defined a current database version at the top of index.php for this plugin/add-on!');
}
+/*
+ * Check installation, activation, and version of main Member DB plugin
+ */
+
// Check for main plugin and that it's active
-function glmMembersSamplePluginRequired() {
+function glmMembersLeadsPluginRequired() {
echo '
<div class="error">
- <p>The '.GLM_MEMBERS_SAMPLE_PLUGIN_NAME.' add-on requires the base GLM Member DB plugin to be installed and active!</p>
- <p>The '.GLM_MEMBERS_SAMPLE_PLUGIN_NAME.' plugin has been de-activated.</p>
+ <p>The '.GLM_MEMBERS_LEADS_PLUGIN_NAME.' add-on requires the base GLM Member DB plugin to be installed and active!</p>
+ <p>The '.GLM_MEMBERS_LEADS_PLUGIN_NAME.' plugin has been de-activated.</p>
</div>
';
}
$plugin_name = 'glm-member-db/index.php';
$is_active = is_plugin_active($plugin_name);
if ($is_active != '1') {
- add_action( 'admin_notices', 'glmMembersSamplePluginRequired' );
- deactivate_plugins('/'.GLM_MEMBERS_SAMPLE_PLUGIN_SLUG.'/index.php');
+ add_action( 'admin_notices', 'glmMembersLeadsPluginRequired' );
+ deactivate_plugins('/'.GLM_MEMBERS_LEADS_PLUGIN_SLUG.'/index.php');
}
// Check for Minimum DB version for main Member DB
-function glmMembersPluginSampleMinVerRequired() {
+function glmMembersPluginLeadsMinVerRequired() {
echo '
<div class="error">
- <p>The '.GLM_MEMBERS_SAMPLE_PLUGIN_NAME.' requires that the main GLM Member DB plugin version be no older than '
- .GLM_MEMBERS_SAMPLE_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION.'!<br>
- '.GLM_MEMBERS_SAMPLE_MIN_VERSION_NOTE.'</p>
- <p>The '.GLM_MEMBERS_SAMPLE_PLUGIN_NAME.' plugin has been de-activated.</p>
+ <p>The '.GLM_MEMBERS_LEADS_PLUGIN_NAME.' requires that the main GLM Member DB plugin version be no older than '
+ .GLM_MEMBERS_LEADS_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION.'!<br>
+ '.GLM_MEMBERS_LEADS_MIN_VERSION_NOTE.'</p>
+ <p>The '.GLM_MEMBERS_LEADS_PLUGIN_NAME.' plugin has been de-activated.</p>
</div>
';
}
$glmMembersDatabasePluginVersion = get_option('glmMembersDatabasePluginVersion');
-if (version_compare($glmMembersDatabasePluginVersion, GLM_MEMBERS_SAMPLE_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION) < 0) {
- define('GLM_MEMBERS_SAMPLE_MIN_VERSION_NOTE', "Members DB: $glmMembersDatabasePluginVersion, Sample Requires: ".GLM_MEMBERS_SAMPLE_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION);
- add_action( 'admin_notices', 'glmMembersPluginSampleMinVerRequired');
- deactivate_plugins('/'.GLM_MEMBERS_SAMPLE_PLUGIN_SLUG.'/'.GLM_MEMBERS_SAMPLE_PLUGIN_SLUG.'.php');
+if (version_compare($glmMembersDatabasePluginVersion, GLM_MEMBERS_LEADS_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION) < 0) {
+ define('GLM_MEMBERS_LEADS_MIN_VERSION_NOTE', "Members DB: $glmMembersDatabasePluginVersion, Leads Requires: ".GLM_MEMBERS_LEADS_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION);
+ add_action( 'admin_notices', 'glmMembersPluginLeadsMinVerRequired');
+ deactivate_plugins('/'.GLM_MEMBERS_LEADS_PLUGIN_SLUG.'/'.GLM_MEMBERS_LEADS_PLUGIN_SLUG.'.php');
}
/*
* Register this add-on with the main GLM Member DB plugin and get information on all add-ons loaded.
*/
-require_once(GLM_MEMBERS_SAMPLE_PLUGIN_SETUP_PATH.'/validActions.php');
-require_once(GLM_MEMBERS_SAMPLE_PLUGIN_SETUP_PATH.'/shortcodes.php');
-if (is_file(GLM_MEMBERS_SAMPLE_PLUGIN_DB_SCRIPTS.'/dbVersions.php')) {
- require_once(GLM_MEMBERS_SAMPLE_PLUGIN_DB_SCRIPTS.'/dbVersions.php');
+require_once(GLM_MEMBERS_LEADS_PLUGIN_SETUP_PATH.'/validActions.php');
+require_once(GLM_MEMBERS_LEADS_PLUGIN_SETUP_PATH.'/shortcodes.php');
+if (is_file(GLM_MEMBERS_LEADS_PLUGIN_DB_SCRIPTS.'/dbVersions.php')) {
+ require_once(GLM_MEMBERS_LEADS_PLUGIN_DB_SCRIPTS.'/dbVersions.php');
}
-// Load Sample Management Settings data
+// Load Leads Management Settings data
/* None - Need to figure out a smooth way to do this.
-$sampleManagementSettings = $wpdb->get_row( "SELECT * FROM ".GLM_MEMBERS_SAMPLE_PLUGIN_DB_PREFIX."management WHERE id = 1", ARRAY_A );
-unset($sampleManagementSettings['id']);
+$leadsManagementSettings = $wpdb->get_row( "SELECT * FROM ".GLM_MEMBERS_LEADS_PLUGIN_DB_PREFIX."management WHERE id = 1", ARRAY_A );
+unset($leadsManagementSettings['id']);
*/
-function glmMembersRegisterSample($addOns) {
+function glmMembersRegisterLeads($addOns) {
// Add this add-on to the add-ons array
- $addOns[GLM_MEMBERS_SAMPLE_PLUGIN_SLUG] = array(
- 'dir' => GLM_MEMBERS_SAMPLE_PLUGIN_PATH,
- 'name' => GLM_MEMBERS_SAMPLE_PLUGIN_NAME,
- 'short_name' => GLM_MEMBERS_SAMPLE_PLUGIN_SHORT_NAME,
- 'slug' => GLM_MEMBERS_SAMPLE_PLUGIN_SLUG,
- 'actions' => $GLOBALS['glmMembersSampleAddOnValidActions'],
+ $addOns[GLM_MEMBERS_LEADS_PLUGIN_SLUG] = array(
+ 'dir' => GLM_MEMBERS_LEADS_PLUGIN_PATH,
+ 'name' => GLM_MEMBERS_LEADS_PLUGIN_NAME,
+ 'short_name' => GLM_MEMBERS_LEADS_PLUGIN_SHORT_NAME,
+ 'slug' => GLM_MEMBERS_LEADS_PLUGIN_SLUG,
+ 'actions' => $GLOBALS['glmMembersLeadsAddOnValidActions'],
'config' => array(
),
- 'shortcodes' => $GLOBALS['glmMembersSampleShortcodes'],
- 'shortcodesDescription' => $GLOBALS['glmMembersSampleShortcodesDescription']
+ 'shortcodes' => $GLOBALS['glmMembersLeadsShortcodes'],
+ 'shortcodesDescription' => $GLOBALS['glmMembersLeadsShortcodesDescription']
);
// If we have database tables for this plugin/addon, provide that data also
- if (isset($GLOBALS['glmMembersSampleDbVersions'])) {
- $addOns[GLM_MEMBERS_SAMPLE_PLUGIN_SLUG]['database'] = array(
- 'dbPrefix' => GLM_MEMBERS_SAMPLE_PLUGIN_DB_PREFIX,
- 'dbCurrentVersion' => GLM_MEMBERS_SAMPLE_PLUGIN_DB_VERSION,
- 'dbActiveVersionOption' => GLM_MEMBERS_SAMPLE_PLUGIN_ACTIVE_DB_OPTION,
- 'dbScriptPath' => GLM_MEMBERS_SAMPLE_PLUGIN_DB_SCRIPTS,
- 'dbVersions' => $GLOBALS['glmMembersSampleDbVersions']
+ if (isset($GLOBALS['glmMembersLeadsDbVersions'])) {
+ $addOns[GLM_MEMBERS_LEADS_PLUGIN_SLUG]['database'] = array(
+ 'dbPrefix' => GLM_MEMBERS_LEADS_PLUGIN_DB_PREFIX,
+ 'dbCurrentVersion' => GLM_MEMBERS_LEADS_PLUGIN_DB_VERSION,
+ 'dbActiveVersionOption' => GLM_MEMBERS_LEADS_PLUGIN_ACTIVE_DB_OPTION,
+ 'dbScriptPath' => GLM_MEMBERS_LEADS_PLUGIN_DB_SCRIPTS,
+ 'dbVersions' => $GLOBALS['glmMembersLeadsDbVersions']
);
} else {
- $addOns[GLM_MEMBERS_SAMPLE_PLUGIN_SLUG]['database'] = false;
+ $addOns[GLM_MEMBERS_LEADS_PLUGIN_SLUG]['database'] = false;
}
// Return the array with our data added
return $addOns;
}
-add_filter('glm-member-db-register-addon','glmMembersRegisterSample', 10, 1);
+add_filter('glm-member-db-register-addon','glmMembersRegisterLeads', 10, 1);
/*
*
*/
// Activate
- function glmMembersSamplePluginActivate ()
+ function glmMembersLeadsPluginActivate ()
{
global $wpdb, $config;
- require_once (GLM_MEMBERS_SAMPLE_PLUGIN_PATH . '/activate.php');
- new glmMembersSamplePluginActivate($wpdb, $config);
+ require_once (GLM_MEMBERS_LEADS_PLUGIN_PATH . '/activate.php');
+ new glmMembersLeadsPluginActivate($wpdb, $config);
}
- register_activation_hook(__FILE__, 'glmMembersSamplePluginActivate');
+ register_activation_hook(__FILE__, 'glmMembersLeadsPluginActivate');
// Deactivate
- function glmMembersSamplePluginDeactivate ()
+ function glmMembersLeadsPluginDeactivate ()
{
global $wpdb, $config;
- require_once (GLM_MEMBERS_SAMPLE_PLUGIN_PATH . '/deactivate.php');
- $x = new glmMembersSamplePluginDeactivate($wpdb, $config);
+ require_once (GLM_MEMBERS_LEADS_PLUGIN_PATH . '/deactivate.php');
+ $x = new glmMembersLeadsPluginDeactivate($wpdb, $config);
return false;
}
- register_deactivation_hook(__FILE__, 'glmMembersSamplePluginDeactivate');
+ register_deactivation_hook(__FILE__, 'glmMembersLeadsPluginDeactivate');
/*
* Hooks for testing capabilities provided by this add-on
*/
-require_once(GLM_MEMBERS_SAMPLE_PLUGIN_SETUP_PATH.'/permissions.php');
+require_once(GLM_MEMBERS_LEADS_PLUGIN_SETUP_PATH.'/permissions.php');
--- /dev/null
+Add admin.js and/or front.js to this directory to have those registered automatically.
\ No newline at end of file
--- /dev/null
+Add an admin tab
+
+* Add a new section in setup/adminTabs.php
+
+* Add a model file - models/admin/{menu}/{action}.php
+
+* Add a view file - views/admin/{menu}/{action}.html
+
+* Add action to setup/validActions.php
+
+* If needed add a database table to the create_database_V...sql file
+ and update name to current database version, add an
+ update_database_V....sql file, and/or update dbVersions.php
+
+* If required add a data definition for any new tables
--- /dev/null
+Procedure to create a new GLM Members add-on plugin
+----------------------------------------------------
+
+* Checkout glm-member-db-sample and rename directory to glm-member-db-{add-on name}
+
+* Rename glm-member-db-sample.php to glm-member-db-{addon name}.php
+
+* Review all files and change references to "sample" (any case) to the new add-on name.
+ - Read the information in the "NOTE: THIS IS A SAMPLE FILE - DO NOT USE UNMODIFIED" and
+ do anything recommended there.
+ - Remove all of the "NOTE: THIS IS A SAMPLE FILE - DO NOT USE UNMODIFIED" blocks.
+
+* Create new repository named WP-Plugins/glm-member-db-{name of add-on}.git
+
+* If there are any databases associated with this add-on, setup the database scripts and
+ data under the "setup/databaseScripts" directory. If there are no database tables
+ with this add-on, remove all but the "readme.txt" file from that directory.
+ NOTE: No "update_database..." files should be there for a new add-on with new tables.
+ NOTE: There should be only one entry in the "dbVersions.php" file.
+
+* Carefully review "defines.php" file and update as needed.
+
+* Do a quick review of the readme.txt file and update as desired.
+
+* TEST - At this point the add-on should install and activate but not do anything.
+ - If there are any database tables, make sure they were created and are correct.
+ - Go to "Members" -> "Management" -> "Add-Ons" and make sure the add-on was
+ properly registered with the main plugin and that any database data is shown.
+
+* Adding menus
+ - Update "setup/adminMenus.php" and add menu section as described there.
+ - Add an entry in the validActions.php file. Pay attention to how slug name is
+ constructed ("glm-members-admin-{page}-{action}").
+ - If needed add a database table to the create_database_V...sql file
+ Also add a "classes/data/data{Table}.php file
+ - Add a model file as "models/admin/{page}/{action}.php
+ - Add any desired view file as "views/admin/{page}/{action}.html
+ Note that additional possible view files should be named as...
+ "views/admin/{page}/{action}{Name}.html
+ - Test that when add-on is activated that the menu shows and is functional.
+
+* Adding tabs
+ - Update "setup/admin/Tabs.php" and add new tab filter as described there.
+ - Add an entry in the validActions.php file. Pay attention to how slug name is
+ constructed ("glm-members-admin-{page}-{action}").
+ - If needed add a database table to the create_database_V...sql file
+ Also add a "classes/data/data{Table}.php file
+ - Add a model file as "models/admin/{page}/{action}.php
+ - Add any desired view file as "views/admin/{page}/{action}.html
+ Note that additional possible view files should be named as...
+ "views/admin/{page}/{action}{Name}.html
+ - Test that when add-on is activated that the tab shows and is functional.
+
+ *
\ No newline at end of file
--- /dev/null
+<?php
+/**
+ * Gaslight Media Members Database
+ * Admin Member User Profile
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Chuck Scott <cscott@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 Leads data abstract
+require_once(GLM_MEMBERS_LEADS_PLUGIN_CLASS_PATH.'/data/dataLeads.php');
+
+class GlmMembersAdmin_members_leads extends GlmDataLeads
+{
+
+ /**
+ * WordPress Database Object
+ *
+ * @var $wpdb
+ * @access public
+ */
+ public $wpdb;
+ /**
+ * Plugin Configuration Data
+ *
+ * @var $config
+ * @access public
+ */
+ public $config;
+
+ /*
+ * 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 data class
+ *
+ * Note, the third parameter is a flag that indicates to the
+ * data class that it should flag a group of fields as 'view_only'.
+ */
+ parent::__construct(false, false, true);
+
+
+ }
+
+ public function modelAction($actionData = false)
+ {
+
+ // 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/leads/index.html',
+ 'data' => $templateData
+ );
+
+ }
+
+
+}
--- /dev/null
+The admin controller executes models under this directory.
+
+Typically you should add a directory here that matches the page where the action should take place.
+
+Under that directory place the model for the various actions.
\ No newline at end of file
--- /dev/null
+The front controller executes models under this directory.
+
+Typically you should add a directory here that matches the category of actions that will take place.
+
+Under that directory place the model for the various actions.
+
+Actions under this directory would normally be called due to processing of a shortcode.
\ No newline at end of file
--- /dev/null
+=== Gaslight Media Member Database Leads Child Plugin ===
+Contributors: cscott@gaslightmedia.com
+Donate link: http://www.gaslightmedia.com
+Tags: Gaslight Media,Plugin,Members Leads
+Requires at least: 3.0.1
+Tested up to: 3.4
+Stable tag: 4.3
+License: GPLv2 or later
+License URI: http://www.gnu.org/licenses/gpl-2.0.html
+
+This is the Gaslight Media Members Database Leads Child Plugin.
+
+== Description ==
+
+The Gaslight Media Members Database Leads Child Plugin is an add-on to the Gaslight Media Members Database,
+which is required to install and run this plugin
+
+== Installation ==
+
+This section describes how to install the plugin and get it working.
+
+e.g.
+
+1. Upload `plugin-name.php` to the `/wp-content/plugins/` directory
+1. Activate the plugin through the 'Plugins' menu in WordPress
+
+
--- /dev/null
+<?php
+/**
+ * Gaslight Media Members Database
+ * GLM Members Misc Admin Hooks and Filters
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release adminHooks.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link http://dev.gaslightmedia.com/
+ */
+
+/*
+ * Place Misc Hooks and Filters here. If this file exists, it will be included
+ * by the add-on main plugin script.
+ *
+ * Note that filter and hook callback functions must be included in-line as shown below...
+ *
+ * add_filter( 'filter_title', function( $parameter ) {
+ * // Function code
+ * });
+ *
+ * Also note that parameters will be in the context of the main admin controller constructor.
+ */
--- /dev/null
+<?php
+/**
+ * Gaslight Media Members Database
+ * GLM Members DB - Leads Add-on - Admin Menus
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release admin.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link http://dev.gaslightmedia.com/
+ */
+
+/*
+ * Added menus or sub-menus examples
+ *
+ * // Add a main menu item
+ * add_menu_page(
+ * 'GLM Sample', // Page Title
+ * 'GLM Sample', // Menu Title
+ * 'glm-members-members', // Capability
+ * 'glm-members-admin-menu-glm-sample', // Menu Slug
+ * function() {$this->controller('sample');}, // Called function - typically controller() with the menu name
+ * false, // Icon URL
+ * '92' // Menu Position
+ * );
+ *
+ * // Add a sub-menu item
+ * add_submenu_page(
+ * 'glm-members-admin-menu-sample', // Parent slug
+ * 'Sample', // Page title
+ * 'Sample', // Menu Title
+ * 'glm_members_edit', // Capability required
+ * 'glm-members-admin-menu-sample', // Menu slug
+ * function() {$this->controller('sample');}
+ * );
+ *
+ * If creating a main menu item with add_menu_page(), please document
+ * that structure here.
+ *
+ * NOTE: The menu slug is the link for the page. It is also parsed by
+ * the controller and used to find the model to load. The
+ * "glm-members-admin-menu-" portion should not change, the last
+ * segment is the model directory name. By default the "index.php" file
+ * in that directory is executed. If the URL includes a "glm_action"
+ * parameter, then the model file called is in the same directory but
+ * is named the same as the "glm_action" parameter.
+ *
+ */
+
--- /dev/null
+<?php
+/**
+ * Gaslight Media Members Database
+ * GLM Members DB - Leads Add-on - Admin Tabs
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release admin.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link http://dev.gaslightmedia.com/
+ */
+
+/*
+ * To add a new tab to an existing Member DB page use a block
+ * like this and replace the {} parameters.
+ *
+ * add_filter('glm-member-db-add-tab-for-{menu name}',
+ * function($addOnTabs) {
+ * $newTabs = array(
+ * array(
+ * 'text' => '{text for display on tab}',
+ * 'menu' => '{menu name}',
+ * 'action' => '{action to perform}'
+ * )
+ * );
+ * $addOnTabs = array_merge($addOnTabs, $newTabs);
+ * return $addOnTabs;
+ * }
+ * );
+ *
+ */
+
--- /dev/null
+-- Gaslight Media Members Database - Leads
+-- File Created: 12/02/15 15:27:15
+-- Database Version: 0.0.1
+-- Database Creation Script
+--
+-- This file is called to create a new set of tables for this
+-- add-on for the most receint database version for this add-on.
+--
+-- There should only be one such file in this directory
+--
+-- To permit each query below to be executed separately,
+-- all queries must be separated by a line with four dashes
+
+
+-- Leads
+CREATE TABLE {prefix}leads (
+ id INT NOT NULL AUTO_INCREMENT,
+ email TINYTEXT NULL, -- Email address of lead
+ mail_ok BOOLEAN NULL, -- OK to send them E-Mail
+ member_ok BOOLEAN NULL, -- OK to have members contact lead
+ created DATETIME NULL, -- Timestamp lead was first added
+ PRIMARY KEY (id),
+ INDEX (email)
+);
+
+----
+
+-- Sources - info on form or method via which lead can be submitted
+CREATE TABLE {prefix}sources (
+ id INT NOT NULL AUTO_INCREMENT,
+ title TINYTEXT NULL, -- Title/Name of source for reference
+ code TINYTEXT NULL, -- Code supplied by form to indicate source
+ PRIMARY KEY (id),
+ INDEX (code)
+);
+
+----
+
+-- Lead Entry - Information on a single submission of lead infomration
+CREATE TABLE {prefix}lead_entry (
+ id INT NOT NULL AUTO_INCREMENT,
+ source_id SMALLINT NULL, -- Pointer to sources entry - Form used to submit lead data
+ lead_id INTEGER NULL, -- Pointer to lead - all submissions for same E-Mail address point to same leads entry
+ fname TINYTEXT NULL, -- First Name
+ lname TINYTEXT NULL, -- Last Name
+ org TINYTEXT NULL, -- Organization name
+ addr1 TINYTEXT NULL, -- Address line 1
+ addr2 TINYTEXT NULL, -- Address line 2
+ city TINYTEXT NULL, -- City name
+ state TINYTEXT NULL, -- State/Province - as submitted by Gravityforms or whatever (not state code)
+ zip TINYTEXT NULL, -- ZIP/Postal code
+ country TINYTEXT NULL, -- Country name - as submitted by form (not country code)
+ phone TINYTEXT NULL, -- Primary phone #
+ phone2 TINYTEXT NULL, -- Alternate phone #
+ fax TINYTEXT NULL, -- Fax #
+ how_heard SMALLINT NULL, -- Pointer to how_heard table entry
+ visit_date DATE NULL, -- Anticipated date of visit
+ date_submitted DATE NULL, -- Date this information was submitted
+ user_trace_info TINYTEXT NULL, -- User IP address and other identifying network info (pos referrer)
+ PRIMARY KEY (id),
+ INDEX (source_id),
+ INDEX (lead_id),
+ INDEX (fname),
+ INDEX (lname),
+ INDEX (visit_date),
+ INDEX (date_submitted)
+);
+
+----
+
+-- Interest Groups
+CREATE TABLE {prefix}interest_groups (
+ id INT NOT NULL AUTO_INCREMENT,
+ title TINYTEXT NULL, -- Group name
+ PRIMARY KEY (id),
+ INDEX (interest_id),
+ INDEX (lead_entry_id)
+);
+
+----
+
+-- Interests - Used to buil Interest fields in forms - Forms use ID as value
+CREATE TABLE {prefix}interests (
+ id INT NOT NULL AUTO_INCREMENT,
+ title TINYTEXT NULL, -- Title
+ group_id SMALLINT NULL, -- Pointer to interest group
+ PRIMARY KEY (id),
+ INDEX (group_id)
+);
+
+----
+
+-- Lead Interests - many to one links to lead-entry table
+CREATE TABLE {prefix}lead_interests (
+ id INT NOT NULL AUTO_INCREMENT,
+ interest_id SMALLINT NULL, -- Pointer to Interest table
+ lead_entry_id INTERGER NULL, -- Pointer to lead_entry table
+ PRIMARY KEY (id),
+ INDEX (interest_id),
+ INDEX (lead_entry_id)
+);
+
+----
+
+-- How Heard - List of possible responses to "how did you hear about ..." - Forms use ID as value
+CREATE TABLE {prefix}how_heard (
+ id INT NOT NULL AUTO_INCREMENT,
+ title TINYTEXT NULL, -- Interest Title
+ PRIMARY KEY (id)
+);
+
+----
+
+-- lead_searches - Memorized search configurations
+CREATE TABLE {prefix}searches (
+ id INT NOT NULL AUTO_INCREMENT,
+ title TINYTEXT NULL, -- Title for this search configuration
+ search TEXT NULL, -- Serialized array of search parameters
+ date_created DATE NULL, -- Date the search type was created
+ PRIMARY KEY (id)
+);
+
+----
+
+-- Lead Stats Date Data - Totals of lead stats for 1 day - Preserved for 2 years
+CREATE TABLE {prefix}lead_stats_date (
+ id INT NOT NULL AUTO_INCREMENT,
+ stat_date DATE NULL, -- Date for which these stats are accumulated
+ leads_count INTEGER NULL, -- Number of leads
+ PRIMARY KEY (id),
+ INDEX (stat_date)
+);
+
+----
+
+-- Lead Stats Week Data - Totals of lead stats for 1 week - Preserved for 2 years - (generated daily?)
+CREATE TABLE {prefix}lead_stats_week (
+ id INT NOT NULL AUTO_INCREMENT,
+ stat_week DATE NULL, -- First date of week for which these stats are accumulated
+ leads_count INTEGER NULL, -- Number of leads
+ PRIMARY KEY (id),
+ INDEX (state_week)
+);
+
+-- Lead Stats Month Data - Totals of lead stats for 1 month - Preserved indefinately - (generated daily?)
+CREATE TABLE {prefix}lead_stats_month (
+ id INT NOT NULL AUTO_INCREMENT,
+ stat_month DATE NULL, -- First date of month for which these stats are accumulated
+ leads_count INTEGER NULL, -- Number of leads
+ PRIMARY KEY (id),
+ INDEX (stat_month)
+);
--- /dev/null
+<?php
+/**
+ * Gaslight Media Members Database
+ * GLM Members Leads DB Versions
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release dbVersions.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link http://dev.gaslightmedia.com/
+ */
+
+$glmMembersSampleDbVersions = array(
+ '0.0.1' => array('version' => '0.0.1', 'tables' => 1, 'date' => '6/8/2016')
+);
+
--- /dev/null
+-- Gaslight Media Members Database - Sample
+-- File Created: 12/02/15 15:27:15
+-- Database Version: 0.0.1
+-- Database Creation Script
+--
+-- This file is called to create a new set of tables for this
+-- add-on for the most receint database version for this add-on.
+--
+-- There should only be one such file in this directory
+--
+-- To permit each query below to be executed separately,
+-- all queries must be separated by a line with four dashes
+
+
+-- **********************************************************************
+-- NOTE: THIS IS A SAMPLE FILE - DO NOT USE UNMODIFIED
+--
+-- Please change all references to sample, Sample, or SAMPLE to a name
+-- appropriate for your new Add-On.
+--
+-- Tables and queries in this file are sample only.
+--
+-- Remove this message before using this file in production!
+-- **********************************************************************/
+
+
+-- Sample Table
+CREATE TABLE {prefix}sometablename (
+ id INT NOT NULL AUTO_INCREMENT,
+ somefield TINYTEXT NULL,
+ PRIMARY KEY (id)
+);
+
+----
+
+-- Sample default entry in table
+INSERT INTO {prefix}sometablename
+ ( id, somefield )
+ VALUES
+ ( 1, 'sample data' )
+;
+
--- /dev/null
+<?php
+/**
+ * Gaslight Media Members Database
+ * GLM Members Sample DB Versions
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release dbVersions.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link http://dev.gaslightmedia.com/
+ */
+
+
+/**********************************************************************
+ * NOTE: THIS IS A SAMPLE FILE - DO NOT USE UNMODIFIED
+ *
+ * Please change all references to sample, Sample, or SAMPLE to a name
+ * appropriate for your new Add-On.
+ *
+ * This file lists all versions of the database tables for this add-on.
+ * The last entry in the array below should be for the most recent
+ * version and should match the "create_database_V..." file in this
+ * directory.
+ *
+ * NOTE: When first creating a new add-on with database tables, there
+ * should only be one line in the array below and there should be no
+ * "update_database..." files in this directory.
+ *
+ * Remove this message before using this file in production!
+ **********************************************************************/
+
+
+$glmMembersSampleDbVersions = array(
+ '0.0.1' => array('version' => '0.0.1', 'tables' => 1),
+ '0.0.2' => array('version' => '0.0.2', 'tables' => 2)
+);
+
--- /dev/null
+DATABASE EXAMPLE FILES
+----------------------
+
+*** THESE ARE EXAMPLES ONLY ***
+
+The files in this directory are examples only. Do not use any of these as they are!
+
+The example here is of a set of one table for the add-on that is initially created
+by the create_database_V0.0.1.sql script. That file creates one table and inserts
+one entry into that table.
+
+In this example, the database is later updated by two files. Either of these may
+be included separately if only a PHP file is needed to update the database, or
+just an SQL script. Sometimes both are needed.
+
+There is also an entry in the dbVersions.php file that describes the update.
+
+Note that the number of tables needs to be set to the updated number for each update.
+
+Also note taht the SQL update scripts are run before the PHP update scripts.
+
--- /dev/null
+<?php
+/*
+ * Gaslight Media Members Database - Sample Add-On
+ *
+ * Database Update Script for version 0.0.2
+ */
+
+/**********************************************************************
+ * NOTE: THIS IS A SAMPLE FILE - DO NOT USE UNMODIFIED
+ *
+ * Please change all references to sample, Sample, or SAMPLE to a name
+ * appropriate for your new Add-On.
+ *
+ * This is a sample database update process. There should be an SQL
+ * script for each update in this directory. This php file is optionsl
+ * and can be used to perform more complex data updates.
+ *
+ * If this file exists, it is called after the matching SQL script has
+ * been run.
+ *
+ * ******** THE CODE BELOW IS STICTLY A SAMPLE ********
+ *
+ * Remove this message before using this file in production!
+ **********************************************************************/
+
+/*
+ * Update sample records to take data from one field, change it, then store it in the new field
+ */
+
+// Get all records from the sometablename table.
+$sampleRecords = $this->wpdb->get_results('SELECT id, title FROM '.GLM_MEMBERS_SAMPLE_PLUGIN_DB_PREFIX.'sometablename;', ARRAY_A);
+
+// If there's any records
+if ($sampleRecords && count($sampleRecords) > 0) {
+
+ // For each record
+ foreach ($sampleRecords as $p) {
+
+ // Create a slug from the somefield field
+ $newData = sanitize_title($p['somefield']).'-'.$p['id'];
+
+ // Store this value back into the record in the new yetanotherfield field
+ $this->wpdb->update(
+ GLM_MEMBERS_SAMPLE_PLUGIN_DB_PREFIX.'sometablename',
+ array(
+ 'yetanotherfield' => $slug
+ ),
+ array( 'id' => $p['id'] ),
+ array( '%s' ),
+ array( '%d')
+ );
+ }
+
+}
--- /dev/null
+-- Gaslight Media Members Database
+-- File Created: 12/09/14 15:27:15
+-- Database Version: 0.0.2
+-- 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 dashses
+
+-- A sample database update script
+CREATE TABLE {prefix}anothertablename (
+ id INT NOT NULL AUTO_INCREMENT,
+ anotherfield TINYTEXT NULL,
+ PRIMARY KEY (id)
+);
+
+----
+
+ALTER TABLE {prefix}sometablename ADD COLUMN yetanotherfield TINYTEXT;
+
+
+
--- /dev/null
+This directory contains database creation and update scripts for this add-on.
+
+The files in this directory are checked by the checkDatabase() function in the
+main plugin classes/glmPluginSupport.php file.
+
+This directory is optional. If there are no data tables that need to be created
+for this add-on, there should be no files in this directory. The directory may
+also be deleted.
+
+See the "examples" directory for a sample of what can go in this directory.
--- /dev/null
+<?php
+/**
+ * Gaslight Media Members Database
+ * GLM Members Leads Add-On Misc Hooks and Filters
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release frontHooks.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link http://dev.gaslightmedia.com/
+ */
+
+/*
+ * Place Misc Hooks and Filters here. If this file exists, it will be included
+ * by the add-on main plugin script.
+ *
+ * Note that filter and hook callback functions must be included in-line as shown below...
+ *
+ * add_filter( 'filter_title', function( $parameter ) {
+ * // Function code
+ * });
+ *
+ * *** Also note that parameters will be in the context of the main front controller constructor. ***
+ */
--- /dev/null
+<!-- Hooks Help from glm-member-db-sample Add-On -->
--- /dev/null
+<?php
+/**
+ * Gaslight Media Members Database
+ * GLM Members DB - Leads Add-on - Permissions
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release permissions.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link http://dev.gaslightmedia.com/
+ */
+
+/*
+ * Below are permission checks for various specific things in this add-on and
+ * elsewhere in the Member DB main plugin and add-ons.
+ *
+ * Each location where a permission might be required has an apply_filters()
+ * hook with a tag name that includes the plugin or add-on name, the menu,
+ * the action, and a name for the specific thing that needs permissions.
+ *
+ * This can be included in code or in a Smarty template used in these plugins.
+ * For example, to check permissions for the main Members menu and it's "index"
+ * action to see if a member search is permitted, the template includes the
+ * following code...
+ *
+ * {if $membersList && apply_filters('glm_members_permit_admin_members_index_member_search', true)}
+ * --- some template output ---
+ * {/if}
+ *
+ * In the case above, it's also checking to see if the members list even exists
+ * before checking the permissions. The default value of "true" in the hook ensures
+ * that the permission is granted if nothing has linked into the hook to say otherwise.
+ *
+ * Note that each add_filter() below first checks if the permission has already
+ * been retracted by prior hook. This requires all that are attached to the hook
+ * to permit the action.
+ *
+ * Of course any of these may test more than one capability if that's desired.
+ */
--- /dev/null
+<?php
+/**
+ * Gaslight Media Members Database
+ * GLM Members DB - Leads Add-on - Roles & Capabilities
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release rolesAndPermissions.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link http://dev.gaslightmedia.com/
+ */
+
+/**
+ * NOTE: This file is only included in the activate.php process.
+ * It is not regularly used during operation.
+ */
--- /dev/null
+<?php
+/**
+ * Gaslight Media Members Database
+ * GLM Members Leads Add-On Short Codes
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release shortcodes.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link http://dev.gaslightmedia.com/
+ */
+
+/*
+ * Array of short-code
+ *
+ * This array lists all of the short-codes available from the main
+ * member plugin and all add-ons that provide short-code features.
+ *
+ * This array is merged with the data from any registered add-ons
+ * providing short-code features. The plugin providing the short-code
+ * is designated in the 'plugin' elemeent.
+ *
+ * A shortcode is unique to a particular plugin. To provide additional
+ * data and features to a short-code, an add-on should use filters
+ * provided by the short-code to insert data into the template array,
+ * to insert additional format into the template, or to insert
+ * text directly into the completed template output.
+ *
+ * The "attributes" array is a list of available attributes for this
+ * shortcode and their default values. If a database table is provided,
+ * then the value for each attribute is a table column where we get
+ * the default value. If no table is provided, then the value for
+ * each attribute is the actual default value for that attribute.
+ * In the case that the data is taken from the database table, the
+ * "id" for the table entry where the data is stored is assumed to
+ * be 1.
+ *
+ * Note that if the value for a particular attribute is false, then
+ * it is not read from the database even if the table is specified
+ * but might be supplied at run-time as an attribute in the short-code.
+ * All attributes that might be specified in the shortcode must be
+ * listed in the 'attributes' array below. If an attribute is not
+ * specified here, it can't be read from the short-code.
+ *
+ * The following is an explanation of this array.
+ *
+ * array(
+ * '{shortcode-slug} => array(
+ * 'plugin' => '{plugin (add-on) slug}', // Identifies which plugin is providing the short-code
+ * 'menu' => '{menu name}', // Menu name in this context is simply where to find the action
+ * 'action' => '{shortcode action name}, // Action used to execute this shortcode
+ * 'table' => '{table prefix}{table name}', // Database table where default attribute values are stored
+ * 'attributes' => array( // An array of all shortcode attributes (options)
+ * '{attr name}' => '{field name}', // Available attribute names and the database field names with the default value
+ * ....
+ * ),
+ * ... additional short-codes
+ * )
+ *
+ * Shortcode descriptions sample
+ *
+ * <tr>
+ * <th>[glm-members-sample-shortcode]</th>
+ * <td> </td>
+ * <td width="50%">
+ * <p>
+ * Displays something related to this add-on.
+ * </p>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td> </td>
+ * <th>type="{types}"</th>
+ * <td>
+ * <p>
+ * The "type" attribute is used to select the type of data to be displayed.
+ * Below is a list of available list types.
+ * </p>
+ * <p>
+ * <table width="100%">
+ * <tr><th colspan=3">List Types</th></tr>
+ * <tr><td>one</td><td>Type One</td></tr>
+ * <tr><td>two</td><td>Type Two</td></tr>
+ * </table>
+ * </p>
+ *
+ * </td>
+ * </tr>
+ *
+ */
+
+$glmMembersLeadsShortcodes = array(
+);
+
+$glmMembersLeadsShortcodesDescription = '';
+
--- /dev/null
+<?php
+/**
+ * Gaslight Media Members Database
+ * GLM Members Leads Add-On Valid Actions
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release admin.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link http://dev.gaslightmedia.com/
+ */
+
+/*
+ * Array of valid menu items and actions.
+ *
+ * The higher level elements are valid menu items. These correlate to
+ * actual menu or sub menu items that are hooks back to this controller
+ * class.
+ *
+ * The lower level items below each menu item are actions that may be specified
+ * by a "glmMembersAction" form field.
+ *
+ * The string after the action is the slug of the plugin where the model/view
+ * is to perform that action.
+ *
+ * This array is integrated into the valid actions array in the main GLM Member
+ * DB plugin when this plugin registers itself.
+ */
+
+$glmMembersLeadsAddOnValidActions = array(
+);
+
+?>
\ No newline at end of file
--- /dev/null
+<?php
+
+die('uninstall not configured - See plugin uninstall.php script!');
+
+/**
+ * Gaslight Media Members Database Leads Child Plugin
+ * Uninstall Plugin
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabaseLeads
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release admin.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link http://dev.gaslightmedia.com/
+ */
+
+// Check that we're being called by WordPress.
+if (!defined('ABSPATH')) {
+ die("Please do not call this code directly!");
+}
+
+//if uninstall not called from WordPress exit
+if (!defined('WP_UNINSTALL_PLUGIN')) {
+ die("Sorry, uninstall must be called by WordPress!");
+}