Hello, I use this simple code to display a message depending on isLoggedIn - <?php if(Am_Lite::getInstance()->isLoggedIn()) : ?> Free Sewing Pattern Downloads <?php else : ?> Join for All Sewing Pattern Downloads <?php endif;?> I would now like to take advantage of haveSubscription. <?php if(Am_Lite::getInstance()->haveSubscriptions(array(3,25,89,105))) : ?> FULL SUB or ONE YEAR SUB or NEW DEAL or NEW DEAL ONE YEAR <?php endif; ?> But I want it to mean product 3 or 25 or 89 or 105. It seems to mean 3 and 25 etc. I tried using a category number which groups all these products but that is not working either. Help would be much appreciated as always.
I think I have the answer now: <?php if(Am_Lite::getInstance()->haveSubscriptions(array(3) or (89) or (25) or (105)) ) : ?> FULL SUB, ONE YEAR SUB, NEW DEAL, NEW DEAL ONE YEAR <?php endif; ?> It seems to work. Is this the way?
Please try this one: PHP: <?php if (Am_Lite::getInstance()->haveSubscriptions(array(3, 89, 25, 105))): ?>FULL SUB, ONE YEAR SUB, NEW DEAL, NEW DEAL ONE YEAR<?php endif; ?>
No, spacing does not matter. Method haveSubscriptions accept array of product ids. Here is difference between your code and mine: Code: array(3) or (89) or (25) or (105) and Code: array(3, 89, 25, 105)
Thanks so much. I may have wasted your time as that is what I tried first but without spacing. See my first post. I must have done something that made it fail first time. But it's working as it should now. A great little bit of code and I should make much more use of these features. Thanks again. Angela
While I am about it, how do I show a User name. I gather I use the following but how do I code it to appear. <?php Am_Lite::getInstance()->getUsername() ?> I know I have bored this Forum before! I'm a coder (programmer) active late 60's through 1980. Assembler, Cobal etc. Our tools - coding pad, pencil, rubber and a good memory. It's a different world when there is access to so much information. PHP syntax is a complete mystery to me! But thankfully we have this splendid team at aMember who always responds so quickly and efficiently. I still like control and template websites have no appeal. Although I use a tiny fraction of aMember's features, it's a joy to use. I can do what ever I want. It is an amazing tool backed up by great support. So to save me learning PHP code and syntax, it's great to have the aMember team on hand, filling in the knowledge for me.
Please try this code: PHP: <?= htmlspecialchars(Am_Lite::getInstance()->getUsername()); ?> It should do the job. Best Regards.