From: Chuck Scott Date: Thu, 21 Jan 2016 15:36:58 +0000 (-0500) Subject: Interim commit for changes X-Git-Tag: v1.1.0^2~9^2~1 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=80bf9998f5f5900b899e7e196b7743495057fe5e;p=WP-Plugins%2Fglm-member-db-packaging.git Interim commit for changes --- diff --git a/models/front/hooked/detail.php b/models/front/hooked/detail.php new file mode 100644 index 0000000..015d966 --- /dev/null +++ b/models/front/hooked/detail.php @@ -0,0 +1,116 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @version 0.1 + */ + +// Load packages data abstract +require_once(GLM_MEMBERS_PACKAGING_PLUGIN_CLASS_PATH.'/data/dataPackages.php'); + +/* + * This class performs the work for displaying members packages. + */ +class GlmMembersFront_packaging_detailHook extends GlmDataPackages +{ + + /** + * 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); + + } + + public function getPackageDetail($id) + { + + return ('123 we be here'); + + /* + * Merge data returned from the model with the selected view + */ +/* + // Load Smarty Template support + $smarty = new smartyTemplateSupport(); + + // Update the Smarty view path based on plugin/add-on that's providing the action + $smarty->template->setTemplateDir($viewPath); + + // Add standard parameters + $smarty->templateAssign ( 'errorMsg', $errorMsg); + $smarty->templateAssign ( 'frontDebug', GLM_MEMBERS_PLUGIN_FRONT_DEBUG); + $smarty->templateAssign ( 'baseURL', GLM_MEMBERS_PLUGIN_BASE_URL); + $smarty->templateAssign ( 'thisURL', GLM_MEMBERS_PLUGIN_CURRENT_URL ); + $smarty->templateAssign ( 'glmPluginName', GLM_MEMBERS_PLUGIN_NAME ); + $smarty->templateAssign ( 'glmPluginMediaURL', GLM_MEMBERS_PLUGIN_MEDIA_URL ); + $smarty->templateAssign ( 'ref_type_numb', $this->config['ref_type_numb']); + $smarty->templateAssign ( 'thisYear', date ( 'Y' ) ); + $smarty->templateAssign ( 'settings', $this->config['settings']); + $smarty->templateAssign ( 'terms', $this->config['terms']); + $smarty->templateAssign('thisAction', $action); + + // Add data from model to Smarty template + if (is_array($results['data']) && count($results['data']) > 0) { + foreach ($results['data'] as $k => $d) { + $smarty->templateAssign($k, $d); + } + } + + // If view debug has been requested + if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG) { + + glmMembersFront::addNotice("Template File: $view", 'Process'); + + $x = $smarty->template->getTemplateVars(); + $templateVars = '
' . print_r($x, 1) . '
'; + glmMembersFront::addNotice($templateVars, 'DataBlock', 'Template Parameters'); + } + + // Generate output from model data and view + $out = $smarty->template->fetch($view); +*/ + + + } + +} + +?> \ No newline at end of file diff --git a/setup/adminHooks.php b/setup/adminHooks.php new file mode 100644 index 0000000..6860589 --- /dev/null +++ b/setup/adminHooks.php @@ -0,0 +1,47 @@ + + * @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. + */ + + +// Add content to member detail page +add_filter('glm-member-db-admin-management-hoooksHelp', function($content) { + + // Read in this plugin/addon hook help file + $fname = GLM_MEMBERS_PACKAGING_PLUGIN_PATH.'/setup/hooksHelp.html'; + if (is_file($fname)) { + $hooksHelp = file_get_contents($fname); + if ($hooksHelp != false) { + $content .= $hooksHelp; + } + } + return $content; + }, + 10, + 2 +); + +?> \ No newline at end of file diff --git a/setup/frontHooks.php b/setup/frontHooks.php index 895147b..6a61ce9 100644 --- a/setup/frontHooks.php +++ b/setup/frontHooks.php @@ -23,7 +23,7 @@ * // Function code * }); * - * Also note that parameters will be in the context of the main front controller constructor. + * *** Also note that parameters will be in the context of the main front controller constructor. *** */ // Setup rewrite for package detail pages @@ -48,4 +48,16 @@ add_filter('init', function() { } }); +// Add content to member detail page - Get it from the existing package detail shortcode +if (isset($this->config['addOns']['glm-member-db'])) { + add_filter('glm-member-db-front-members-detail-descriptionBottom', function($content, $id) { + $packageData = do_shortcode('[glm-members-packaging-detail id="'.$id.'"]'); + $content .= $packageData; + return $content; + }, + 10, + 2 + ); +} + ?> \ No newline at end of file diff --git a/setup/hooksHelp.html b/setup/hooksHelp.html new file mode 100644 index 0000000..52438d1 --- /dev/null +++ b/setup/hooksHelp.html @@ -0,0 +1,55 @@ + + +

Packaging Add-On

+ + User Permission Hooks + + + glm_members_permit_admin_members_packages_tab + Filter + + + Hook to test if the logged in user is permitted to see multi-member packaging tab. + + + + glm_members_permit_admin_members_packaging_add_package + Filter + + + Hook to test if the logged in user is permitted to add a new multi-member package. + + + + glm_members_permit_admin_members_packaging_edit_package + Filter + + + Hook to test if the logged in user is permitted to edit a multi-member package. + + + + glm_members_permit_admin_members_packages_tab + Filter + + + Hook to test if the logged in user is permitted to see the member packaging tab. + + + + glm_members_permit_admin_member_packaging_add_package + Filter + + + Hook to test if the logged in user is permitted to add a new Member package. + + + + glm_members_permit_admin_member_packaging_edit_package + Filter + + + Hook to test if the logged in user is permitted to edit a member package. + + +