Adding custom profile field to memberlist

Discussion forum for MOD Writers regarding MOD Development.
User avatar
gregonweb
Registered User
Posts: 19
Joined: Thu Oct 25, 2007 5:37 pm
Location: Dover Plains, NY

Adding custom profile field to memberlist

Post by gregonweb »

Using the ACP, I've added a custom field on registration that requires the user input their full name. I'd like to be able to have that field displayed on the memberlist page, but am having trouble sorting through code, tables and variables... Here's what I know.

I have the "ADD USER" mod working properly in the ACP. Using it, I've created a Custom Profile Field called "Full Name", which requires the new user, upon registration, to enter their name.

Pulling up a View Source on the ADD USER page (in ACP), I see the following code:

Code: Select all

<input type="text" name="pf_full_name" id="pf_full_name" size="25" maxlength="24" value="" />
So I'm thinking Great! The variable for the users full name is "pf_full_name". And I can verify that, by checking my database under the phpbb_profile_fields_data, there is a table with the pf_full_name field in it, using the user_id as the table's primary key. That I can understand.

Here's where I stray... I know that memberlist.php takes care of displaying the Members page. But how do I insert another column on the memberlist page which would include the pf_full_name data when the page is served up?
User avatar
Brf
Support Team Member
Support Team Member
Posts: 53564
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}

Re: Adding custom profile field to memberlist

Post by Brf »

In memberlist_body.html
After

Code: Select all

<th class="posts"><a href="{U_SORT_POSTS}#memberlist">{L_POSTS}</a></th>
add

Code: Select all

<th>Full Name</th>
After

Code: Select all

		<td class="posts"><!-- IF memberrow.POSTS --><a href="{memberrow.U_SEARCH_USER}" title="{L_SEARCH_USER_POSTS}">{memberrow.POSTS}</a><!-- ELSE -->{memberrow.POSTS}<!-- ENDIF --></td>
add

Code: Select all

		<td><!-- IF memberrow.PROFILE_FULL_NAME_VALUE -->
 		{memberrow.PROFILE_FULL_NAME_VALUE}
 		<!-- ELSE -->&nbsp;<!-- ENDIF --></td>
 
User avatar
gregonweb
Registered User
Posts: 19
Joined: Thu Oct 25, 2007 5:37 pm
Location: Dover Plains, NY

Re: Adding custom profile field to memberlist

Post by gregonweb »

Ah-HA! It is the template, not the php that needed to be modified. Ok. I understand. Little by little I learn. It worked perfectly - but of course you knew it would!

Thank you. I appreciate you taking the time to respond.
User avatar
LiquidSpark
Registered User
Posts: 146
Joined: Thu Mar 29, 2007 6:54 pm

Re: Adding custom profile field to memberlist

Post by LiquidSpark »

Do comments like this do anything, or are they just for people?

Code: Select all

<!-- IF memberrow.PROFILE_FULL_NAME_VALUE -->
Also, why don't we just say "common.php" instead of this?

Code: Select all

$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
User avatar
Brf
Support Team Member
Support Team Member
Posts: 53564
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}

Re: Adding custom profile field to memberlist

Post by Brf »

For question #1, that is template code. It is used by the template object.

For question #2, some servers do not use .php as the extension of php files. Some use php3, php4, or php5.
User avatar
LiquidSpark
Registered User
Posts: 146
Joined: Thu Mar 29, 2007 6:54 pm

Re: Adding custom profile field to memberlist

Post by LiquidSpark »

Brf wrote:For question #1, that is template code. It is used by the template object.
Ah, so then that might help answer this question about sessions.
User avatar
kincoyotes
Registered User
Posts: 1
Joined: Tue Jan 01, 2008 3:30 pm
Location: Belgium
Name: Cedric Baudoin

Re: Adding custom profile field to memberlist

Post by kincoyotes »

Hello,

Ok i did add the custom profile fields in the member list, but how can i "sort" them ?
User avatar
gregonweb
Registered User
Posts: 19
Joined: Thu Oct 25, 2007 5:37 pm
Location: Dover Plains, NY

