mercredi 8 juin 2016

WooCommerce Memberships: Conditional Restricted Content Check

I'm trying to make a menu of pages links that people can access once they have purchased a membership (through WooCommerce Memberships). I want for that pages to be greyed out, if they don't yet have access to them.

I've set the pages to gain access X days after purchase in WooCommerce Memberships, however the code I am using is simply not working. It is returning false even when it should return true.

Any ideas?

<?php 
     $restrict_th0 = wc_memberships_is_post_content_restricted(24);
     $restrict_th1 = wc_memberships_is_post_content_restricted(28);
     $restrict_th2 = wc_memberships_is_post_content_restricted(30);
?>

<ul id="menu-academy">
     <li>
     <?php if ( $restrict_th0 ) { } else { ?>
          <a href="<?php echo home_url(); ?>/URL HERE/">
     <?php } ?>
     <span class="module_no">0</span><span class="module_descript">MODULE DESCRIPTION<span class="module_access<?php if ( $restrict_th0 ) { ?> lock<?php } ?>">
     <i class="fa fa-2x fa-<?php if ( $restrict_th0 ) { } else { ?>un<?php } ?>lock<?php if ( $restrict_th0 ) { } else { ?>-alt<?php } ?>" aria-hidden="true"></i></span></span><?php if ( $restrict_th0 ) { } else { ?></a><?php } ?></li>

</ul



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire