MyBB Community Forums

Full Version: Custom profile fields and templates
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hiya folks, I'm trying to get a custom profile field to show up in the postbit_author_user template, but it's not working.

My custom profile field is named Faction, I starting a forum-based roleplaying game, and is a simple select box with a few choices to it. The template variables to get the value of this field haven't been working.

<strong><span class="largetext">{$post['profilelink']}</span></strong><br />
<span class="smalltext">
	{$post['usertitle']}<br />
	{$post['userstars']}
	{$post['groupimage']}<br />
	{$post['useravatar']}<br />
	{$lang->postbit_posts} {$post['postnum']}<br />
	{$lang->postbit_group} {$usergroup['title']}<br />
	{$lang->postbit_joined} {$post['userregdate']}<br />
	{$lang->postbit_status} {$post['onlinestatus']}{$post['replink']}<br />
	{$post['fidfaction']}<br />
</span>

I have tried all these:
	{$post['fidfaction']}<br />
	{$post['fidFaction']}<br />
	{$post['Faction']}<br />
	{$post['faction']}<br />
But none return the value of the custom faction field.

What am I doing wrong?

Also, if I have a field for a link to the person's profile topic, how would I show that as an icon beside a post using the template system?

Overall I would like more documentation of the templates system, since searching and reading numerous topics hasn't helped me all that much.
you should use the ID of the custom profile field. Example

{$post['fid4']}

You can find the code in the index of the Custom Profile Fields manager in ACP.
So, how can I make a template that if the profile url is mentioned an image is displayed, otherwise the image isn't. Similar to the online/offline template, only the not present part would be nonexistant in code.

Thanks for the response though, it got my faction listing working now. Smile
what do you mean by "the profile url is mentioned" ? where should it be mentioned?
There is a custom edit (another custom field) where a user can enter the link to their character's biography thread, and it may or may not exist. (IE, new users may not have a thread yet.) How would I make an image appear for the link if there is a url entered into the edit?
oh sure for example use

open ./inc/functions_post.php

find
eval("\$post['user_details'] = \"".$templates->get("postbit_author_user")."\";");
Above it add

	if($post['fidX'] !== '')
	{
		if(!preg_match("#^[a-z0-9]+://#i", $post['fidX']))
		{
			$bio_link = "http://".$post['fidX'];
		}
		else
		{
			$bio_link = $post['fidX'];
		}
	}

X is the fid.
{$bio_link} to be used in the templates.

A use must enter the full link, however the code will fix it in case http:// was not included.
Thanks, that worked. Smile I opted for a text link at the moment though, I still have to come up with a site skin.