Hi, I have a site with aMember Pro and Wordpress. I want to make it so that in the member's area, I can have a tab only show to people who have access to a certain product/membership level. If the user did not order that product, I don't want them to be able to see the product-specific tabs at all. Right now, they would see them but be told they have no access. Is there a way I can do this? If I have to customize a file such as site.php, I will as long as you post the full code for it. Thanks
You're probably going to have to submit a support ticket to aMember's team for this one as it's going to most likely involve writing an annoyingly complex set of IF/THEN statements to manage. That said, I don't think that would be terribly effective for your needs as those statements would need to be rewritten as you add, remove or change your product offerings. I think the better way to approach this is one of two methods. First, you might request this feature to the aMember bug/suggestion tracker system as it DOES have some practical uses. I certainly understand the "out of sight out of mind" approach to some client bases. This way, if they approve and write it, you could easily make the changes using drop downs and sorting in the Admin section without having to worry about your custom changes being overwritten by an update, or your custom files holding up your ability to properly update aMember to newer versions. An easier way to approach this without having to request custom content would be to not try and show/hide the actual bricks, but rather customize the links on the account central (dashboard) area. That links section is already designed to do exactly what you want, and can display (or not display) any custom pages or files you have created based on your security criteria used when you created the page. Just rename the heading that currently says "Links" to something more creative (maybe "My Personal Files" or "My Personal Content") and there you go. When done properly, the client sees ONLY what their security level has access to, and if they aren't entitled to it, they don't even see the link. With this method, problem is solved, you don't have to wait for support to respond and potentially pay them for customizing, and you've got NO worries about potential upgrade troubles down the road.
I contacted aMember support and this what they said: you need to active subscriptions when you add each tab. Here is a code to get active product ID's Am_Di::getInstance()->auth->getUser()->getActiveProductIds() Here is a code to check if user have for example product #5 and #23 if(array_intersect(array(5,23),Am_Di::getInstance()->auth->getUser()->getActiveProductIds())) { //add the tab if ($items) { //if we have at least one available resource $menu->addPage(array( 'id' => 'site-resources', 'label' => ___('Active Resources'), 'uri' => '#', 'order' => 300, 'pages' => $items )); } } I tried the code that they gave me, but that did not seem to work, even after customizing the stuff such as 'id", "label", "url", and such. I even tried replacing the example product ID's with the ones for my product that I thought would work. I'm assuming the product ID's are the numbers that are displayed on the Products page of the aMember Admin Panel. @everbatim, maybe you could explain where to find that "links" area you were talking about because I do not see any such thing. Thank you.
Ryan, What tabls should work such way? And what code do tyou have in site.php in order to display these tabs currently?