add tabs in member's area

Discussion in 'Templates customization' started by CrackBaby, Oct 27, 2010.

  1. CrackBaby

    CrackBaby Member

    Joined:
    Aug 22, 2006
    Messages:
    154
    Ability to add tabs in member's area from plugins or site.inc.php


    How is this done? I just want to add a single tab for now

    I am running 3.2.3 now as a beta

    Thank you
  2. skippybosco

    skippybosco CGI-Central Partner Staff Member

    Joined:
    Aug 22, 2006
    Messages:
    2,526
    Code:
    TabMenu::getInstance()->add(new TabMenu_Tab($title, $relative_url,null));
    This will add new tab with table title set to $title and redirection url to $relative_url;

    Path is relative to aMember installation (ie \amember)
  3. CrackBaby

    CrackBaby Member

    Joined:
    Aug 22, 2006
    Messages:
    154
    ok got that figured out, how do I get the tabs on my new page OR how do I get my new page to show inside member.php page


    (member.php?tab=newpage
  4. endortrails

    endortrails Guest

    Joined:
    Feb 2, 2009
    Messages:
    14
    Open member.html and change this:

    {if $smarty.get.tab eq "add_renew"}
    {include file="member_add_renew.html"}
    {elseif $smarty.get.tab eq "payment_history"}
    {include file="member_payment_history.html"}
    {elseif $smarty.get.tab eq "newslatter_archive"}
    {include file="member_newslatter_archive.html"}
    {else}
    {include file="member_main.html"}
    {/if}

    to this:

    {if $smarty.get.tab eq "add_renew"}
    {include file="member_add_renew.html"}
    {elseif $smarty.get.tab eq "payment_history"}
    {include file="member_payment_history.html"}
    {elseif $smarty.get.tab eq "newpage"}
    {include file="member_newpage.html"}
    {elseif $smarty.get.tab eq "newslatter_archive"}
    {include file="member_newslatter_archive.html"}
    {else}
    {include file="member_main.html"}
    {/if}

    Then, duplicate one of the member_filename.html files and name it member_newpage.html

    Suggestion for Alex/Amember:

    1. member_newslatter_archive.html is misspelled. Should be member_newsletter_archive.html
    2. Make it easier to make new tab additions have .active classes.
  5. CrackBaby

    CrackBaby Member

    Joined:
    Aug 22, 2006
    Messages:
    154
    Sweet, worked like a charm

    Thanks
  6. sunseapromos

    sunseapromos Member

    Joined:
    Apr 26, 2010
    Messages:
    72
    So, specifically, do we just put this code in at the very top of one of these two pages?

    Where is the site.inc.php file? Could not find that one, only the plugins.inc.php (which I assume is the other one you are referring too???).

    Thanx. :)
    Claudia Beck
  7. skippybosco

    skippybosco CGI-Central Partner Staff Member

    Joined:
    Aug 22, 2006
    Messages:
    2,526
  8. sunseapromos

    sunseapromos Member

    Joined:
    Apr 26, 2010
    Messages:
    72
    Oh. Well, I am not a programmer. So this method won't work for me. :( I can access the page code though, so if it is a copy & paste deal with the site.inc.php I could do that, but pretty much only that.)

    This is what I am wanting to do:

    I had another post here on the forum where I was wishing to create a safelist referral text ad for my members, and wondering how they were to access it.

    davidm1 (CGI central partner) mentioned that I create a page/subpage for members to access. (http://www.amember.com/forum/showthread.php?t=13145)

    I assumed they would "access" it by me creating an additional tab in their admin area. If that is not easily possible, then how would I create a way for the members to access it. I have a referral splash page or two I would like them to get to also.

    Looking at the member's admin page, even if I could add to the "Useful Links" list would be fine. I can edit the html, so maybe I should edit that page template????

    Thank you for some direction with this. This is my first time managing an AMember script so I don't know how any of the extra stuff is done yet.

    Claudia
  9. skippybosco

    skippybosco CGI-Central Partner Staff Member

    Joined:
    Aug 22, 2006
    Messages:
    2,526
    That is exactly what it can be. For example, to create a tab called "My Tab" that displays the signup page:

    Code:
    TabMenu::getInstance()->add(new TabMenu_Tab('My Tab', 'signup.php',null));
  10. sunseapromos

    sunseapromos Member

    Joined:
    Apr 26, 2010
    Messages:
    72
    Thank you, this has worked perfectly.

    Is there an easy way to add multiple links to the new tabs like our Affiliate info tab? :)

    Also, was wondering if I could change the title on the Affiliate info tab somewhere? Or will that mess up any links to it?

    Thank you!
    Claudia
  11. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,274
    You can get example from tabs.inc.php:
    PHP:
            $affiliateTab = new AffiliateTab(_TPL_AFFILIATE_TITLE'aff_member.php'null);
            
    $affiliateTab->addItem(new TabMenu_Tab_Item(_AFF_GET_BANS_LINKS'aff.php?action=links'));
            
    $affiliateTab->addItem(new TabMenu_Tab_Item(_AFF_REVIEW_STAT'aff.php?action=stats'));
            
    $affiliateTab->addItem(new TabMenu_Tab_Item(_AFF_UPDATE_PAYOUT'aff.php?action=payout_info'));

    Also you can change tab title without a problem in language file. need to change this var: _TPL_AFFILIATE_TITLE
  12. sunseapromos

    sunseapromos Member

    Joined:
    Apr 26, 2010
    Messages:
    72
    I can't seem to get these extra links to work. Do I copy that whole block of code and put it in my site.inc file? Under the:

    TabMenu::getInstance()->add(new TabMenu_Tab('My Tab', 'signup.php',null));

    line?

    Thanks.
  13. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,274
    That block is just an example of hos tab with items can be created.
    Of course you need to modify it depends on exact requirements and place it to site.inc.php
  14. sunseapromos

    sunseapromos Member

    Joined:
    Apr 26, 2010
    Messages:
    72
    Okay, that's what I thought and tried to do :) I'll make another go of it.

    Thanx!
  15. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,274
    Provide exact example of what you need in that tab. I will provide exact code.

Share This Page