Skip to content

Instantly share code, notes, and snippets.

@greenhornet79
Created November 3, 2023 15:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save greenhornet79/db30255b891c885b39d00654edbf504f to your computer and use it in GitHub Desktop.
Save greenhornet79/db30255b891c885b39d00654edbf504f to your computer and use it in GitHub Desktop.
<?php
$visibility = get_post_meta(get_the_ID(), '_issuem_leaky_paywall_visibility', true );
$current_user_level_id = leaky_paywall_subscriber_current_level_id();
if ( isset($visibility['visibility_type'] ) && $visibility['visibility_type'] == 'always' && $visibility['always_visible'][0] == -1 ) {
$show_to_everyone = true;
} else {
$show_to_everyone = false;
}
if ( $show_to_everyone ) {
echo '<a href="' . get_field( 'download_file' ) . '">Download</a>';
} else if ($current_user_level_id != 0 && leaky_paywall_user_has_access() ) {
echo '<a href="' . get_field('download_file') . '">Download</a>';
} else {
echo '<p>You do not have access to download this file.</p>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment