Added ID to regions list.
Updated error pages for admin and front-end.
Added sending E-mail to errors@gaslightmedia.com when front-end error occurs.
Added XML Sitemap
// If there was an error
if ($errorMsg != '') {
+ $mailMsg = "
+ <p>An error occurred while running the request below.</p>
+
+ <pre>
+ <table>
+ <tr><th>Error Msg: </th><td>$errorMsg</td></tr>
+ <tr><th>Server: </th><td>".$_SERVER['SERVER_NAME']."</td></tr>
+ <tr><th>Method: </th><td>".$_SERVER['REQUEST_METHOD']."</td></tr>
+ <tr><th>Time: </th><td>".date('r', $_SERVER['REQUEST_TIME'])."</td></tr>
+ <tr><th>Query: </th><td>".$_SERVER['QUERY_STRING']."</td></tr>
+ <tr><th>Referer: </th><td>".$_SERVER['HTTP_REFERER']."</td></tr>
+ <tr><th>User Agent: </th><td>".$_SERVER['HTTP_USER_AGENT']."</td></tr>
+ <tr><th>Remote Addr: </th><td>".$_SERVER['REMOTE_ADDR']."</td></tr>
+ <tr><th>Filename: </th><td>".$_SERVER['SCRIPT_FILENAME']."</td></tr>
+ <tr><th>URI: </th><td>".$_SERVER['REQUESST_URI']."</td></tr>
+ <tr><th valign=\"top\">Request Data: </th><td>".print_r($_REQUEST,1)."</td></tr>
+ </table>
+ </pre>
+ ";
+ mail (
+ 'errors@gaslightmedia.com',
+ 'Front-End GLM Associate Error',
+ $mailMsg
+ );
$viewPath = GLM_MEMBERS_WORDPRESS_PLUGIN_PATH.GLM_MEMBERS_PLUGIN_SLUG.'/views';
- $view = 'front/error/index.html';
+ $viewFile = 'front/error/index.html';
require_once (GLM_MEMBERS_WORDPRESS_PLUGIN_PATH.GLM_MEMBERS_PLUGIN_SLUG.'/models/front/error/index.php');
$model = new GlmMembersFront_error_index($this->wpdb, $this->config);
$results = $model->modelAction($actionData);
UPDATE clicks = clicks + 1;
");
- // Week count - stat_type = 3
+ // Month count - stat_type = 3
$this->wpdb->query("
INSERT INTO ".GLM_MEMBERS_PLUGIN_DB_PREFIX."clickthrough_stats
(member, stat_type, stat_date, clicks)
// Use selected graph type
switch ($_GET['graphType']) {
-
- case 'clicksDays':
-
- // Get the current date, and start date (past month)
- $today = date('Y-m-d', strtotime('+1 days'));
- $startDate = date('Y-m-d', strtotime('-1 month'));
-
+ case 'clicks':
$statTable = 'clickthrough_stats';
- $statDateWhere = "stat_date BETWEEN '$startDate' AND '$today'";
-
$graphTitle = $memb['name']." - Clicks this week";
-
-
-
break;
+ case 'views':
+ $statTable = 'member_detail_stats';
+ $graphTitle = $memb['name']." - Views this week";
+ break;
+ default:
+ trigger_error ( "memberGraphs via AJAX - Graph Type invalid ".$_GET['graphType'], E_USER_NOTICE);
+ wp_die();
+ break;
+ }
- case 'viewsDays':
+ // Use selected time period
+ switch ($_GET['graphPeriod']) {
+
+ case 'oneMonth':
// Get the current date, and start date (past month)
$today = date('Y-m-d', strtotime('+1 days'));
$startDate = date('Y-m-d', strtotime('-1 month'));
+ $statsThisMonthWhere = "stat_date BETWEEN '$startDate' AND '$today'";
+
+ // Get stats for the past month
+ $dayCounts = $this->wpdb->get_results("
+ SELECT stat_date, COALESCE (clicks, 0) as clicks
+ FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."$statTable
+ WHERE member = $memberId
+ AND stat_type = 1
+ AND $statsThisMonthWhere
+ ORDER BY stat_date
+ ", ARRAY_A);
+
+ $data = array();
+
+ // Build default date values
+ for ($t=strtotime($startDate) ; $t<=strtotime($today) ; $t=strtotime(date('Y-m-d',$t).' +1 day') ) {
+ $data[date('n/d',$t)] = 0;
+ }
+
+ if (count($dayCounts) > 0) {
+ foreach ($dayCounts as $c) {
+ $data[date('n/d', strtotime($c['stat_date']))] = $c['clicks'];
+ }
+ }
- $statTable = 'member_detail_stats';
- $statDateWhere = "stat_date BETWEEN '$startDate' AND '$today'";
+ break;
- $graphTitle = $memb['name']." - Views this week";
+ case 'twoYears':
- break;
+ $thisMonth = date('Y-m-01');
+ $startMonth = date('Y-m-01', strtotime('-23 months'));
+ $stats2YearsWhere = "stat_date BETWEEN '$startMonth' AND '$thisMonth'";
+ // Get stats for the past 2 years
+ $monthCounts = $this->wpdb->get_results("
+ SELECT stat_date, COALESCE (clicks, 0) as clicks
+ FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."$statTable
+ WHERE member = $memberId
+ AND stat_type = 3
+ AND $stats2YearsWhere
+ ORDER BY stat_date
+ ", ARRAY_A);
- default:
- trigger_error ( "memberGraphs via AJAX - Graph Type invalid ".$_GET['graphType'], E_USER_NOTICE);
- wp_die();
- break;
+ $monthData = array();
- }
+ // Build default date values
+ for ($t=strtotime($startMonth) ; $t<=strtotime($thisMonth) ; $t=strtotime(date('Y-m-d',$t).' +1 month') ) {
+ $data[date('Y/m',$t)] = 0;
+ }
- // Get click through data
- $clickCounts = $this->wpdb->get_results("
- SELECT stat_date, COALESCE (clicks, 0) as clicks
- FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."$statTable
- WHERE member = $memberId
- AND stat_type = 1
- AND $statDateWhere
- ORDER BY stat_date
- ", ARRAY_A);
-
- $data = array();
-
- // Build default date values
- for ($t=strtotime($startDate) ; $t<=strtotime($today) ; $t=strtotime(date('Y-m-d',$t).' +1 day') ) {
- $data[date('n/d',$t)] = 0;
- }
+ if (count($monthCounts) > 0) {
+ foreach ($monthCounts as $c) {
+ $data[date('Y/m', strtotime($c['stat_date']))] = $c['clicks'];
+ }
+ }
+
+ break;
- if (count($clickCounts) > 0) {
- foreach ($clickCounts as $c) {
- $data[date('n/d', strtotime($c['stat_date']))] = $c['clicks'];
- }
}
// Load PHPGraphLib
* Get member view stats
*/
- // Get the current date, first date of this wee, and first date of this month
+ // Get the current date, first date of this week, and first date of this month
$today = date('Y-m-d');
$thisWeek = date('Y-m-d', strtotime('-'.date('w').' days'));
$thisMonth = date('Y-m-d', strtotime('-'.(date('j')-1).' days'));
}
// Get a current list of members
- $regions = $this->getList();
+ $regions = $this->getList('', 'name');
if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
glmMembersAdmin::addNotice($regions, 'DataBlock', 'Region Data');
if (isset($_REQUEST['amenitySearch'])) {
$actionData['request']['amenity-search'] = $_REQUEST['amenitySearch'];
}
+ if (isset($_REQUEST['regionSearch'])) {
+ $actionData['request']['region-search'] = $_REQUEST['regionSearch'];
+ }
// Check for "show" shortcode parameter (what elements to show on the page)
$settings = array();
}
-
// If we have a category ID or IDs
if ($catSelectedForQuery != '') {
}
+ // If we have a region
+ if ($actionData['request']['region-search']) {
+ $regionSearch = $actionData['request']['region-search']-0;
+ if ($regionSearch > 0) {
+ $where .= " AND T.region = $regionSearch";
+ }
+ }
+
// Get amenity filter data
$amenityData = false;
$amenSelected = '';
'category-search' => false,
'text-search' => false,
'amenity-search' => false,
+ 'region-search' => false,
'alpha' => false,
'blank-start' => false,
'show' => false,
</td>
</tr>
<tr>
+ <td> </td>
+ <th>
+ region-search="{ region ID }"
+ </th>
+ <td>
+ The "region-search" attribute selects members who are listed in the specified
+ region. The region is specified by ID rather than name. This may be overridden by
+ a "regionSearch" URL parameter.
+ </td>
+ </tr>
+ <tr>
<td> </td>
<th>
alpha="{ initial letter of members }"
{include file='admin/error/header.html'}
-
- <h2>Sorry, we've had an error.</h2>
-
- <p><b>Error: </b>: An invalid action has been specified.</p>
-
- {if $errorMsg}<p>{$errorMsg}</p>{/if}
-
- <p>Please try again. If you still get the same error, contact Gaslight Media at 231-487-0692 for assistance.</p>
-
+<center>
+ <div id="glm-admin-content-container" class="glm-center" style="width: 600px; text-align: left; padding: 1em;">
+ <center>
+ <h1 class="glm-error">Aw shucks!</h1>
+ <h3>We couldn't get you the page you wanted. </h3>
+ <div style="width: 600px; text-align: left;">
+ <p>
+ Yes, something went wrong, but we really want to make it right. In fact, we've already
+ notified our hard-working Web crew that you had this problem and will do what we can
+ to make sure it doesn't happen again.
+ </p>
+ <p>
+ As far as we can tell now, <b>an invalid action has been requested</b>. This really shouldn't
+ happen, so we're going to research this to see if we can avoid this in the future.
+ </p>
+ {if isset($errorMsg) && $errorMsg}
+ <p>Oh, we have a little more information for you.</p>
+ <p>{$errorMsg}</p>
+ {/if}
+
+ <p>
+ Please head back to the link below and try again. If you continue to get this error,
+ please call for assistance.
+ </p>
+ <p style="text-align: center;"><a href="{$siteBaseUrl}">Return to Home Page</a></p>
+ </div>
+ </center>
+ </div>
+</center>
{include file='admin/footer.html'}
<div class="wrap">
-
- <h2>{$glmPluginName}</h2>
-
-
\ No newline at end of file
+
{include file='admin/error/header.html'}
-
- <center>
-
- <h3>Sorry, we've had some type of fatal error.</h3>
- {if $reason}
- <p class="glm-error">{$reason}</p>
- {/if}
- <p>Please try again. If you still get the same error, contact Gaslight Media at 231-487-0692 for assistance.</p>
-
- </center>
-
+<center>
+ <div id="glm-admin-content-container" class="glm-center" style="width: 600px; text-align: left; padding: 1em;">
+ <center>
+ <h1 class="glm-error">Aw shucks!</h1>
+ <h3>We couldn't get you the page you wanted. </h3>
+ <div style="width: 600px; text-align: left;">
+ <p>
+ Yes, something went wrong, but we really want to make it right. In fact, we've already
+ notified our hard-working Web crew that you had this problem and will do what we can
+ to make sure it doesn't happen again.
+ </p>
+ <p>
+ As far as we can tell now, <b>an invalid action has been requested</b>. This really shouldn't
+ happen, so we're going to research this to see if we can avoid this in the future.
+ </p>
+ {if isset($reason) && $reason}
+ <p>Oh, we have a little more information for you.</p>
+ <p>{$reason}</p>
+ {/if}
+
+ <p>
+ Please head back to the link below and try again. If you continue to get this error,
+ please call for assistance.
+ </p>
+ <p style="text-align: center;"><a href="{$siteBaseUrl}">Return to Home Page</a></p>
+ </div>
+ </center>
+ </div>
+</center>
{include file='admin/footer.html'}
<div id="daysClicks" class="graph-dialog glm-dialog-box" title="URL Click-Through Counts Graph">
<div id="urlClicksPrintArea" class="PrintArea" style="padding: 10px;">
<b>{$member.fieldData.name}</b>
- <div>
+ <p>
<span class="glm-right">{$thisDate}</span>
<span class="glm-left">URL Click-Through Counts for Past Month</span>
- </div>
- <img src="{$ajaxUrl}?action=glm_members_admin_ajax&glm_action=memberGraphs&graphType=clicksDays&memberId={$member.fieldData.id}&memberSlug={$member.fieldData.member_slug}">
+ </p>
+ <img src="{$ajaxUrl}?action=glm_members_admin_ajax&glm_action=memberGraphs&graphType=clicks&graphPeriod=oneMonth&memberId={$member.fieldData.id}&memberSlug={$member.fieldData.member_slug}">
+ <p>
+ <span class="glm-right">{$thisDate}</span>
+ <span class="glm-left">URL Click-Through Counts for Past 2 Years</span>
+ </p>
+ <img src="{$ajaxUrl}?action=glm_members_admin_ajax&glm_action=memberGraphs&graphType=clicks&graphPeriod=twoYears&memberId={$member.fieldData.id}&memberSlug={$member.fieldData.member_slug}">
</div>
<div class="button button-secondary graph-print glm-right" data-areaToPrint="urlClicksPrintArea">Print</div>
</div>
<span class="glm-right">{$thisDate}</span>
<span class="glm-left">Detail Page Views for Past Month</span>
</div>
- <img src="{$ajaxUrl}?action=glm_members_admin_ajax&glm_action=memberGraphs&graphType=viewsDays&memberId={$member.fieldData.id}&memberSlug={$member.fieldData.member_slug}">
+ <img src="{$ajaxUrl}?action=glm_members_admin_ajax&glm_action=memberGraphs&graphType=views&graphPeriod=oneMonth&memberId={$member.fieldData.id}&memberSlug={$member.fieldData.member_slug}">
+ <div>
+ <span class="glm-right">{$thisDate}</span>
+ <span class="glm-left">Detail Page Views for Past 2 Years</span>
+ </div>
+ <img src="{$ajaxUrl}?action=glm_members_admin_ajax&glm_action=memberGraphs&graphType=views&graphPeriod=twoYears&memberId={$member.fieldData.id}&memberSlug={$member.fieldData.member_slug}">
</div>
<div class="button button-secondary graph-print glm-right" data-areaToPrint="viewsPrintArea">Print</div>
</div>
});
});
-
-
// Display selected graph dialog box
$('.dialog-button').click( function() {
- $(".graph-dialog").dialog("close");
+ $(".graph-dialog").dialog("close");
var graph = $(this).attr('data-type');
$('#' + graph).dialog("open");
return false;
});
-
-
- $('#showArchived').click( function() {
- checked = 'false';
- if ($(this).attr('checked') == 'checked') {
- checked = 'true';
- }
+ $('#showArchived').click( function() {
+ checked = 'false';
+ if ($(this).attr('checked') == 'checked') {
+ checked = 'true';
+ }
window.location.replace("{$thisUrl}?page={$thisPage}&glm_action=index&member={$memberID}&showArchived=" + checked);
- });
-
+ });
+
// Flash certain elements for a short time after display
$(".glm-flash-updated").fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500);
<table class="wp-list-table widefat fixed posts glm-admin-table"">
<thead>
<tr>
+ <th>ID</th>
<th>Region</th>
<th>Description</th>
<th>Short Description</th>
{else}
<tr class="alternate">
{/if}
+ <td>{$t.id}</td>
<td>
<a class="editRegion" data-regionID="{$t.id}">{$t.name}</a>
</td>
{include file='front/error/header.html'}
-
- <h2>Sorry, we've had an error.</h2>
-
- <p><b>Error: </b>: An invalid action or Shortcode attribute has been specified.</p>
-
- <p>Please try again. If you still get the same error, contact Gaslight Media at 231-487-0692 for assistance.</p>
-
+<center>
+ <div id="glm-admin-content-container" class="glm-center" style="width: 600px; text-align: left; padding: 1em;">
+ <center>
+ <h1 class="glm-error">Aw shucks!</h1>
+ <h3>We couldn't get you the page you wanted. </h3>
+ <div style="width: 600px; text-align: left;">
+ <p>
+ Yes, something went wrong, but we really want to make it right. In fact, we've already
+ notified our hard-working Web crew that you had this problem and will do what we can
+ to make sure it doesn't happen again.
+ </p>
+ <p>
+ As far as we can tell now, <b>an invalid action has been requested</b>. This really shouldn't
+ happen, so we're going to research this to see if we can avoid this in the future.
+ </p>
+ {if isset($errorMsg) && $errorMsg}
+ <p>Oh, we have a little more information for you.</p>
+ <p>{$errorMsg}</p>
+ {/if}
+
+ <p>
+ Please head back to the link below and try again. If you continue to get this error,
+ please call for assistance.
+ </p>
+ <p style="text-align: center;"><a href="{$siteBaseUrl}">Return to Home Page</a></p>
+ </div>
+ </center>
+ </div>
+</center>
{include file='front/footer.html'}
<div class="wrap">
-
-
-
\ No newline at end of file
{include file='front/error/header.html'}
-
- <center>
-
- <h3>Sorry, we've had some type of fatal error.</h3>
-
- {if $errorMsg}<p>{$errorMsg}</p>{/if}
-
- <p>Please try again. If you still get the same error, contact Gaslight Media at 231-487-0692 for assistance.</p>
-
- </center>
-
+<center>
+ <div id="glm-admin-content-container" class="glm-center" style="width: 600px; text-align: left; padding: 1em;">
+ <center>
+ <h1 class="glm-error">Aw shucks!</h1>
+ <p><b>We couldn't get you the page you wanted.</b></p>
+ <div style="width: 600px; text-align: left;">
+ <p style="margin-top: .5em;">
+ Yes, something went wrong, but we really want to make it right. In fact, we've already
+ notified our hard-working Web crew that you had this problem and will do what we can
+ to make sure it doesn't happen again.
+ </p>
+ {if isset($errorMsg) && $errorMsg}
+ <p style="margin-top: .5em;">Oh, we have a little more information for you.</p>
+ <p style="margin-top: .5em;"><b>{$errorMsg}</b></p>
+ {/if}
+
+ <p style="margin-top: .5em;">
+ Please head back to the link below and try again. If you continue to get this error,
+ please call for assistance.
+ </p>
+ <p style="margin-top: .5em; text-align: center;"><a href="{$siteBaseUrl}">Return to Home Page</a></p>
+ </div>
+ </center>
+ </div>
+</center>
{include file='front/footer.html'}