Statistics: Posted by Cristián Lávaque — November 21st, 2011, 3:47 am
<?php
// Check if this is a redirect from a restricted page
if(isset($_GET['s2member_seeking'])) { $url_attempt = $_GET['s2member_seeking']; }
if($url_attempt){
// Extract the Specific Post/Page ID that the user is attempting to access
$url_attempt = str_replace(" ", "", $url_attempt);
$id_attempt = explode("-", $url_attempt);
$id_attempt = $id_attempt[1];
if(is_numeric($id_attempt)){
// Check if the Specific Page/Post ID is one that
// we want to redirect to its own Purchase Page.
// You can add new case statements for every page
// that you want to redirect. Make sure the case
// statement ends with break;
switch($id_attempt) {
case "12214": // Specific Page/Post ID
$purchase_page = "http://example.com/purchase-page-for-12214/"; // Purchase page
break;
case "12315": // Specific Page/Post ID
$purchase_page = "http://example.com/purchase-page-for-12315/"; // Purchase page
break;
default: // Always leave this here
$purchase_page = "";
break;
}
// If we need to redirect
if(trim($purchase_page) != "") {
// Use JavaScript to redirect to the correct purchase page
?>
<script type="text/javascript">
<!--
window.location = "<?php echo $purchase_page; ?>";
//-->
</script>
<?php
}
}
}
?>
Statistics: Posted by Raam Dev — November 19th, 2011, 7:11 pm
Statistics: Posted by Cristián Lávaque — September 10th, 2011, 2:28 am
<?php
// What level they need to be. I'm not using this for now as I only have one premium level
// $level_required = $_GET['s2member_level_req'];
$url_attempt = $_GET['s2member_seeking']; // What page/post they were trying to access
if($url_attempt){ // If it was a redirect
$url_attempt = str_replace(" ", "", $url_attempt); //Ensure no spaces (shouldn't be issue)
$id_attempt = explode("-", $url_attempt); // Seperate post/page and ID
// This would tell if you if post, page, or other (I'm not using this for now)
// echo 'page/post ', $id_attempt[0];
if(is_numeric(end($id_attempt))){ // if page/post is a number - ID ?>
<p> Sorry "<?php echo get_the_title(end($id_attempt)); ?>" is for members only. Check out our awesome deals below to get access to the templates, along with tools, plugins, and other goodies!</p>
<br />
<?php
// Of course you might want to be more specific depending on what they were trying to access
}
} ?>
Statistics: Posted by son0fhobs — September 9th, 2011, 9:34 pm