Ejemplo n.º 1
0
	Did the current visitor come from a banner?
	<?php 
echo mm_custom_decision(array("source" => "banner")) == true ? "Yes" : "No";
?>
	<a href="<?php 
echo MM_Utils::appendUrlParam(MM_Utils::constructPageUrl(), "source", "banner");
?>
">Click here to test</a>
</p>
<p>
	Did the current visitor come from an email?
	<?php 
echo mm_custom_decision(array("source" => "email")) == true ? "Yes" : "No";
?>
	<a href="<?php 
echo MM_Utils::appendUrlParam(MM_Utils::constructPageUrl(), "source", "email");
?>
">Click here to test</a>
</p>


<h2>[MM_Member_Decision]</h2>

<!-- NOTE: The membershidId attribute should be changed to a valid Membership Level ID from your MemberMouse site. -->
<p>
	Is the current visitor a member? 
	<?php 
echo mm_member_decision(array("isMember" => "true")) == true ? "Yes" : "No";
?>
</p>
<p>
Ejemplo n.º 2
0
 public function handlePageAccess()
 {
     global $wp_query, $current_user;
     if (class_exists("MM_CorePageEngine")) {
         if (isset($wp_query->post) && isset($wp_query->post->ID)) {
             if (!isset($_POST["log"])) {
                 if (!MM_CorePageEngine::isMyAccountCorePage($wp_query->post->ID) && !MM_CorePageEngine::isLoginCorePage($wp_query->post->ID) && !MM_CorePageEngine::isErrorCorePage($wp_query->post->ID)) {
                     MM_Session::clear(MM_OptionUtils::$OPTION_KEY_LAST_PAGE_DENIED);
                 }
             }
         }
         if (MM_CorePageEngine::isFrontPage()) {
             MM_CorePageEngine::redirectToSiteHomePage(true);
         } else {
             if (isset($wp_query->post) && isset($wp_query->post->ID) && intval($wp_query->post->ID) > 0) {
                 $isAdmin = false;
                 if (isset($current_user->ID)) {
                     if (MM_Employee::isEmployee()) {
                         $isAdmin = true;
                     }
                 }
                 if ($isAdmin) {
                     $preview = MM_Preview::getData();
                     if ($preview !== false) {
                         if (MM_CorePageEngine::isMemberHomePage($wp_query->post->ID) || MM_CorePageEngine::isSaveTheSalePage($wp_query->post->ID) || MM_CorePageEngine::isMyAccountCorePage($wp_query->post->ID)) {
                             // if preview settings is set to non-members, redirect to the error page
                             if ($preview->getMembershipId() <= 0) {
                                 $url = MM_CorePageEngine::getUrl(MM_CorePageType::$ERROR, MM_Error::$ACCESS_DENIED);
                                 $currentUrl = MM_Utils::constructPageUrl();
                                 $compareUrl = preg_replace("/https?/", "", $url);
                                 $compareUrl = preg_replace("/\\/\\?/", "?", $compareUrl);
                                 $currentUrl = preg_replace("/https?/", "", $currentUrl);
                                 $currentUrl = preg_replace("/\\/\\?/", "?", $currentUrl);
                                 if (strpos($currentUrl, $compareUrl) !== 0) {
                                     header("Location: {$url}");
                                     exit;
                                 }
                             }
                         }
                     }
                 } else {
                     // check user account status
                     $userObj = new MM_User($current_user->ID);
                     if ($userObj->getStatus() == MM_Status::$CANCELED || $userObj->getStatus() == MM_Status::$LOCKED) {
                         wp_logout();
                         if ($userObj->getStatus() == MM_Status::$LOCKED) {
                             $url = MM_CorePageEngine::getUrl(MM_CorePageType::$ERROR, MM_Error::$ACCOUNT_LOCKED);
                             wp_redirect($url);
                             exit;
                         } else {
                             if ($userObj->getStatus() == MM_Status::$CANCELED && !MM_CorePageEngine::isSaveTheSalePage($wp_query->post->ID)) {
                                 $url = MM_CorePageEngine::getUrl(MM_CorePageType::$ERROR, MM_Error::$ACCOUNT_CANCELED);
                                 wp_redirect($url);
                                 exit;
                             }
                         }
                     }
                 }
                 // don't allow access to member homepages, save-the-sale pages or the
                 // my account page if the user is not logged in
                 if (MM_CorePageEngine::isMemberHomePage($wp_query->post->ID) || MM_CorePageEngine::isSaveTheSalePage($wp_query->post->ID) || MM_CorePageEngine::isMyAccountCorePage($wp_query->post->ID)) {
                     if (!is_user_logged_in()) {
                         // if user is not logged in, redirect them to the login page, but first saved
                         // the attempted access page incase they log in succesfully afterwards
                         MM_Session::value(MM_OptionUtils::$OPTION_KEY_LAST_PAGE_DENIED, $wp_query->post->ID);
                         header("Location: " . MM_CorePageEngine::getUrl(MM_CorePageType::$LOGIN_PAGE));
                         exit;
                     } else {
                         if (MM_CorePageEngine::isMemberHomePage($wp_query->post->ID)) {
                             // check if there's a specific member homepage for this user
                             MM_CorePageEngine::redirectToMemberHomePage($wp_query->post->ID);
                         } else {
                             if (MM_CorePageEngine::isSaveTheSalePage($wp_query->post->ID)) {
                                 // check if there's a specific save-the-sale page for this user
                                 MM_CorePageEngine::redirectToSaveTheSalePage($wp_query->post->ID);
                             }
                         }
                     }
                 }
             }
         }
         if (!is_admin()) {
             $protectedContent = new MM_ProtectedContentEngine();
             $postId = $wp_query->query_vars["page_id"];
             if (isset($wp_query->post) && isset($wp_query->post->ID) && intval($wp_query->post->ID) > 0) {
                 $postId = $wp_query->post->ID;
             }
             if (intval($postId) > 0) {
                 if (!is_feed()) {
                     $protectedContent->protectContent($postId, is_home());
                 }
             }
         }
     }
 }
Ejemplo n.º 3
0
<style>
.mm-payment-service-box {
  margin-bottom: 5px;
}
</style>

<div id="mm-test-data">
<form action="<?php 
echo MM_Utils::constructPageUrl();
?>
" method="post">
<?php 
$fieldInfo = array();
$field = new stdClass();
$field->fieldId = "mm_field_first_name";
$field->fieldName = "firstname";
$field->label = "FirstName";
$fieldInfo[] = $field;
$field = new stdClass();
$field->fieldId = "mm_field_last_name";
$field->fieldName = "lastname";
$field->label = "Last Name";
$fieldInfo[] = $field;
$field = new stdClass();
$field->fieldId = "mm_field_email";
$field->fieldName = "email";
$field->label = "Email";
$fieldInfo[] = $field;
$field = new stdClass();
$field->fieldId = "mm_field_username";