I think I’m starting to understand the basics of how s2member works. I have to say it’s been put together very well.
I’ve been tweaking my member option page and found the following code to display the “Sorry… you need Level X to access it.”
function s2hack_membership_options_vars( $atts ){
if(isset($_GET['_s2member_seeking'])) # We need to display something
{
$s2_seeking = $_GET['_s2member_seeking']; # Content user was trying to access
$s2_level = $_GET['_s2member_req']; # What was needed to access said content]
if(!empty($s2_seeking['page']))
$content = 'page';
elseif (!empty($s2_seeking['post']))
$content = 'post';
if(!empty($s2_level['level']))
$req = 'Level ' . $s2_level['level'];
else
$req = 'at least a free subscription';
return '<strong>Sorry, this ' . $content . ' is restricted. You need ' . $req . ' to access it.</strong>';
}
else
return; # We don't need to do anything, no variables passed.
}
add_shortcode( 'membership_options_vars', 's2hack_membership_options_vars' );
Overall it works very well, but how can I get it to return the “labels” I assigned to each level instead of the actual level number.
I know I have to change the following but I don’t know to how or rather to what.
if(!empty($s2_level['level']))
$req = 'Level ' . $s2_level['level'];
Thanks