Re: Adding custom profile field to memberlist

Post by gregonweb »

If someone has info on that, I'd also love to

A: know, so I can use it.
B: learn, so I can do it again with other things.
User avatar
A_Jelly_Doughnut
Former Team Member
Posts: 34459
Joined: Sat Jan 18, 2003 1:26 am
Location: Where the Rivers Run

Re: Adding custom profile field to memberlist

Post by A_Jelly_Doughnut »

I don't believe changing the sort direction is possible without making modifications to the includes/functions_profile_fields.php, but I am not certain of that.
A Donut's Blog
"Bach's Prelude (Cello Suite No. 1) is driving Indiana country roads in Autumn" - Ann Kish
deepack
Registered User
Posts: 32
Joined: Mon Jan 21, 2008 10:08 am
Location: France

Re: Adding custom profile field to memberlist

Post by deepack »

Hi,
is anybody know how to sort the personal profil fields in the memberlist?
ZORGLUB
Registered User
Posts: 17
Joined: Wed Jun 15, 2005 4:43 pm

Re: Adding custom profile field to memberlist

Post by ZORGLUB »

thanks a lot for this stuff.

did anybody found a way to sort and to search this custom field area?

thanks again.
guru9898
Registered User
Posts: 63
Joined: Thu May 13, 2004 1:32 am

Re: Adding custom profile field to memberlist

Post by guru9898 »

I also need a way to do this, sorting memberlist by profile fields, also allow searching for members by them.

I added a wii system code field, and I want people to be able to find their friends by code.
florenceacademyforum
Registered User
Posts: 6
Joined: Tue Jan 29, 2008 3:21 pm

Re: Adding custom profile field to memberlist

Post by florenceacademyforum »

For sorting columns in the memberlist I am trying this javascript hack but with no luck. The instructions are simple enough though..

http://www.kryogenix.org/code/browser/sorttable/

All you geniuses out there. A lillte help? by popular demand...
www.florenceacademyforum.com Running phpBB 2.0 bridged w/ Coppermine 1.4.1. MODS : Calendar Pro, eventlists, last_visited_1.1.1, Admin Userlist, Extended Private Message Notification, redesigned_jumpbox_100, Phoogle Maps, Skype, facebook, myspace
User avatar
A_Jelly_Doughnut
Former Team Member
Posts: 34459
Joined: Sat Jan 18, 2003 1:26 am
Location: Where the Rivers Run

Re: Adding custom profile field to memberlist

Post by A_Jelly_Doughnut »

florenceacademyforum wrote:For sorting columns in the memberlist I am trying this javascript hack but with no luck. The instructions are simple enough though..

http://www.kryogenix.org/code/browser/sorttable/

All you geniuses out there. A lillte help? by popular demand...
Your post is off-topic. My guess is you didn't change the class name of the correct table.
A Donut's Blog
"Bach's Prelude (Cello Suite No. 1) is driving Indiana country roads in Autumn" - Ann Kish
HondaCop
Registered User
Posts: 20
Joined: Sat Apr 05, 2008 4:12 am

Re: Adding custom profile field to memberlist

Post by HondaCop »

Brf wrote:In memberlist_body.html
After

Code: Select all

<th class="posts"><a href="{U_SORT_POSTS}#memberlist">{L_POSTS}</a></th>
add

Code: Select all

<th>Full Name</th>
After

Code: Select all

		<td class="posts"><!-- IF memberrow.POSTS --><a href="{memberrow.U_SEARCH_USER}" title="{L_SEARCH_USER_POSTS}">{memberrow.POSTS}</a><!-- ELSE -->{memberrow.POSTS}<!-- ENDIF --></td>
add

Code: Select all

		<td><!-- IF memberrow.PROFILE_FULL_NAME_VALUE -->
 		{memberrow.PROFILE_FULL_NAME_VALUE}
 		<!-- ELSE -->&nbsp;<!-- ENDIF --></td>
 

This has got to be the BEST post I have seen so far!!! It was a LIFE-SAVER for me! THANKS A MILLION! :D

Return to “[3.0.x] MOD Writers Discussion”