I got it working
if (current_user_can("access_s2member_ccap_" . $lowercnumber)){
Here is the complete working code (in case someone needs to do something like this
Declare Variables at top of template file —->
// declare variables //
$cid = get_post_meta($post->ID, 'show_course_ss', true);
$sql = "SELECT * FROM wp_wpcw_courses";
$result = mysql_query($sql)or die(mysql_error());
$row = mysql_fetch_array($result);
$cprice = $row['course_price'];
$ctitle = $row['course_title'];
$cnumbr = $row['course_number'];
$postid = get_the_ID();
$shows2ppinv = S2MEMBER_VALUE_FOR_PP_INV();
$s2cuvfppon0 = S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0;
$s2cuvfppon1 = S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1;
$s2cuvfppos0 = S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0;
$s2cuvfppos1 = S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1;
// For some reason custom capabilities in s2member only work if they are lowercase - so this will take care of that lil bugger
$lowercnumber = strtolower($cnumbr);
Use this code where you would like data to appear in template file –>
<?php if (current_user_can('access_s2member_level1')){
echo "<h4>Course Details</h4>";
if (current_user_can("access_s2member_ccap_" . $lowercnumber)){
//if a user is logged in and has purchased a course we show them the course //
echo do_shortcode ('[wpcourse course="'.$cid.'" module_desc="false" show_title="false" show_desc="false"/]');
} else {
echo "<form action='https://www.paypal.com/cgi-bin/webscr' method='post'>
<input type='hidden' name='business' value='mypaypal@mydomain.com' />
<input type='hidden' name='cmd' value='_xclick' />
<!-- Instant Payment Notification & Return Page Details -->
<input type='hidden' name='notify_url' value='http://example.com/?s2member_paypal_notify=1' />
<input type='hidden' name='cancel_return' value='http://example.com/' />
<input type='hidden' name='return' value='http://example.com/?s2member_paypal_return=1' />
<input type='hidden' name='rm' value='2' />
<!-- Configures Basic Checkout Fields -->
<input type='hidden' name='lc' value='' />
<input type='hidden' name='no_shipping' value='1' />
<input type='hidden' name='no_note' value='1' />
<input type='hidden' name='custom' value='example.com' />
<input type='hidden' name='currency_code' value='USD' />
<input type='hidden' name='page_style' value='paypal' />
<input type='hidden' name='charset' value='utf-8' />
<input type='hidden' name='item_name' value='".$ctitle."' />
<input type='hidden' name='item_number' value='1:".$lowercnumber."' />
<input type='hidden' name='invoice' value='". $shows2ppinv ."' />
<input type='hidden' name='on0' value='". $s2cuvfppon0 ."' />
<input type='hidden' name='os0' value='". $s2cuvfppos0 ."' />
<!-- Identifies The Customers IP Address For Tracking -->
<input type='hidden' name='on1' value='". $s2cuvfppon1 ."' />
<input type='hidden' name='os1' value='". $s2cuvfppos1 ."' />
<!-- Controls Modify Behavior At PayPal Checkout -->
<!-- Customizes Prices, Payments & Billing Cycle -->
<input type='hidden' name='amount' value='".$cprice."' />
<input type='image' src='https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif' style='width:auto; height:auto; border:0;' alt='PayPal' />
</form>";
}
} else {
//if a user is NOT logged in - they can neither purchase a course and they cannot view the course - regardless
echo "<div class='cqd-notice rounded'>Please <a href='/register/'>Register</a> for an account or <a href='/login/'>Login</a> with an existing an account to <strong>enroll</strong> or <strong>purchase</strong> this course!</div>";
} ?>