Login widget customization - show different links depending on membership type?

Discussion in 'Customization & add-ons' started by sharris203, Oct 30, 2009.

  1. sharris203

    sharris203 New Member

    Joined:
    Feb 27, 2009
    Messages:
    45
    wpAmember widget customization - show different links depending on membership type?

    I have 2 memberships, Free and Paid. I want Free members to see a link that says "Upgrade Membership" and Paid members to see a link that says "Account."

    Both links point to the members.php page. How can i do this? I know i need a couple if statements.

    Here's a sample of the code I'm working with:
    Code:
    if ($au=$_SESSION['_amember_user']){// user is logged-in
          print " <b>Welcome, $au[login]</b><br />"; 
          print " <a href='/$amemberdir/member.php'>Upgrade Membership</a><br />";
          print " <a href='/$amemberdir/logout.php'>Logout</a><br />";
    
    
    I'm thinking along the lines of:
    Code:
    
    if($au[product_id]=2    /*The paid membership*/
        print " <a href='/$amemberdir/member.php'>Account</a><br />";
    else
        print " <a href='/$amemberdir/member.php'>Upgrade Membership</a><br />";
    
    Any help is appreciated.
  2. sharris203

    sharris203 New Member

    Joined:
    Feb 27, 2009
    Messages:
    45
    I figured it out using the Wordpress plugin (already had it). I had the free and paid products set to different wordpress user levels.
    Here's some code for anyone who may find it useful. Works anywhere in your Wordpress install if you use Exec-php plugin.
    Code:
    <?php global $current_user; get_currentuserinfo();
    if ( $current_user->user_level < 2 ) {
    
       /*Your 1st code goes here*/
    
    } else {
    
      /*Your 2nd code goes here*/
    
    } ?>
    
  3. jccbroker

    jccbroker New Member

    Joined:
    Mar 16, 2010
    Messages:
    11
    Is the Wordpress plugin needed to accomplish this?

    Here's what I mean - I use WP, but don't have the plugin, because I don't require users to register through WP (only one paid membership).

    I would like to have a limited/basic navigation for visitors who aren't members (not logged in) and an expanded navigation once members log in.

    Thanks.
  4. davidm1

    davidm1 aMember User & Partner

    Joined:
    May 16, 2006
    Messages:
    4,437
  5. jccbroker

    jccbroker New Member

    Joined:
    Mar 16, 2010
    Messages:
    11
    Thank you David - at a minimum you've provided a viable alternative in the sidebar and the more I consider it, given the navigation topics, I think in terms of design, this solution will prove to be better in some way by eliminating too much drop-down from the main horizontal nav (with the page-specific feature). That I gain added functionality beyond adding additional member-only navigation is a huge plus. So again, many thanks!
  6. jccbroker

    jccbroker New Member

    Joined:
    Mar 16, 2010
    Messages:
    11
    I should follow-up regardless...

    A. Is the WP plug-in necessary for that coding option?

    B. Does anyone have experience with something like that (even a login - I'm using the aMember sidebar widget for now) using aMember/WP + Thesis Theme?

Share This Page