goldtest

getUser();
$user = Dap_User_TWDU::loadUserTWDU($user->getId()); //reload to TWDU User object
$product = Dap_Product::loadProductByName(BRONZE);
$userProduct = Dap_UsersProducts::load($user->getId(), $product->getId());
$activeResources = $userProduct->getActiveResources();
//take out bonuses, fix extra

    $activeResources = str_replace(“

  • Keyholder Member Home
  • “, “”, $activeResources);
    $activeResources = str_replace(“

  • Maximize Your Marketing
  • “,””, $activeResources);
    $activeResources = str_replace(“

      “, “”, $activeResources);
      $activeResources = str_replace(“

    “, “”, $activeResources);

    $output = ”





    “;

    $userProducts = Dap_UsersProducts::loadProducts($user->getId());

    $counter = 0;
    foreach ($userProducts as $userProductSingle) {
    $productSingle = Dap_Product::loadProduct($userProductSingle->getProduct_id());
    if($productSingle->getName() != BRONZE && $productSingle->getName() != SILVER && $productSingle->getName() != GOLD && $productSingle->getIsBonus() != “Y” && $userProductSingle->getActiveResources() != “

      “) {
      $fixedResource = str_replace(“

        “, “”, $userProductSingle->getActiveResources());
        $fixedResource = str_replace(“

      “, “”, $fixedResource);
      //List of products
      //load the category the product belongs to
      if($productSingle->getCategory() == 0 || $productSingle->getCategory() == null) {
      $catIndex = 9999999;
      if(empty($preOutputArray[$catIndex])) $preOutputArray[$catIndex] = “Other”;
      }
      else {
      $category = Dap_ProductCategories::load($productSingle->getCategory());
      //set the category name in the output array
      $catIndex = $category->getOrder() * 1000;
      if(empty($preOutputArray[$catIndex])) $preOutputArray[$catIndex] = $category->getName();
      }

      //place the product in out put array at the index order + 000
      $preOutputArray[$catIndex] .= $fixedResource;

      //$preOutput .= $fixedResource;
      //need a list of just library products for latest 3 div
      $cleanedUserProducts[] = $userProductSingle;
      $counter++;
      }
      }
      //after loop through, we’ll create output string from array
      //$preOutput = implode($preOutputArray);
      $preOutput .= $preOutputArray[1000] . $preOutputArray[2000] . $preOutputArray[3000] . $preOutputArray[9999999];
      //latest 3 div
      $lastIndex = (count($cleanedUserProducts) – 1);
      //make sure user has at least 1 product
      if($lastIndex >= 0) {
      $cleanUserProduct = $cleanedUserProducts[0];
      $fixedResource = str_replace(“

        “, “”, $cleanUserProduct->getActiveResources());
        $fixedResource = str_replace(“

      “, “”, $fixedResource);
      $top3Output = $fixedResource;
      if($lastIndex >= 1) {
      $cleanUserProduct = $cleanedUserProducts[1];
      $fixedResource = str_replace(“

        “, “”, $cleanUserProduct->getActiveResources());
        $fixedResource = str_replace(“

      “, “”, $fixedResource);
      $top3Output .= $fixedResource;
      }
      if($lastIndex >= 2) {
      $cleanUserProduct = $cleanedUserProducts[2];
      $fixedResource = str_replace(“

        “, “”, $cleanUserProduct->getActiveResources());
        $fixedResource = str_replace(“

      “, “”, $fixedResource);
      $top3Output .= $fixedResource;
      }
      }

      $productsForBonuses = Dap_Product::loadProducts(“”, “”);
      foreach($productsForBonuses as $productForBonuses) {
      if($productForBonuses->getIsBonus() == “Y”) {
      $twduMemb = Dap_User::twduMembership($user->getId());
      switch($twduMemb) {
      case “http://www.thewealthydentistuniversity.com/” . GOLDurl:
      $twduMemb = 16;
      break;
      case “http://www.thewealthydentistuniversity.com/” . SILVERurl:
      $twduMemb = 15;
      break;
      case “http://www.thewealthydentistuniversity.com/” . BRONZEurl:
      $twduMemb = 9;
      break;
      }
      //only allow if bonus belongs to their twdu main product
      if(in_array($twduMemb, explode(“,”, $productForBonuses->getBonusBelongsTo()))) {
      $fileResourcesArray = Dap_Product::displayFileResourcesList($productForBonuses->getId());
      if($fileResourcesArray) {
      foreach($fileResourcesArray as $fileResources) {
      $preBonuses = “

    • “;
      $preBonuses .= $fileResources;
      $preBonuses .= “
    • “;
      $bonuses = substr_replace($bonuses, $preBonuses, 0, 0);
      }
      }
      }
      }
      }
      if($counter == 0) {
      $top3Output = “None added yet.”;
      }
      //build Notices
      //function that returns an array of non-expired notices
      $notificationArray = Notifications::loadAllNotExpired($user->getId());
      if($notificationArray) {
      //everything in array is shown if someone clicks on their notifications list
      foreach($notificationArray as $notification) {
      $notifyDivs .= “

      getId().”\” class=\”reminders\”>
      “.$notifyHiddenDivs.”

      Newest Additions To Your Library

      “.$top3Output.”

      ” . $product->getName() . “

      Video Tutorials

      Your Personal Library

        “;

        $output .= $preOutput;
        if($counter == 0) {$output .= “None added yet.”;}
        $output .= ‘

      ‘;
      //Bonuses
      $output .= “

      Your Bonuses

        “.$bonuses.”

      “;

      echo $output;
      ?>