Added support for putting additional content in main dashboard widget.
authorChuck Scott <cscott@gaslightmedia.com>
Fri, 22 Jul 2016 18:42:57 +0000 (14:42 -0400)
committerChuck Scott <cscott@gaslightmedia.com>
Fri, 22 Jul 2016 18:42:57 +0000 (14:42 -0400)
Fixed a minor problem with the shortcode builder where it was causing an undefined parameter error.

classes/glmPluginSupport.php
defines.php
models/admin/dashboardWidget/index.php
setup/adminMenus.php
setup/hooksHelp.html
views/admin/dashboardWidget/index.html

index 58be70f..5a50662 100644 (file)
@@ -507,8 +507,14 @@ return; // Off for now ** Need to make this switchable in management
 
         // use the addOn slugs to access each of the shortcodes
         foreach($addOnSlugs as $addOn){
-            if ($this->config['addOns'][$addOn]['shortcodes']) {
-                $shortCodeList[] = $this->config['addOns'][$addOn]['shortcodes'];
+
+            // Check if the add-on has shortcodes
+            if (isset($this->config['addOns'][$addOn]['shortcodes'])) {
+
+                // It does, so add them to the list
+                if ($this->config['addOns'][$addOn]['shortcodes']) {
+                    $shortCodeList[] = $this->config['addOns'][$addOn]['shortcodes'];
+                }
 
             }
         }
index 8b9b4d3..762840c 100644 (file)
@@ -33,10 +33,10 @@ define('GLM_MEMBERS_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_HOSTNAME', $urlParts['host']);
 define('GLM_MEMBERS_SITE_BASE_URL', home_url('/') );
 define('GLM_MEMBERS_PLUGIN_URL', plugin_dir_url(__FILE__));
 define('GLM_MEMBERS_PLUGIN_ADMIN_URL', admin_url('admin.php'));
index 1b99b3e..e808756 100644 (file)
  * @version  0.1
  */
 
+/*
+ * Adding content to the GLM Associate Dashboard Widget from an Add-on.
+ *
+ * There are three filters in the GLM Associate Dashboard Widget view for adding content into the widget.
+ * These include short warnings, lists of pending user actions, and other notices.
+ *
+ * See "Management" -> "Hooks" then scan down to "Main Dashboard Widget Hooks".
+ *
+ * Here's the best method for providing content to the dashboard widget. There is an example of this in the search add-on.
+ *
+ * 1. Create a Model/View to build additional content for the dashboard widget
+ *     a. Add a model for generating the warning/notice to the add-on in, for example, "models/admin/dashboardWidget/search/"
+ *     b. Add a view for this model to the add-on in, for example, "views/admin/dashboardWidget/search/"
+ *         (see Main Dashboard Widget Hooks descriptions for suggested format)
+ *     c. Add the model to "setup/validActions.php" in the add-on
+ *
+ * 2. Place an add_filter() function in the add-on's "setup/adminHooks.php" file, for example...
+ *
+ *     // Add content to the main dashboard widget
+ *     add_filter( 'glm-member-db-dashboard-widget-warnings', function( $content ) {
+ *         $content .= $this->controller('dashboardWidget', 'search');
+ *         return $content;
+ *     });
+ */
+
 // Load Members data abstract
 require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMembers.php');
 
index b7770fb..ab131c6 100644 (file)
@@ -41,7 +41,7 @@ if (current_user_can('glm_members_members')) {
         'glm_members_main_menu',
         'glm-members-admin-menu-members',
         function() {},
-        false,
+        GLM_MEMBERS_PLUGIN_ASSETS_URL.'/flame.png',
         '3.100'
     );
 
index 31e4e2d..efb7197 100644 (file)
@@ -1,8 +1,8 @@
 <!-- Hooks Help from glm-member-db Plugin -->
 
-        <tr><td colspan="3" class="glm-notice"><p>Main Member DB Plugin</p></td></tr>
+        <tr><td colspan="3" class="glm-notice"><p><h1>Main Member DB Plugin</h1></p></td></tr>
 
-        <tr><th colspan="3">Add-On Registration Hooks</td></tr>
+        <tr><th colspan="3"><h2>Add-On Registration Hooks</h2></td></tr>
         <tr>
             <td>glm-member-db-register-addon</td>
             <td>Filter</td>
@@ -139,7 +139,7 @@ public function glmMembersAddTabForMembers($addOnTabs)
             </td>
         </tr>
         
-        <tr><th colspan="3">User Permission Hooks</td></tr>
+        <tr><th colspan="3"><h2>User Permission Hooks</h2></td></tr>
         
         <tr>
             <td>glm_members_current_logged_in_user</td>
@@ -350,7 +350,7 @@ public function glmMembersAddTabForMembers($addOnTabs)
             </td>
         </tr>
         
-        <tr><th colspan="3">Front-End Output Hooks - Member List Page</td></tr>
+        <tr><th colspan="3"><h2>Front-End Output Hooks - Member List Page</h2></td></tr>
 
         <tr>
             <td>glm-member-db-front-members-list-pageTop</td>
@@ -507,7 +507,7 @@ public function glmMembersAddTabForMembers($addOnTabs)
             </td>
         </tr>
 
-        <tr><th colspan="3">Front-End Output Hooks - Member Detail Page</td></tr>
+        <tr><th colspan="3"><h2>Front-End Output Hooks - Member Detail Page</h2></td></tr>
 
         <tr>
             <td>glm-member-db-front-members-detail-pageTop</td>
@@ -753,52 +753,63 @@ public function glmMembersAddTabForMembers($addOnTabs)
             </td>
         </tr>
         
+        <tr><th colspan="3"><h2>Main Dashboard Widget Hooks</h2></td></tr>
         
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        
+        <tr>
+            <td>glm-member-db-dashboard-widget-warnings</td>
+            <td>Filter</td>
+            <td></td>
+            <td>
+                Permits adding critical warnings to the main dashboard GLM Associate widget. Be
+                sure to add content to the end of the string passed along by this filter.
+                <p>
+                Use the following format.
+                <div class="glm-code">
+&lt;h4&gt;&lt;span  class="glm-error"&gt;[Warning Title]&lt;/span&gt;&lt;/h4&gt;
+[warning content]
+                </div>
+            </td>
+        </tr>
+        <tr>
+            <td>glm-member-db-dashboard-widget-pendingaction</td>
+            <td>Filter</td>
+            <td></td>
+            <td>
+                Place a list with a title in main dashboard GLM Associate widget. Be
+                sure to add content to the end of the string passed along by this filter.
+                This filter is primarily for placing lists of items that are pending
+                user action.
+                <p>
+                Use the following format.
+                <div class="glm-code">
+&lt;h4&gt;&lt;span  class="glm-error"&gt;[Title for this list]&lt;/span&gt;&lt;/h4&gt;
+&lt;table class="wp-list-table striped glm-admin-table"&gt;
+    &lt;tbody&gt;
+[template loop code]
+        &lt;tr&gt;
+            [list entry content including TH and TD tags as desired]
+        &lt;/tr&gt;
+[end of template loop code]
+    &lt;/tbody&gt;
+&lt;/table&gt;
+                </div>
+            </td>
+        </tr>
+        <tr>
+            <td>glm-member-db-dashboard-widget-othernotices</td>
+            <td>Filter</td>
+            <td></td>
+            <td>
+                Place a list with a title in main dashboard GLM Associate widget. Be
+                sure to add content to the end of the string passed along by this filter.
+                This filter is for adding any other type of information to the dashboard
+                widget.
+                <p>
+                Use the following format.
+                <div class="glm-code">
+&lt;h4&gt;&lt;span  class="glm-warning"&gt;[Notice Title]&lt;/span&gt;&lt;/h4&gt;
+[notice content]
+                </div>
+            </td>
+        </tr>
         
\ No newline at end of file
index 36dace7..f8fb5b8 100644 (file)
     </table>
 {/if}
 
+<!-- Critical warnings may be inserted here by other add-ons -->
+{apply_filters('glm-member-db-dashboard-widget-warnings', '')}
+
 {if apply_filters('glm_members_permit_admin_widget_warnings', true)}
-  {if !$haveMemberTypes || !$haveCategories || !$haveAmenities || !$haveCities || !$haveRegions || $numbMembers == 0}
-    <h4><span  class="glm-error">Pending {$terms.term_member_cap} Information</span></h4>
     <table class="wp-list-table striped glm-admin-table">
+  {if !$haveMemberTypes || !$haveCategories || !$haveAmenities || !$haveCities || !$haveRegions || $numbMembers == 0}
+        <tr><th colspan="2"><h4><span  class="glm-error">Pending {$terms.term_member_cap} Information</span></h4></th></tr>
     {if !$haveMemberTypes}
         <tr>
             <th class="glm-error">No {$terms.term_member_cap} Types</th>
@@ -96,8 +99,8 @@
             <td><a href="{$adminUrl}?page=glm-members-admin-menu-member&glm_action=index&member_id=" class="glm-right">Add a {$terms.term_member_cap}</a></td>
         </tr>
     {/if}     
-    </table>
   {/if}
+    </table>
   {if $haveBadLatLon}
     <h4><span  class="glm-error">Records with Bad Map Locations</span></h4>
     
         </tbody>
     </table>
   {/if}
+    <!-- Notices with lists for items pending user action -->
+    {apply_filters('glm-member-db-dashboard-widget-noticewithlist', '')}
 {/if}
 
-{apply_filters('glm-member-db-dashboard-widget-notices', '')}
+{apply_filters('glm-member-db-dashboard-widget-othernotices', '')}