New member tags with custom fields and other information

Live Free

Active member
Please correct me if I'm wrong, but I don't believe it's possible to create a new members tab displaying specific custom fields, either with XenForo or any add-ons.

If that is correct I'd like to try my hand st developing it myself.

I have a number of member tab features I'd like to implement, such as calling and filtering custom fields from the research manager or displaying a grid total threads/posts in specific forums.

To start, however, I would be satisfied if I could create a new tab that displays in a members profile that displays specific custom fields in a specific order, and only displays the tab if one of the select custom fields holds a value.

I'm new to Xenforo Development so I'm not sure how to proceed.

Where should I start?
 
You mean like this?

2017-03-10_16-19-33.webp

... that's just a couple of template modifications to insert the tab and trigger the page to be loaded , plus an extension to the XenForo_ControllerPublic_Member class to provide a controller action to generate the content to display.

Start by looking at the member_view template and looking for the hooks: "member_view_tabs_heading" and "member_view_tabs_content" - that's what I used in the template modification (add your replacements below those lines).

Use the examples of the existing profile tabs to work out how they work (hint: the id of the li element is the key and triggers the tab loading).

I would give more concrete examples, but don't have time at the moment, sorry. Hopefully that gives you something to start on though.
 
@Sim Thank you I appreciate you taking the time to respond.

I made it a little harder than it needed to be but I think I have the basic set-up now. I created two new templates, one for the tab name/heading and one for the tab contents, and used template include in member_view in the locations you mentioned.

Here's an except of new_template_member_view_tabs_content

Code:
<li id="writingstuff" class="profileContent">
    <xen:if hascontent="true">
        <div class="section">
            <h3 class="textHeading">What do you write?</h3>
                <div class="primaryContent">
                    <xen:contentcheck>
                    <div class="pairsColumns aboutPairs">                           
                                   
                          <dl><xen:if is="{$user.customFields.writing_genre}"><dt><b>{xen:helper userFieldTitle, writing_genre}: </b></dt> <dd>{xen:helper userFieldValue, $userFieldsInfo.writing_genre, $user, {$user.customFields.writing_genre}}</dd></xen:if>
                          <br></br>
                          <dl><xen:if is="{$user.customFields.writing_type}"><dt><b>{xen:helper userFieldTitle, writing_type}: </b></dt> <dd>{xen:helper userFieldValue, $userFieldsInfo.writing_type, $user, {$user.customFields.writing_type}}</dd></xen:if>
                          <br></br>
                          <dl><xen:if is="{$user.customFields.writing_experience}"><dt><b>{xen:helper userFieldTitle, writing_experience}: </b></dt> <dd>{xen:helper userFieldValue, $userFieldsInfo.writing_experience, $user, {$user.customFields.writing_experience}}</dd></xen:if>
 
                          <br></br>                          
                                          </div>   

                    </xen:contentcheck>
                </div>
        </div>

If I may, I have a few questions:

  1. Does my usage above in the in the <dl><dt> (conditionals helper, custom field references) look correct? I was able to do it by finding a post on Xenforo.com from 2010 or 2011 so I'm concerned it may be outdated.
  2. What is <xen:contentcheck>?
  3. You mentioned I needed to use an extention to XenForo_ControllerPublic_Member class to provide a controller action to generate content to display. I don't believe I've done this, could you explain a little further on how it is and how it works?
I've managed to get the custom fields and custom tabs to display basically how I want them. I'd like to take it a step further, however, and display a tab that lists resource items by the user who's profile we're viewing from a specific resource category.

You ever mess around with code for seven hours when you have no idea what you're doing? That was me last night. I tried everything I could find. I tried copying and manipulating code from various resource list templates. I tried conditional statements. Though I don't understand how they work, I tried foreach looks for resource categories and resource items. I tried using CSS classes to reference a particular resource category. I even tried search strings, which is very hackish. No luck.

I scoured the Xenforo forum but there's only about three references to resource category conditionals/filters on the site, and all were unclear if doing what I wanted was achievable through the routes attempted.

As of now, I have the following included in the template, which has provided me with a duplicate list of resources by the author (the same as the existing resource tab):

Code:
    <li id="resources" class="profileContent" data-loadUrl="{xen:link resources/authors, $user, 'profile=1'}"
 style="display:list-item;"></li>

I'm not sure if this conditional reference is correct, but I think I essentially need to include the following within the data-loadUrl or within a foreach loop:

Code:
<xen:if is="{$category.resource_category_id} == 113"></xen:if>

Based on my examination of the code and other uses, I don't think I can filter the data-loadUrl and I most likely need to create a new foreach loop. To create a foreach loop to display resources from a specific category by the user who's profile you're on, I guessing I will need to create a new php file/Listener file? Am I on the right track?
 
Back
Top Bottom