Example #1
0
function getObject($val)
{
    $id = preg_replace("/[^0-9]+/", "", $val);
    if (preg_match("/(at_|access_tag)/", $val)) {
        $obj = new MM_Bundle($id);
        if ($obj->isValid()) {
            return $obj;
        }
    } else {
        if (preg_match("/(mt_|member_type)/", $val)) {
            $obj = new MM_MembershipLevel($id);
            if ($obj->isValid()) {
                return $obj;
            }
        }
    }
    return false;
}
Example #2
0
    $crntItem->id = $item->id;
    $crntItem->bundle_id = $item->bundle_id;
    if ($item->list_type == MM_AbstractEmailServiceProvider::$LIST_TYPE_ACTIVE) {
        $crntItem->active_list_id = $item->list_id;
    } else {
        if ($item->list_type == MM_AbstractEmailServiceProvider::$LIST_TYPE_CANCELED) {
            $crntItem->canceled_list_id = $item->list_id;
        }
    }
    $bundleMappings[$item->bundle_id] = $crntItem;
}
// generate rows
$rows = array();
$export_url = MM_PLUGIN_URL . '/com/membermouse/esp/util/export_members.php';
foreach ($bundleMappings as $key => $item) {
    $bundle = new MM_Bundle($item->bundle_id);
    $bundleName = MM_NO_DATA;
    if (!$bundle->isValid()) {
        continue;
    }
    $bundleName = $bundle->getName();
    // Actions
    $editActionUrl = 'onclick="mmjs.edit(\'mm-bundle-mapping-dialog\', \'' . $item->bundle_id . '\', 475, 235)"';
    $deleteActionUrl = 'onclick="mmjs.remove(\'' . $item->bundle_id . '\')"';
    $actions = MM_Utils::getEditIcon("Edit Bundle Mapping", '', $editActionUrl);
    $actions .= MM_Utils::getDeleteIcon("Delete Bundle Mapping", 'margin-left:5px;', $deleteActionUrl);
    $actions .= "<a onclick='mmjs.exportMembers(\"{$export_url}?bundle_id={$item->bundle_id}\"); return false;' style='cursor:pointer; margin-left:5px;' title='Export members with &apos;{$bundleName}&apos; bundle active on their account'>" . MM_Utils::getIcon('download', 'green', '1.3em', '2px') . "</a>";
    $actions .= "<a onclick='mmjs.exportMembers(\"{$export_url}?bundle_id={$item->bundle_id}&export_type=canceled_bundles\"); return false;' style='cursor:pointer; margin-left:5px;' title='Export members with &apos;{$bundleName}&apos; bundle canceled on their account'>" . MM_Utils::getIcon('download', 'red', '1.3em', '2px') . "</a>";
    $activeListName = MM_NO_DATA;
    if (isset($item->active_list_id) && !empty($listNames[$item->active_list_id])) {
        $activeListName = $listNames[$item->active_list_id];
Example #3
0
        //must have membership ID or bundle ID
    }
    if (isset($_GET['membership_id'])) {
        $includeBundleInfo = true;
        $membership = new MM_MembershipLevel();
        $membership->setId($_GET['membership_id']);
        $membership->getData();
        if (!$membership->isValid()) {
            exit;
        }
        $filename = preg_replace("/([^A-za-z0-9\\s])/", "", strtolower($membership->getName()));
        $filename = preg_replace("/\\s/", "_", $filename) . "_export.csv";
    } else {
        if (isset($_GET['bundle_id'])) {
            $includeBundleInfo = false;
            $bundle = new MM_Bundle($_GET['bundle_id']);
            if (!$bundle->isValid()) {
                exit;
            }
            $filename = preg_replace("/([^A-za-z0-9\\s])/", "", strtolower($bundle->getName()));
            $prefix = "";
            if ($export_type == 'canceled_bundles') {
                $prefix = "canceled_";
            }
            $filename = $prefix . preg_replace("/\\s/", "_", $filename) . "_export.csv";
        } else {
            exit;
        }
    }
} else {
    if ($export_type == 'cancellation') {
    $bundleMapping = $wpdb->get_results($sql);
    if ($bundleMapping) {
        foreach ($bundleMapping as $bundleMapping) {
            $bundleId = $bundleMapping->bundle_id;
            if ($bundleMapping->list_type == MM_AbstractEmailServiceProvider::$LIST_TYPE_ACTIVE) {
                $activeListId = $bundleMapping->list_id;
            } else {
                if ($bundleMapping->list_type == MM_AbstractEmailServiceProvider::$LIST_TYPE_CANCELED) {
                    $canceledListId = $bundleMapping->list_id;
                }
            }
        }
    }
}
// make sure bundle list only contains bundles that aren't mapped yet
$bundleList = MM_Bundle::getBundlesList();
$sql = "SELECT * FROM " . MM_TABLE_EMAIL_PROVIDER_BUNDLE_MAPPINGS . " WHERE email_service_provider_id = {$provider_entity_id} GROUP BY bundle_id;";
$rows = $wpdb->get_results($sql);
foreach ($rows as $row) {
    if ($row->bundle_id == $bundleId) {
        continue;
    }
    if (array_key_exists($row->bundle_id, $bundleList)) {
        unset($bundleList[$row->bundle_id]);
    }
}
if (count($bundleList) > 0) {
    ?>
<div id="mm-form-container">
<input type='hidden' id='mm_last_bundle_id' value='<?php 
    echo $p->id;
<?php

/**
 * 
 * MemberMouse(TM) (http://www.membermouse.com)
 * (c) MemberMouse, LLC. All rights reserved.
 */
$bundle = new MM_Bundle($p->accessTypeId);
function generatePurchaseSection($productId)
{
    ?>
	<div id="mm-purchaselinks-<?php 
    echo $productId;
    ?>
" style="display:none;">
	<p><strong>Purchase Link SmartTag</strong><?php 
    echo MM_Utils::getInfoIcon("You can use this Purchase Link SmartTag in any post or page on your site. When using this SmartTag MemberMouse will automatically generate a link customers can click on to purchase this bundle.");
    ?>
</p>
	
	<?php 
    $smartTag = "<a href=\"[MM_Purchase_Link productId='{$productId}']\">Buy Now</a>";
    ?>
	<input id="mm-smart-tag-<?php 
    echo $productId;
    ?>
" type="text" readonly value="<?php 
    echo htmlentities($smartTag);
    ?>
" style="width:440px; font-family:courier; font-size:11px;" onclick="jQuery('#mm-smart-tag-<?php 
    echo $productId;
}
$membership = null;
$bundle = null;
$products = array();
if ($p->accessType == MM_AccessControlEngine::$ACCESS_TYPE_MEMBERSHIP) {
    $membership = new MM_MembershipLevel($p->accessTypeId);
    if ($membership->isValid()) {
        $accessName = $membership->getName();
        $products = $membership->getProductIds();
    } else {
        echo "Payment Options Dialog: Invalid membership level ID '{$p->accessTypeId}'";
        exit;
    }
} else {
    if ($p->accessType == MM_AccessControlEngine::$ACCESS_TYPE_BUNDLE) {
        $bundle = new MM_Bundle($p->accessTypeId);
        if ($bundle->isValid()) {
            $accessName = $bundle->getName();
            $products = $bundle->getAssociatedProducts();
        } else {
            echo "Payment Options Dialog: Invalid bundle ID '{$p->accessTypeId}'";
            exit;
        }
    }
}
$actionParams = json_decode($p->lastActionParams);
$compFunction = $actionParams->mm_jshandle . ".";
$compFunction .= $actionParams->mm_compfunction . "(";
$compFunction .= htmlspecialchars(json_encode($p->lastActionParams), ENT_NOQUOTES);
$compFunction .= ");";
?>
Example #7
0
         if ($membership->isValid()) {
             $accessName = $membership->getName();
         } else {
             $accessName = "Unknown Membership";
         }
         if (!empty($params[MM_ActivityLog::$PARAM_ACCESS_STATUS])) {
             $accessStatusInfo = MM_Status::getImage($params[MM_ActivityLog::$PARAM_ACCESS_STATUS]);
             $accessStatusInfo .= " <em>" . MM_Status::getName($params[MM_ActivityLog::$PARAM_ACCESS_STATUS], true) . "</em>";
             if ($params[MM_ActivityLog::$PARAM_ACCESS_STATUS] == MM_Status::$ERROR && !empty($params[MM_ActivityLog::$PARAM_ACCESS_STATUS_MESSAGE])) {
                 $accessStatusInfo .= MM_Utils::getInfoIcon(htmlentities($params[MM_ActivityLog::$PARAM_ACCESS_STATUS_MESSAGE], ENT_QUOTES), "margin-left:4px;");
             }
         }
         break;
     case MM_Event::$BUNDLE_ADD:
     case MM_Event::$BUNDLE_STATUS_CHANGE:
         $bundle = new MM_Bundle($params[MM_ActivityLog::$PARAM_ACCESS_ID]);
         if ($bundle->isValid()) {
             $accessName = $bundle->getName();
         } else {
             $accessName = "Unknown Bundle";
         }
         if (!empty($params[MM_ActivityLog::$PARAM_ACCESS_STATUS])) {
             $accessStatusInfo = MM_Status::getImage($params[MM_ActivityLog::$PARAM_ACCESS_STATUS]);
             $accessStatusInfo .= " <em>" . MM_Status::getName($params[MM_ActivityLog::$PARAM_ACCESS_STATUS], true) . "</em>";
         }
         break;
 }
 // generate details and event type icon
 switch ($params[MM_ActivityLog::$PARAM_ACCESS_EVENT]) {
     case MM_Event::$MEMBER_ADD:
         $eventType = MM_Utils::getAccessIcon(MM_OrderItemAccess::$ACCESS_TYPE_MEMBERSHIP, "Member created");
Example #8
0
<?php

/**
 * 
 * MemberMouse(TM) (http://www.membermouse.com)
 * (c) MemberMouse, LLC. All rights reserved.
 */
$bundle = new MM_Bundle($p->id);
if (!$bundle->isFree() && $bundle->getAssociatedProducts() > 0 && !$bundle->hasSubscribers()) {
    $productsDisabled = "";
} else {
    $productsDisabled = "disabled='disabled'";
}
if ($bundle->hasSubscribers()) {
    $subTypeDisabled = "disabled='disabled'";
} else {
    $subTypeDisabled = "";
}
$provider = MM_EmailServiceProviderFactory::getActiveProvider();
$provider_token = strtolower($provider->getToken());
?>
<script>
function unlockBundle()
{
	jQuery("#expiry-setting").prop('disabled', false);
}
</script>

<style>
.noticeMessage {
	background-color: #FFFFE0;
Example #9
0
<?php

/**
 * 
 * MemberMouse(TM) (http://www.membermouse.com)
 * (c) MemberMouse, LLC. All rights reserved.
 */
$view = new MM_BundlesView();
$dataGrid = new MM_DataGrid($_REQUEST, "id", "desc", 10);
$data = $view->getViewData($dataGrid);
$dataGrid->setTotalRecords($data);
$dataGrid->recordName = "bundle";
$rows = array();
foreach ($data as $key => $item) {
    $tag = new MM_Bundle($item->id, false);
    // Type / Products
    if ($item->is_free != "1") {
        $products = array();
        $productIds = array();
        if (!empty($item->products)) {
            foreach ($item->products as $product) {
                $products[] = "<a href='" . MM_ModuleUtils::getUrl(MM_MODULE_PRODUCT_SETTINGS, MM_MODULE_PRODUCTS) . "&autoload=" . $product->id . "'>" . $product->name . "</a>";
                $productIds[] = $product->id;
            }
        }
        $bundleType = MM_Utils::getIcon('dollar', 'green', '1.3em', '2px', 'Paid Bundle');
        $productAssociations = MM_Utils::getIcon('shopping-cart', 'blue', '1.3em', '1px', 'Products', 'margin-right:5px;') . join(', ', $products);
        $purchaseLinks = '<a title="Get purchase links" onclick="mmjs.showPurchaseLinks(' . $item->id . ',\'' . htmlentities(addslashes($item->name), ENT_QUOTES) . '\', \'' . join(',', $productIds) . '\')" class="mm-ui-button" style="margin:0px;">' . MM_Utils::getIcon('money', '', '1.3em', '1px', '', 'margin-right:0px;') . '</a>';
    } else {
        $bundleType = MM_Utils::getIcon('dollar', 'red', '1.3em', '2px', 'Free Bundle');
        $productAssociations = MM_NO_DATA;
Example #10
0
 // membership level
 $membershipStr = $user->getMembershipName();
 if ($user->getStatus() == MM_Status::$PENDING_ACTIVATION || $user->getStatus() == MM_Status::$ERROR) {
     $membershipStr = "<em>" . $user->getMembershipName() . "</em>";
 }
 // bundles
 if (!empty($item->bundles)) {
     $bundles = explode(",", $item->bundles);
     // iterate over array of bundle IDs, lookup bundle ID name
     // and replace the ID with the bundle name
     for ($i = 0; $i < count($bundles); $i++) {
         $bundleId = $bundles[$i];
         if (isset($bundleName[$bundleId])) {
             $bundleName[$bundleId];
         } else {
             $bundle = new MM_Bundle($bundleId);
             if ($bundle->isValid()) {
                 // cache bundle name for future use while processing remaining rows
                 $bundleName[$bundleId] = $bundle->getName();
             } else {
                 $bundleName[$bundleId] = MM_NO_DATA;
             }
         }
         $bundles[$i] = $bundleName[$bundleId];
     }
     $bundles = implode(", ", $bundles);
 } else {
     $bundles = MM_NO_DATA;
 }
 // last login date
 $userEngagement = MM_NO_DATA;