I would like to be able to display links based on the custom capabilities assigned to a user.
I am currently using this code to create a menu on a page and using a plugin that allows php inside posts and pages.
Though the links are displaying, it is displaying all links to all users no matter the custom capabilities assigned to the account. Since they do not have access to the content when they click on a link they see the “access denied” page.
How can I set it up so that they only see what they have access to?
<ul>
<?php if (current_user_can("access_s2member_ccap_hbs")){ ?>
<li>[wpfilebase tag=file id=1137 tpl=simple /]</li>
<?php } ?>
<?php if (current_user_can("access_s2member_ccap_sbs")){ ?>
<li>[wpfilebase tag=file id=1197 tpl=simple /]</li>
<?php } ?>
<?php if (current_user_can("access_s2member_ccap_h1r")){ ?>
<li><a title="House First Reading" href="http://alrrs.com/reports/house-first-reading/">House First Readings</a></li>
<?php } ?>
<?php if (current_user_can("access_s2member_ccap_s1r")){ ?>
<li><a title="Senate First Reading" href="http://alrrs.com/reports/senate-first-reading/">Senate First Readings</a></li>
<?php } ?>
<?php if (current_user_can("access_s2member_ccap_h2r")){ ?>
<li><a title="House Second Reading" href="http://alrrs.com/reports/house-second-reading/">House Second Readings</a></li>
<?php } ?>
<?php if (current_user_can("access_s2member_ccap_s2r")){ ?>
<li><a title="Senate Second Reading" href="http://alrrs.com/reports/senate-second-reading/">Senate Second Readings</a></li>
<?php } ?>
<?php if (current_user_can("access_s2member_ccap_cma")){ ?>
<li>[wpfilebase tag=file id=1179 tpl=simple /]</li>
<?php } ?>
<?php if (current_user_can("access_s2member_ccap_lrr")){ ?>
<li>[wpfilebase tag=file id=1172 tpl=simple /]</li>
<?php } ?>
<?php if (current_user_can("access_s2member_ccap_scr")){ ?>
<li>[wpfilebase tag=file id=1196 tpl=simple /]</li>
<?php } ?>
<?php if (current_user_can("access_s2member_ccap_like")){ ?>
<li>[wpfilebase tag=file id=1198 tpl=simple /]</li>
<?php } ?>
</ul>