Created
June 17, 2013 16:01
-
-
Save micahwave/5798047 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// somewhere in single.php | |
if( time_is_paid_content() ) { | |
if( time_is_paid_user() ) { | |
the_content(); | |
} else { | |
echo 'Sorry, you must log in or sign up to view this content.' | |
} | |
} else { | |
the_content(); | |
} | |
// somewhere else | |
function time_is_paid_content() { | |
// checks post meta to see if content is paid | |
} | |
function time_is_paid_user() { | |
$validate_user = function() { | |
// validates the users cookie, returns bool | |
}; | |
if( function_exists( 'vary_cache_on_function' ) ) { | |
// im probably using this anonymous function wrong but you get the idea | |
vary_cache_on_function( "return $validate_user" ); | |
} | |
return $validate_user; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment