Statistics: Posted by Cristián Lávaque — June 21st, 2011, 11:54 am
function check_file( $file_name, $member_level ) {
$dir_name = "/home/public_html/content/plugins/s2member-files/access-" . $member_level . "/";
if (file_exists($dir_name . $file_name)) {
$return_url = "<a href=\"http://www.yourdomain.com/?s2member_file_download=access-" . $member_level . "/".$file_name."\">Download Template</a>";
//$return_file = "0";
} else {
$return_url = "<a href=\"http://www.yourdomain.com/somelink/\">Download Options</a>";
}
echo $return_url;
}
<?php if (current_user_is("s2member_level4")){
$member_level = "s2member-level4";
$file_name = get_post_meta($post->ID, 'Download File Name', true);
check_file($file_name, $member_level);
} else if (current_user_is("s2member_level3")){
$member_level = "s2member-level3";
$file_name = get_post_meta($post->ID, 'Download File Name', true);
check_file($file_name, $member_level);
} else if (current_user_is("s2member_level2")){
$member_level = "s2member-level2";
$file_name = get_post_meta($post->ID, 'Download File Name', true);
check_file($file_name, $member_level);
} else if (current_user_is("s2member_level1")){
$member_level = "s2member-level1";
$file_name = get_post_meta($post->ID, 'Download File Name', true);
check_file($file_name, $member_level);
} else if (current_user_is("s2member_level0")){
$member_level = "s2member-level0";
$file_name = get_post_meta($post->ID, 'Download File Name', true);
check_file($file_name, $member_level);
} else {
echo "<a href=\"http://www.yourdomain.com/prices/\">Download Options</a>";
}
?>
Statistics: Posted by webfed — June 21st, 2011, 6:28 am