Exemplo n.º 1
0
 public function unsubscribeEmailToken($token, $email)
 {
     $unsubscribe = false;
     $account = new Cart66Account();
     $accounts = $account->getModels();
     foreach ($accounts as $a) {
         $md5 = md5($a->id . $a->email . $a->created_at . '*c66*(#)');
         if ($token == $md5) {
             $a->setData(array('opt_out' => 1));
             $a->save();
             $a->clear();
             $unsubscribe = true;
         }
     }
     return $unsubscribe;
 }
 public static function accountsTable()
 {
     $columns = array('a.id', 'a.first_name', 'a.last_name', 'a.username', 'a.email', 'a.notes', 's.subscription_plan_name', 's.feature_level', 's.active_until', "concat_ws(' ', a.first_name,a.last_name)");
     $indexColumn = "DISTINCT a.id";
     $tableName = Cart66Common::getTableName('accounts') . ' as a, ' . Cart66Common::getTableName('account_subscriptions') . ' as s';
     if (isset($_GET['iSortCol_0'])) {
         $sortingColumns = array(0 => 0, 1 => 1, 2 => 3, 3 => 4, 4 => 6, 5 => 7, 6 => 8, 7 => 9);
         $_GET['iSortCol_0'] = $sortingColumns[$_GET['iSortCol_0']];
     }
     $where = self::dataTablesWhere($columns) == '' ? 'WHERE s.account_id = a.id' : self::dataTablesWhere($columns) . ' AND s.account_id = a.id ';
     $limit = self::dataTablesLimit() == '' ? null : self::dataTablesLimit();
     $order = self::dataTablesOrder($columns);
     $iTotal = self::totalRows($indexColumn, $tableName, 'WHERE s.account_id = a.id');
     $iFilteredTotal = self::filteredRows($indexColumn, $tableName, $where);
     $data = array();
     $account = new Cart66Account();
     $accounts = $account->getModels($where, $order, $limit, $tableName, $indexColumn);
     foreach ($accounts as $a) {
         $planName = 'No Active Subscription';
         $featureLevel = 'No Access';
         $activeUntil = 'Expired';
         if ($sub = $a->getCurrentAccountSubscription(true)) {
             $planName = $sub->subscriptionPlanName;
             $featureLevel = $sub->isActive() ? $sub->featureLevel : 'No Access - Expired';
             $activeUntil = $sub->isActive() ? date(get_option('date_format'), strtotime($sub->activeUntil)) : 'No Access';
             $activeUntil = $sub->lifetime == 1 ? "Lifetime" : $activeUntil;
             $type = 'Manual';
             if ($sub->isPayPalSubscription()) {
                 $type = 'PayPal';
             } elseif ($sub->isSpreedlySubscription()) {
                 $type = 'Spreedly';
             }
         } else {
             $planName = 'No plan available';
             $featureLevel = 'No Feature Level';
             $activeUntil = 'No Access';
             $type = 'None';
         }
         $data[] = array($a->id, $a->first_name . ' ' . $a->last_name, $a->username, $a->email, $planName, $featureLevel, $activeUntil, $type, $a->notes, $a->getOrderIdLink());
     }
     $array = array('sEcho' => $_GET['sEcho'], 'iTotalRecords' => $iTotal[0], 'iTotalDisplayRecords' => $iFilteredTotal[0], 'aaData' => $data);
     echo json_encode($array);
     die;
 }
Exemplo n.º 3
0
<?php

$account = new Cart66Account();
$data['accounts'] = $account->getModels('where id>0', 'order by last_name', '1');
?>
<form action="admin.php?page=cart66-accounts" method='post'>
  <input type='hidden' name='cart66-action' value='save account' />
  <input type='hidden' name='account[id]' value='<?php 
echo $data['account']->id;
?>
' />
  <input type='hidden' name='plan[id]' value='<?php 
if (isset($data['plan'])) {
    echo $data['plan']->id;
}
?>
' />
  
  <div id="widgets-left" style="margin-right: 50px;">
    <div id="available-widgets">
    
      <div class="widgets-holder-wrap">
        <div class="sidebar-name">
          <div class="sidebar-name-arrow"><br/></div>
          <h3><?php 
_e('Account', 'cart66');
?>
 <span><img class="ajax-feedback" alt="" title="" src="images/wpspin_light.gif"/></span></h3>
        </div>
        <div class="widget-holder" style="overflow: hidden; display: block;">