Want to add USEFUL LINKS to my sidebar out of amember folder

Discussion in 'Templates customization' started by instapro, Apr 25, 2009.

  1. instapro

    instapro New Member

    Joined:
    Apr 24, 2009
    Messages:
    13
    Hi..
    I have a huge site, a part of it is aMember

    I wanted to add the USEFUL links which is in member.html into my PHP based sidebar. So that the links will be available anytime on the sidebar.

    What file I must include and what is the code to get it done?


    Regs
    Jawahar
  2. davidm1

    davidm1 aMember User & Partner

    Joined:
    May 16, 2006
    Messages:
    4,437
  3. instapro

    instapro New Member

    Joined:
    Apr 24, 2009
    Messages:
    13
    Hi David..
    I wanted to add the affiliate page link. The Session variables cannot say if the user is an affiliate right??

    Regs
    Jawahar
  4. davidm1

    davidm1 aMember User & Partner

    Joined:
    May 16, 2006
    Messages:
    4,437
    No, I dont think it is included in session info.

    I think you'll need to access the database then.

    include "/home/yoursite/public_html/amember/config.inc.php";
    global $db;


    table amember_members field is_affiliate 1 is for an affiliate


    David
  5. instapro

    instapro New Member

    Joined:
    Apr 24, 2009
    Messages:
    13
    Hi David
    I have added it to session like this(in login.php page):

    $u = $db->get_user($_SESSION['_amember_user']['member_id']);
    if ($u['is_affiliate'] == '0')
    {
    $_SESSION['_amember_member_is_affiliate']='0';
    }
    else
    {
    $_SESSION['_amember_member_is_affiliate']='1';
    }


    Regs
    Jawahar
  6. davidm1

    davidm1 aMember User & Partner

    Joined:
    May 16, 2006
    Messages:
    4,437
    Cool, thanks for posting.
    Makes it easier.

    Thanks,

    David
  7. instapro

    instapro New Member

    Joined:
    Apr 24, 2009
    Messages:
    13
    We must also replace this function in aff.php .. This will ensure that if the link is clicked to enable Affiliate Program, the session is set..

    function enable_aff($member_id){
    global $db, $config;
    if ($config['aff']['signup_type'] == 2)
    return; // signup disabled in config
    $u = $db->get_user($member_id);
    $u['is_affiliate'] = 1;
    $db->update_user($member_id, $u);
    $_SESSION['_amember_member_is_affiliate']='1';
    $_SESSION['_amember_member_links'] = array();
    $_SESSION['_amember_member_links'][] = plugin_get_member_links($_SESSION['_amember_user']);
    return true;
    }

Share This Page