<?php $now = date("m/d/Y", MM_Utils::getCurrentTime("timestamp")); $threeMonthsAgo = date("m/d/Y", strtotime("-3 months", MM_Utils::getCurrentTime("timestamp"))); $dashboard = new MM_ReportingDashboard(); $totalMbrsStyle = "width:25%;"; $retentionStyle = "width:25%;"; $avgCustValueStyle = "width:25%;"; $engagementStyle = "width:25%;"; $totalRevenueStyle = "width:25%;"; $retentionRateStyle = "width:15%;"; $churnStyle = "width:15%;"; $avgDailyRevenueStyle = "width:20%;"; $avgMonthlyRevenueStyle = "width:25%;"; $hasAdvancedReporting = MM_MemberMouseService::hasPermission(MM_MemberMouseService::$FEATURE_REPORTING_SUITE) == MM_MemberMouseService::$ACTIVE ? true : false; if (!$hasAdvancedReporting) { $totalMbrsStyle = "width:33%;"; $retentionStyle = "width:33%;"; $engagementStyle = "width:33%;"; $totalRevenueStyle = "width:33%;"; $avgDailyRevenueStyle = "width:33%;"; $avgMonthlyRevenueStyle = "width:33%;"; } ?> <div class="mm-report-container"> <h2 class="mm-dashboard-title">Dashboard</h2> <?php include "dropdown_nav_menu.php"; ?> <!--/.reporting-dropdown-nav-->
<?php /** * * MemberMouse(TM) (http://www.membermouse.com) * (c) MemberMouse, LLC. All rights reserved. */ global $wpdb; global $current_user; $startDate = MM_Utils::dateToUTC(MM_Utils::getCurrentTime(), "Y-m-d H:i", "00:00:00"); /* * start calculations */ $activeStatus = MM_Status::$ACTIVE; $pendingCancellationStatus = MM_Status::$PENDING_CANCELLATION; $canceledStatus = MM_Status::$CANCELED; $statistics = MM_MemberMouseService::generateStatistics(); $newMembersPaid = 0; $newMembersFree = 0; $sql = "SELECT count(1) as members, memberships.is_free FROM " . MM_TABLE_USER_DATA . " u, " . MM_TABLE_MEMBERSHIP_LEVELS . " memberships "; $sql .= " WHERE u.membership_level_id=memberships.id AND u.became_active >= '{$startDate}' AND (u.status='{$activeStatus}' OR u.status='{$pendingCancellationStatus}')"; $sql .= " GROUP BY memberships.is_free"; $memberResults = $wpdb->get_results($sql); if ($memberResults != null && is_array($memberResults) && count($memberResults) > 0) { foreach ($memberResults as $k => $memberCount) { if ($memberCount->is_free == 1) { $newMembersFree = $memberCount->members; } else { $newMembersPaid = $memberCount->members; } }