Created
November 3, 2023 15:51
-
-
Save greenhornet79/db30255b891c885b39d00654edbf504f to your computer and use it in GitHub Desktop.
This file contains 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 | |
$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