Affiliate tab in member.php

Discussion in 'Customization & add-ons' started by footman, Aug 24, 2010.

  1. footman

    footman Member

    Joined:
    Jul 21, 2010
    Messages:
    36
    I disabled the affiliate program for the moment but in the member.php the tab with "affiliate info" still shows. The link is gone under "useful links" but the tab remains.

    Is there a way to have the tab show only...

    1- If the affiliate program is enabled?
    2- If the member is actually an affiliate?

    The affiliate link under "useful links" can show to everyone in case they want to become an affiliate, but the tab that show affiliate stats isn't necessary for non-affiliates.

    thanks for the help
    :)
  2. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    Edit /amember/tabs.inc.php and change affiliate tab class to:
    PHP:
    class AffiliateTab extends TabMenu_Tab {

        function 
    isAvalable($member_id=null)
        {

            
    $member $GLOBALS['db']->get_user($member_id);
            return (boolean)(
    $member['is_affiliate'] && $GLOBALS['config']['use_affiliates']);
        }
    }

    This should help.
  3. footman

    footman Member

    Joined:
    Jul 21, 2010
    Messages:
    36
    Thanks Alex. It does work to a point. When I disable the affiliate program the tab disappears. But when enabled the tab still appears for non-affiliates.

    Is it possible for the tab to 'only' appear for active affiliates and not for regular members (unless they decide to become an affiliate)?
  4. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    Hmm it works without a problem for me.
    When user is not an affiliate, tab is not displayed.
  5. footman

    footman Member

    Joined:
    Jul 21, 2010
    Messages:
    36
    It's working fine today. Must have been a cache issue.

    Thanks for the fix
    :)

Share This Page