MyBB Community Forums

Full Version: How to show Custom Profile Fields in areas other than "Additional Information"?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
When editing the profile, how can I make the Custom Profile Fields to appear in other places on the page, other than under "Additional Information"?

Is their code that can grab each FID individually, and show them in other places on the page, while editing the profile?
Yes, the code is {$userfields['fidx']} where x is the field id.

Doh, that is for 1.8


in 1.6 it is {$memprofile['fidx']}
(2014-12-02, 09:10 AM)Leefish Wrote: [ -> ]Yes, the code is {$userfields['fidx']}  where x is the field id.

Doh, that is for 1.8


in 1.6 it is {$memprofile['fidx']}

It doesn't work, nothing shows.

I am trying to do this in the Edit Profile section, where the sex, bio and location are.

I want to show them individually, and not in 1 block under "Additional Information"
Ah that. Yea, there is a plugin for it on mybbhacks. It requires that you have Xthreads installed though. Otherwise, I dont think you can, not really.
(2014-12-02, 09:55 AM)Leefish Wrote: [ -> ]Ah that. Yea, there is a plugin for it on mybbhacks. It requires that you have Xthreads installed though. Otherwise, I dont think you can, not really.

Surely they could be called separately through PHP code or something similar.
He utilised all the XThreads functions. As far as I know,that is all there is to edit the profile fields at that level of granularity. I think brad-t used it in his humanization project.
I'm not sure if it will be worth to install XThreads just for this, on top of my other 3959347383 MyBB Plugins already installed.

What is the actual code that produces the fid input/select fields, for the Custom Profile Fields?
I have no idea - I have offered you the known solution. The plugin exists (yes with a pretty big dependency but it exists) .
It can be done without xThreads, but fair warning, it is a bit of a pain in the butt, especially when you get to dropdown fields. Those will need to be done by editing the php in the core file. For text fields, though, you can do something like this:

I haven't tested this in 1.8, but I imagine it would still work. Instead of using {$customprofilefields} or whatever that variable is in the usercp_profile template, you can include the actual HTML code of the field.

<input type="text" name="profile_fields[fid40]" class="textbox" style="width:90%;" maxlength="200" value="{$user['fid40']}" />

This will generate a text area that stores the information for the custom profile field with an ID of 40. Change the numbers to match what you want.

This will also work with text areas:

<textarea name="profile_fields[fid46]" rows="6" cols="30" style="width: 95%">{$user['fid46']}</textarea>

Edit: There is a risk that proper validation might not work well, so be careful if you decide to go this route.
That solution is very close to what I need. But it only outputs what the user has already chosen for the fid field.

Let's say it is fid3/Sex. It just says "Male" instead of having the 2 select options (Male & Female) to choose the Sex.

____________________________________

What exactly makes $customfields or $requiredfields to output ALL fid's, and not just 1 of them?
Pages: 1 2