If user can edit all members then they'll get dashboard widgets.
--- /dev/null
+<?php
+
+/**
+ * Gaslight Media Members Database
+ * Admin Members Dashboard
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Steve Sutton <steve@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @version 0.1
+ */
+
+require_once GLM_MEMBERS_PLUGIN_CLASS_PATH . '/data/dataMembers.php';
+
+/**
+ * Dashboard Class Model
+ *
+ * Each Add-On can have one or more dashboards.
+ */
+
+class GlmMembersAdmin_dashboard_members extends GlmDataMembers
+{
+ /**
+ * Word Press 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 successful 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;
+
+ // Compile template data.
+ $templateData = array(
+ );
+
+ // Return status, suggested view, and data to controller.
+ return array(
+ 'status' => $success,
+ 'menuItemRedirect' => false,
+ 'modelRedirect' => false,
+ 'view' => 'admin/dashboard/members.html',
+ 'data' => $templateData
+ );
+
+ }
+
+}
*/
public function modelAction ($actionData = false)
{
- $success = true;
+ $success = true;
+ $manage_members = (current_user_can('glm_members_members'));
// Get stats on the current list of members
$stats = $this->getStats();
// Check for required Member Types
require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMemberTypes.php';
- $MemberTypes = new GlmDataMemberTypes($this->wpdb, $this->config);
+ $MemberTypes = new GlmDataMemberTypes($this->wpdb, $this->config);
$memberTypesStats = $MemberTypes->getStats();
- $haveMemberTypes = ($memberTypesStats > 0);
+ $haveMemberTypes = ($memberTypesStats > 0);
// Check for required Categories
require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCategories.php';
- $Categories = new GlmDataCategories($this->wpdb, $this->config);
+ $Categories = new GlmDataCategories($this->wpdb, $this->config);
$categoriesStats = $Categories->getStats();
- $haveCategories = ($categoriesStats > 0);
+ $haveCategories = ($categoriesStats > 0);
// Check for required Amenities
require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataAmenities.php';
- $Amenities = new GlmDataAmenities($this->wpdb, $this->config);
+ $Amenities = new GlmDataAmenities($this->wpdb, $this->config);
$amenitiesStats = $Amenities->getStats();
- $haveAmenities = ($amenitiesStats > 0);
+ $haveAmenities = ($amenitiesStats > 0);
// Check for required Cities
require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCities.php';
- $Cities = new GlmDataCities($this->wpdb, $this->config);
+ $Cities = new GlmDataCities($this->wpdb, $this->config);
$citiesStats = $Cities->getStats();
- $haveCities = ($citiesStats > 0);
+ $haveCities = ($citiesStats > 0);
// Check for required Regions
require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataRegions.php';
- $Regions = new GlmDataRegions($this->wpdb, $this->config);
+ $Regions = new GlmDataRegions($this->wpdb, $this->config);
$regionsStats = $Regions->getStats();
- $haveRegions = ($regionsStats > 0);
+ $haveRegions = ($regionsStats > 0);
// Get number of member information records with pending updates
require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMemberInfo.php';
- $MemberInfo = new GlmDataMemberInfo($this->wpdb, $this->config);
+ $MemberInfo = new GlmDataMemberInfo($this->wpdb, $this->config);
$membersPending = $MemberInfo->getStats('status = '.$this->config['status_numb']['Pending']);
// Get member information records with bad or no lat/lon
- $hideArchived = " T.status != ".$this->config['status_numb']['Archived'];
+ $hideArchived = " T.status != ".$this->config['status_numb']['Archived'];
$badLatLonList = $MemberInfo->getSimpleMemberInfoList($hideArchived.' AND (T.lat = 0 OR T.lon = 0)');
$haveBadLatLon = (is_array($badLatLonList) && count($badLatLonList) > 0);
// Compile template data
$templateData = array(
- 'numbMembers' => $stats,
- 'membersList' => $membersList,
- 'membersPending' => $membersPending,
- 'haveBadLatLon' => $haveBadLatLon,
- 'badLatLonList' => $badLatLonList,
+ 'manage_members' => $manage_members,
+ 'numbMembers' => $stats,
+ 'membersList' => $membersList,
+ 'membersPending' => $membersPending,
+ 'haveBadLatLon' => $haveBadLatLon,
+ 'badLatLonList' => $badLatLonList,
'haveMemberTypes' => $haveMemberTypes,
- 'haveCategories' => $haveCategories,
- 'haveAmenities' => $haveAmenities,
- 'haveRegions' => $haveRegions,
- 'haveCities' => $haveCities,
- 'pendingList' => $pendingList
+ 'haveCategories' => $haveCategories,
+ 'haveAmenities' => $haveAmenities,
+ 'haveRegions' => $haveRegions,
+ 'haveCities' => $haveCities,
+ 'pendingList' => $pendingList
);
// Return status, suggested view, and data to controller
return array(
- 'status' => $success,
+ 'status' => $success,
'menuItemRedirect' => false,
- 'modelRedirect' => false,
- 'view' => 'admin/members/index.html',
- 'data' => $templateData
+ 'modelRedirect' => false,
+ 'view' => 'admin/members/index.html',
+ 'data' => $templateData
);
}
}
-?>
\ No newline at end of file
+?>
10,
1
);
+add_filter(
+ 'glm-member-db-dashboard-member-admin-widgets',
+ function ( $input = '' ) {
+ $content = $this->controller( 'dashboard', 'members', $input );
+ return $content;
+ }
+);
'memberGraphs' => 'glm-member-db',
),
'dashboard' => array(
- 'index' => 'glm-member-db',
+ 'index' => 'glm-member-db',
+ 'members' => 'glm-member-db',
),
'dashboardWidget' => array(
'index' => 'glm-member-db',
--- /dev/null
+<div class="glm-widget-container">
+ <div class="glm-widget">
+ <h2>
+ <span>Pending {$terms.term_member_cap} Profiles</span>
+ </h2>
+ <div class="glm-widget-content">
+ Members Pending list
+
+ </div>
+ </div>
+</div>
{include file='admin/members/header.html'}
-
+
{if apply_filters('glm_members_permit_admin_members_index_add_member', true)}
<a href="{$thisUrl}?page=glm-members-admin-menu-member&glm_action=memberEdit&option=add" class="button button-primary glm-button glm-right">Add A New {$terms.term_member_cap}</a>
{/if}
<th class="glm-error">You do not have any {$terms.term_member_cap} Types setup.</th>
<td><a href="{$thisUrl}?page=glm-members-admin-menu-settings&glm_action=index">Click here to add {$terms.term_member_cap} Types.</a></td>
</tr>
- {/if}
+ {/if}
{if !$haveCategories}
<tr>
<th><span class="glm-error">You do not have any {$terms.term_member_cap} Categories setup.</span></th>
<td><a href="{$thisUrl}?page=glm-members-admin-menu-settings&glm_action=categories">Click here to add {$terms.term_member_cap} Categories.</a></td>
</tr>
- {/if}
+ {/if}
{if !$haveAmenities}
<tr>
<th><span class="glm-error">You do not have any Amenities setup.</span></th>
<td><a href="{$thisUrl}?page=glm-members-admin-menu-settings&glm_action=amenities">Click here to add Amenities.</a></td>
</tr>
- {/if}
+ {/if}
{if !$haveCities}
<tr>
<th><span class="glm-error">You do not have any Cities setup.</span></th>
<td><a href="{$thisUrl}?page=glm-members-admin-menu-settings&glm_action=cities">Click here to add Cities.</a></td>
</tr>
- {/if}
+ {/if}
{if !$haveRegions}
<tr>
<th><span class="glm-error">You do not have any Regions setup.</span></th>
</tr>
{/if}
{/if}
-
+
{if $numbMembers == 0}
<tr><td colspan="2"> </td></tr>
<tr>
<th> <span class="glm-error">You do not have any {$terms.term_member_plur} listed.</span></th>
<td><a href="{$thisUrl}?page=glm-members-admin-menu-member&glm_action=memberEdit&option=add">Click here to create your first {$terms.term_member}.</a></td>
</tr>
-{/if}
+{/if}
</table>
-
+
<table class="glm-admin-table">
<tr><th>Number of {$terms.term_member_plur_cap} Listed: </th><td>{$numbMembers}</td></tr>
</table>
-
+
{apply_filters('glm-member-db-members-othernotices', '')}
{if $haveBadLatLon}
<h3 class="glm-error"> <br>{$terms.term_member_cap} Profile with Bad Map Location Information</h3>
-
+
<table class="wp-list-table widefat fixed posts glm-admin-table">
<thead>
<tr>
</table>
{/if}
-{if $membersPending}
- <h3 class="glm-error"> <br>Pending {$terms.term_member_cap} Profile</h3>
-
- <table class="wp-list-table widefat fixed posts glm-admin-table"">
- <thead>
- <tr>
- <th>{$terms.term_member_cap} Name</th>
- <th>Last Updated</th>
- <th>Reference Name</th>
- </tr>
- </thead>
- <tbody>
- {assign var="i" value="0"}
- {foreach $pendingList as $p}
- {if $i++ is odd by 1}
- <tr>
- {else}
- <tr class="alternate">
- {/if}
- <td>
- <a href="{$thisUrl}?page=glm-members-admin-menu-member&glm_action=memberInfo&member={$p.member_pointer}&memberInfo={$p.id}">{$p.member}</a>
- </td>
- <td>
- {$p.modify_time.datetime}
- </td>
- <td>
- {$p.reference_name}
- </td>
- </tr>
- {/foreach}
- </tbody>
- </table>
+{if $manage_members}
+ <div id="glm-dashboard-widgets-wrap">
+ Member Manager Dashboards goes here
+ {apply_filters('glm-member-db-dashboard-member-admin-widgets', '')}
+ </div>
+{else}
+ {if $membersPending}
+ <h3 class="glm-error"> <br>Pending {$terms.term_member_cap} Profile</h3>
+
+ <table class="wp-list-table widefat fixed posts glm-admin-table">
+ <thead>
+ <tr>
+ <th>{$terms.term_member_cap} Name</th>
+ <th>Last Updated</th>
+ <th>Reference Name</th>
+ </tr>
+ </thead>
+ <tbody>
+ {assign var="i" value="0"}
+ {foreach $pendingList as $p}
+ {if $i++ is odd by 1}
+ <tr>
+ {else}
+ <tr class="alternate">
+ {/if}
+ <td>
+ <a href="{$thisUrl}?page=glm-members-admin-menu-member&glm_action=memberInfo&member={$p.member_pointer}&memberInfo={$p.id}">{$p.member}</a>
+ </td>
+ <td>
+ {$p.modify_time.datetime}
+ </td>
+ <td>
+ {$p.reference_name}
+ </td>
+ </tr>
+ {/foreach}
+ </tbody>
+ </table>
+ {/if}
+
{/if}
{if $membersList}
<script type="text/javascript">
jQuery(document).ready(function($) {
-
+
/*
* Do autocomplete search for member
* label: What will be searched
* value: What will be displayed when selected
* id: Member id added so we can go to the member while showing what was selected
- * Also note that autocomplete does not properly render HTML codes, so we
+ * Also note that autocomplete does not properly render HTML codes, so we
* "unescape" them for HTML in Smarty.
*/
var availableTags = [
}
}
});
-
+
});
-
+
</script>
{/if}
-
+
{include file='admin/footer.html'}