• 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.

[pfps.com.br]Profile Tab Manager

Status
Not open for further replies.

Fuhrmann

Well-known member
Profile Tab Manager 1.0.1

This add-on will let you create how much tabs you want and show them in the user's profile page.

Tested:
XenForo 1.0.4
XenForo 1.1 Beta 2
XenForo 1.1

This is the default create/edit form for tabs:

Sem título.webp

To create a new tab:

Go to Applications->Profile Tab Manager->Create New Tab.

When creating a new tab, you dont need to worry about the template. If you dont get anything in mind, just leave blank. The default template is loaded.

Sem título2.webp

So, after created a new tab, go to any profile page (which has the permissions that you've set):

Sem título3.webp

After this, you can customize the template of your tab:

Sem título4.webp

And the result:

Sem título5.webp

Ok, but what if we want to send some custom params to our template?

Ok, this is how i do it:

Create a new file inside the folder library/ProfileTabManager/Callbacks/ called Test.php. We will make a method to use as callback for our custom field.

Put this inside:

PHP:
<?php
class ProfileTabManager_Callbacks_Test extends XenForo_Application
{
    public static function MyCustomField()
    {
        //Lets get some information about the user who is visiting
        $visitor = XenForo_Visitor::getInstance()->toArray();
        //Return the content to our custom field template
        return array('visitor' => $visitor);
    }
}
?>

In the menu Applications->Profile Tab Manager->Display All Tabs, click in our tab "My Custom Tab" to edit.

Fill the information with the class and method callbacks.

Sem título6.webp

Edit the template to and change to this:

PHP:
<li id='__tab__' class='profileContent'>
  Hello {$visitor.username}! You are following {$visitor.following} users!
  <noscript><a href='{xen:link members/__tab__, $user}'>{xen:phrase view}</a></noscript>
</li>

Save it. Go to the profile page and see the result.

Sem título7.webp

For sure, this is just a example. You can make more than this.

This is my fourth add-on, so, give a chance. More uptades coming soon, if this works for all.
 

Attachments

cool stuff !

- is it possible to position the Tab named "My Custom Tab" at the very left of all tabs? (so before the Tab named "Profile Posts")

Many thanks!
 
Nice!
- don't really have any idea on what to use it for one of my forums, but I'm sure others will, :coffee:
 
So saying I create a new Tab.

Is it then possible to put 30 custom Profile-fields into this Tab?
I mean via the custom-profile-fields function which is in XF 1.1 ?
 
So saying I create a new Tab.

Is it then possible to put 30 custom Profile-fields into this Tab?
I mean via the custom-profile-fields function which is in XF 1.1 ?

Yes. Any ammout of userfields or something that you want. If there is a limitation about numbers of custom profile fields, its about XenForo not in this add-on.
 
Fuhrmann I would like all the tabs to move over to the right a bit perhaps 50px

I looked in Style Properties and profile.css but I'm sure you know where I can control it.
 
Fuhrmann I would like all the tabs to move over to the right a bit perhaps 50px

I looked in Style Properties and profile.css but I'm sure you know where I can control it.



You can add into your EXTRA.css this:

Code:
.profilePage .tabs.mainTabs {
padding: 0 93px !important;
}

And see the result. This is what you want? If yes, change the value 93px to match the position that you want.
 
Fuhrmann thank you for the moving tabs help AND the lovely add-on.

I would like to move the Interact stuff under "Information" into my new Profile Tab.

Interact
Content:
Conversation:
Start a Conversation
I looked in the templates under Profile, and also searched on "Information" and "Interact" but didn't find anything.
Where do I find that code to delete it under "Information" and put it in the new tab?
Also in your Profile Tab admin form, in the content box I put "Interact stuff goes here."
The result is that this text now appears whichever Profile Tab I open.
This just might be useful for so0mething specialised of course - it appears UNDER whatever is there already if anyone wanted such a thing.
But what I want is to put some information explaining what the content of this tab is, at the top above the Interact content.
Over to you and your skill.
 
Also in your Profile Tab admin form, in the content box I put "Interact stuff goes here."
The result is that this text now appears whichever Profile Tab I open.

HTML:
<li id='__tab__' class='profileContent'>  </li>
needs to be around it so it just show up in this particular tab and not in all

@erich37: adding custom fields is really easy, just use something like:
HTML:
        <li id='__tab__' class='profileContent'>           
<div class="section">
                        <h3 class="textHeading">Hardware Specs</h3>
                        <div class="primaryContent">
                                   <div class="pairsColumns aboutPairs">
                                            <dl><xen:if is="{$user.customFields.windows_version}"><dt><b>{xen:helper userFieldTitle, windows_version}: </b></dt> <dd>{$user.customFields.windows_version}</dd></xen:if>
                                            <xen:if is="{$user.customFields.1_tv_card}"><dt><b>{xen:helper userFieldTitle, 1_tv_card}: </b></dt> <dd>{$user.customFields.1_tv_card}</dd></xen:if>
                                            <xen:if is="{$user.customFields.1_tv_card_type}"><dt><b>{xen:helper userFieldTitle, 1_tv_card_type}: </b></dt> <dd>{$user.customFields.1_tv_card_type}</dd></xen:if>
                                            <xen:if is="{$user.customFields.1_tv_card_driver}"><dt><b>{xen:helper userFieldTitle, 1_tv_card_driver}: </b></dt> <dd>{$user.customFields.1_tv_card_driver}</dd></xen:if>
                                            <xen:if is="{$user.customFields.memory}"><dt><b>RAM:</b></dt> <dd> {$user.customFields.memory}</dd></xen:if></dl>
                                    </div>
                        </div>
                    </div>
</li>
 
high thank you.


Now I'm trying to put the code for the Interact section in my new Tab.
It's normally under the Information tab.

My selected excerpt from member_view gets a big Internal Server Error!
I counted all the ifs and divs to see they matched in pairs.

Template name: profile_interact

Code:
<li id='__tab__' class='profile_interact'> 
Different ways to connect:<br /><br />
 
<xen:if is="{$user.about}">
<div class="baseHtml ugc">{xen:raw $user.aboutHtml}</div>
</xen:if>
 
<div class="section">
            <h3 class="textHeading">{xen:phrase interact}</h3>
 
<div class="primaryContent">
<div class="pairsColumns contactInfo">
            <dl>
            <dt>{xen:phrase content}:</dt>
            <dd>ul>
<xen:hook name="member_view_search_content_types">
            <li><a href="{xen:link search/member, '', 'user_id={$user.user_id}'}">{xen:phrase find_all_content_by_x, 'name={$user.username}'}</a></li>
            <li><a href="{xen:link search/member, '', 'user_id={$user.user_id}', 'content=thread'}">{xen:phrase find_all_threads_by_x, 'name={$user.username}'}</a></li>
</xen:hook>
            </ul></dd>
            </dl>
<xen:if is="{$canStartConversation}">
            <dl><dt>{xen:phrase conversation}:</dt> <dd><a href="{xen:link 'conversations/add', '', 'to={$user.username}'}">{xen:phrase start_conversation}</a></dd></dl>
</xen:if>
 
<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>
<xen:hook name="member_view_tabs_content" params="{xen:array 'user={$user}'}" />
    </ul>
 
</li>
 
@Fuhrmann: cause i ran into this: "tab_usergroups_id" & "tab_usergroups_exclude_id" may be extended from varchar(50) to something bigger so it even works with several usergroups ;)
 
Status
Not open for further replies.

Similar threads

Back
Top Bottom