Hi, I'd like to show links to users depending on the group they're in. I've tried using this code but was not successful: PHP: <ul> {if $smarty.session._amember_user} {if $smarty.request.price_group eq "1"} <li><a href="/games/">Games</a></li> {/if} {if $smarty.request.price_group eq "2"} <li><a href="/music/">Music</a></li> {/if} {if $smarty.request.price_group eq "3"} <li><a href="/videos/">Videos</a></li> <li><a href="/favs/">Fav videos</a></li> {/if} <li><a href="/amember/member.php">My Account</a></li> <li><a href="/amember/logout.php">Logout</a></li> {else} <li><a href="/login/">Login</a></li> <li><a href="/amember/signup.php">Signup</a></li> {/if} </ul> A user can be a member of 1 OR MORE groups. Anyone have an idea?
I was trying something similar here: https://www.amember.com/forum/showthread.php?t=11103 I was using the Wordpress plugin, so your solution will be different, but this info may put you in the right direction. In my case I only have 2 products, which i assigned two wordpress user levels. For example: Code: <?php global $current_user; get_currentuserinfo(); if ( $current_user->user_level < 2 ) { print "<a href='/$amemberdir/member.php'>UPGRADE MEMBERSHIP HERE</a><br />"; } else { print "<a href='/$amemberdir/member.php'>ACCOUNT</a><br />"; } ?>
This code: Code: {if $smarty.request.price_group eq "1"} <li><a href="/games/">Games</a></li> {/if} {if $smarty.request.price_group eq "2"} <li><a href="/music/">Music</a></li> {/if} {if $smarty.request.price_group eq "3"} <li><a href="/videos/">Videos</a></li> <li><a href="/favs/">Fav videos</a></li> {/if} Will be executed only when you open member.php with price_group parameter. If you want to display something depends on user's products use this instead: Code: {if $smarty.session._amember_user.data.1} <li><a href="/games/">Games</a></li> {/if} {if $smarty.session._amember_user.data.2} <li><a href="/music/">Music</a></li> {/if} {if $smarty.session._amember_user.data.3} <li><a href="/videos/">Videos</a></li> <li><a href="/favs/">Fav videos</a></li> {/if} 1,2,3 - are product ids.
Thanks alexander, that helped me too. Now how do I use this code? Within what code tags? Php, Smarty tags?
This looks very interesting. Sharris, because the code is within curly brackets, it goes into Smarty templates. Also, the fact that Smarty variables are used are another indication that this is code to be used in a template file. If you need to use the code outside of aMember, then I'm not sure how it would be translated, although I seem to recall there may have been info about this in the online Users Manual. On my site, what gets protected are the downloads, so I've set the pages up so all members get to see them. I find that this encourages more sales as members of one package get to see what's in the other packages, and the psychological impact of being able to "see but not touch" the other material is very strong.