Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[For 1.8] Add a custom profile field to forum showteam page
#1
Hello there,

always wanted to add a custom profile field to the show team page? This is how you do it.
In this example we add the "location" field to the forum team page.


1. A core edit (using filezilla for example)

Open showteam.php and on line 173, find:

$bgcolor = alt_trow();

Below that, add:


		// Fetch custom profile fields
        $query = $db->query("
            SELECT * 
            FROM ".TABLE_PREFIX."userfields 
            WHERE ufid='".$user['uid']."'");
        
        $profilefields = $db->fetch_array($query); 

Save and upload.

2. Figure out the custom profile field ID

Go to AdminCP -> Configuration -> Custom Profile fields -> Click on the Custom Profile Field you want to add ->
At the end of the url, you'll see 'fidx', x is the number u need.

Since we took 'Location' as tutorial example, Location got fid1.

3. Editing showteam templates

Go to AdminCP -> Templates & Style -> Templates -> Your Template -> Show Forum Team Template

Open showteam_usergroup and change colspan="4" to colspan="5"

Then find

<td class="tcat"><span class="smalltext"><strong>{$lang->pm}</strong></span></td>

Add below (Of course you give the name of your custom profile field, if you aren't adding the Location)

<td class="tcat"><span class="smalltext"><strong>Location</strong></span></td>

Save the template.

3.2 Editing showteam templates

Open showteam_usergroup_user

Find

<td width="5%" class="{$bgcolor}"><div class="postbit_buttons">{$pmcode}</div></td>

Add below (Here you use the fid1 we found before, so change it to your fid, if you aren't adding the location)

<td width="15%" class="{$bgcolor}"><div class="postbit_buttons">{$profilefields['fid1']}</div></td>

Save and Done! : )

Since Location names can be long, i'd also recommend to reduce the width of the username. For that just change the 75% to 50%.

Then you could increase the width of Location, so e.g. from 15% to 25%, whatever. Edit it to your needs.

Demo:

[Image: cf624e4e7fce400ba677a720c437a87a.png]


Another useful tutorial
Avatar on ShowTeam page
Reply
#2
Hello, I've done everything you did, but the Location comes out blank. Locations are set for like 10% of the forum team members, could that be a problem? Or is it because MyBB is updated? Please help, thanks
Reply
#3
(03-08-2019, 11:37 PM)Sandro Wrote: Hello, I've done everything you did, but the Location comes out blank. Locations are set for like 10% of the forum team members, could that be a problem? Or is it because MyBB is updated? Please help, thanks

That thread is over 2 years old. Many changes have taken place with MyBB software.
I'm Serpius and You're Not    ¯\_(ツ)_/¯
[Image: 5M7sb0n.png?1]
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)