Ejemplo n.º 1
0
/**
 * 
 * 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;
        }
    }
}