--- /dev/null
+<?php
+namespace glm\messages\help;
+
+/**
+ * Gaslight Media Members Billing Database
+ * GLM Billing Help
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersBillingDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @author Steve Sutton <steve@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release help.php
+ * @link http://dev.gaslightmedia.com/
+ */
+
+/*
+ * Place Help Hooks and Filters here. If this file exists, it will be included
+ * by the Billing 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
+ * });
+ *
+ */
+function loadHelpFile( $screen, $tab )
+{
+ $fileName = GLM_MEMBERS_MESSAGES_PLUGIN_SETUP_PATH . '/help/' . $tab['extra'] . '.html';
+ if ( is_file( $fileName ) ) {
+ echo file_get_contents( $fileName );
+ } else {
+ return false;
+ }
+}
+
+add_action( 'current_screen',
+ function () {
+ $screen = get_current_screen();
+ // var_dump($screen);
+ if ( !isset( $screen ) ) {
+ return false;
+ }
+ // echo '<pre>$screen: ' . print_r( $screen, true ) . '</pre>';
+ if ( $screen->base != 'glm-associate_page_glm-members-admin-menu-messages' ) {
+ return false;
+ }
+
+ $helpTabs = array(
+ array(
+ 'name' => 'dashboard',
+ 'title' => 'Dashboard',
+ 'subs' => array(
+ array(
+ 'name' => 'list',
+ 'title' => 'Email Messages',
+ ),
+ array(
+ 'name' => 'listTemplates',
+ 'title' => 'Email Templates',
+ ),
+ ),
+ ),
+ );
+
+ foreach ( $helpTabs as $tab ) {
+ $glmAction = isset( $_REQUEST['glm_action'] ) ? filter_var( $_REQUEST['glm_action'] ) : 'dashboard';
+ if ( $glmAction === $tab['name'] ) {
+ $fileName = GLM_MEMBERS_BILLING_PLUGIN_SETUP_PATH . '/help/' . $tab['name'] . '.html';
+ if ( is_file( $fileName ) ) {
+ $screen->add_help_tab(
+ array(
+ 'id' => 'glm-member-db-messages-help-' . $tab['name'],
+ 'title' => __( $tab['title'] ),
+ 'content' => '',
+ 'callback' => 'glm\messages\help\loadHelpFile',
+ 'extra' => $tab['name'],
+ )
+ );
+ }
+ $option = isset( $_REQUEST['option'] ) ? filter_var( $_REQUEST['option'] ) : 'dashboard';
+ // Check for subs
+ if ( isset( $tab['subs'] ) && is_array( $tab['subs'] ) ) {
+ foreach ( $tab['subs'] as $sub ) {
+ $fileName = GLM_MEMBERS_BILLING_PLUGIN_SETUP_PATH . '/help/' . $option . '-' . $sub['name'] . '.html';
+ if ( is_file( $fileName ) ) {
+ $screen->add_help_tab(
+ array(
+ 'id' => 'glm-member-db-messages-help-'. $option . '-' . $sub['name'],
+ 'title' => __( $sub['title'] ),
+ 'content' => '',
+ 'callback' => 'glm\messages\help\loadHelpFile',
+ 'extra' => $option . '-' . $sub['name'],
+ )
+ );
+ }
+ }
+ }
+ }
+ }
+
+ // Help sidebars
+ $screen->set_help_sidebar(
+ '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
+ '<p><a href="https://www.gaslightmedia.com/wp-admin-guide/#GLM" target="_blank">' .
+ __( 'Help Guide' ) . '</a></p>'
+ );
+ }
+);