MyBB Community Forums

Full Version: Memberlist -> custom fields?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hi,

would it somehow with a plugin be possible to display one of the custom profile fields to display in the memberlist.php!?

Heart
You can do it in the templates

Download this plugin: http://mybbhacks.zingaburga.com/showthread.php?tid=260
It's free and doesn't require you to create a user account.
Install and activate the plugin.

In the 'memberlist', search
<td class="thead" colspan="6">
change to:
<td class="thead" colspan="7">

search:
<td class="tcat" width="10%" align="center"><span class="smalltext"><strong>{$lang->posts}</strong></span></td>
add below:
<td class="tcat" width="10%" align="center"><span class="smalltext"><strong>Location</strong></span></td>

In the 'memberlist_user' template, search:
<td class="{$alt_bg}" align="center">{$user['postnum']}</td>
add below:
<td class="{$alt_bg}" align="center"><func htmlspecialchars_uni>{$user['fid1']}</func></td>

Of course you will need to change the colspan in the first template change if you want to add more fields. I just took the Location as an example but of course you can change that if you wish. Just change the '1' in {$user['fid1']} to any id of a custom profile field.
Thank you, got it working! Didn't think it was that simple.
It's better if you sanitise it.
(2011-05-10, 09:03 PM)RateU Wrote: [ -> ]It's better if you sanitise it.

That's true. This would require a plugin or core modification as it doesn't work in templates. But yeah, it needs to be sanitized indeed.

Edited previous post to include sanitation.
Is it okay if I bring this old topic back up to the top?

I just did this, and it worked exactly how I wanted it to. Thank you!

Is it possible to go one step farther and make the list sortable and/or searchable by the custom field?
I think to do that you would have to edit memberlist.php as the sorting function is part of the php file.
Would you (or someone) be willing and able to tell me how to edit it? Smile
Um. It is a bit complicated - have you ever edited a php file?

This post helped me a LOT:

http://resources.xekko.co.uk/thread-98-p...tml#pid875

If you can read and understand how that all works then you will be able to edit the memberlist without worrying about the file breaking.
I have done very little bits of editing. What you linked to is still above my head, though.
Pages: 1 2