• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
  • This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

Adding own Tabs to the Member Page

R

ragtek

Guest
#1
This Tutorial shows you, how to add own Tabs to your Members Profile Page.
[Works with XenForo 1.0.0 Beta 1]

I'm calling my tab "ragtek" so search the code for ragtek and replace it with your unique name;)

1 Add a Phrase for the tab (i'll call my mytab)
2. Edit your template member_view
2.1
Search for
Code:
<ul class="tabs mainTabs Tabs" data-panes="#ProfilePanes > li" data-history="on">
                <li><a href="{$requestPaths.requestUri}#profilePosts">{xen:phrase profile_posts}</a>
                <xen:if is="{$showRecentActivity}"><li><a href="{$requestPaths.requestUri}#recentActivity">{xen:phrase recent_activity}</a></li></xen:if>
                <li><a href="{$requestPaths.requestUri}#postings">{xen:phrase postings}</a>
                <li><a href="{$requestPaths.requestUri}#info">{xen:phrase information}</a>
Add under this
Code:
 <li><a href="{$requestPaths.requestUri}#ragtek">{xen:phrase mytab}</a></li>
2.2
Code:
                            <xen:if is="{$identities}">
                                <xen:foreach loop="$identities" value="$identity">
                                    <dl><dt>{$identity.title}:</dt> <dd>{xen:string censor, $identity.value}</dd></dl>
                                </xen:foreach>
                            </xen:if>
                        </div>
                    </div>
                </div>
            </li>
add under this
Code:
<li id="ragtek" class="profileContent">
           <div class="section">Your content</div>
</li>
Instead of Your content, you can use phrases, or extend the member Controller
 
R

ragtek

Guest
#2
If you have a "heavy/ slow" tab, you could use ajax, to load the tab only if somebody clicks on it;)

You have to add a data-loadUrl Parameter to the li element
for example
PHP:
<li id="postings" class="profileContent" data-loadUrl="{xen:link members/recent-content, $user}">
 

dmnkhhn

Active member
#3
Do we have to use a special view in the controller when using the data-loadUrl or is XenForo smart enough to delete all the stuff from the template that we don't need when the content should be loaded inside that tab?
 
R

ragtek

Guest
#4
The tutorial is outdated.

You can ignore step 2 and use template hooks member_view_tabs_heading AND member_view_tabs_content to add the additional tabs and content