2014-12-03, 01:47 PM
I did tell you that it doesn't work with dropdown fields. You will need to look at the PHP to figure out which variable you can call to pull out the individual field.
Here's what you can do instead. I tested this in 1.8, but it should also work in 1.6.
Find in Usercp.php around line 717
Right above that, add this:
In your templates, you can now call {$custom_fields[X]} where X is the array number. To find out what that it is (It is different from the FID number), you can add this line below the one I just gave you:
Because of how myBB comments its code, to see the numbers you'll need, you want to view the source of the page. Look for lines that look like this: [0] => <!-- start: usercp_profile_customfield --> The [0] is the number that you want. To call the first field, you'll use:
{$custom_fields[0]}
This will echo out all of the necessary HTML for the field. By default, myBB puts each custom profile field in its own table row. If you want to change that, just edit the usercp_profile_customfield HTML. You can then use the above variable wherever you'd like in the usercp_profile template.
This method will allow you to easily access the dropdowns as well.
Edit: Hmm, using the \n as the delimiter for the explode function causes some issues with textareas that I hadn't noticed before, so the idea itself works, I just need to do some testing to get the right delimiter for you.
Edit: Updated with a better delimiter that should work just fine.
Here's what you can do instead. I tested this in 1.8, but it should also work in 1.6.
Find in Usercp.php around line 717
if($customfields)
{
eval("\$customfields = \"".$templates->get("usercp_profile_profilefields")."\";");
}
Right above that, add this:
$custom_fields = explode("end: usercp_profile_customfield",$customfields);
In your templates, you can now call {$custom_fields[X]} where X is the array number. To find out what that it is (It is different from the FID number), you can add this line below the one I just gave you:
print_r($custom_fields);
Because of how myBB comments its code, to see the numbers you'll need, you want to view the source of the page. Look for lines that look like this: [0] => <!-- start: usercp_profile_customfield --> The [0] is the number that you want. To call the first field, you'll use:
{$custom_fields[0]}
This will echo out all of the necessary HTML for the field. By default, myBB puts each custom profile field in its own table row. If you want to change that, just edit the usercp_profile_customfield HTML. You can then use the above variable wherever you'd like in the usercp_profile template.
This method will allow you to easily access the dropdowns as well.
Edit: Hmm, using the \n as the delimiter for the explode function causes some issues with textareas that I hadn't noticed before, so the idea itself works, I just need to do some testing to get the right delimiter for you.
Edit: Updated with a better delimiter that should work just fine.