Google Answers Logo
View Question
 
Q: phpBB change: Add 'Occupation' field to memberlist ( Answered 5 out of 5 stars,   0 Comments )
Question  
Subject: phpBB change: Add 'Occupation' field to memberlist
Category: Computers > Programming
Asked by: jhabley-ga
List Price: $25.00
Posted: 23 Jun 2003 08:20 PDT
Expires: 23 Jul 2003 08:20 PDT
Question ID: 220715
I am running phpBB 2.04 (PHP/MySQL-based) and would like to customize
the memberlist page (memberlist.php, which calls a number of
include/template files). A sample memberlist page -- not mine -- is at
http://www.phpbb.com/phpBB/memberlist.php

I've successfully edited memberlist_body.tpl to remove a couple of
columns (member number and PM, notably) but now I'm trying to have the
memberlist show the user's occupation field.

I've added {L_OCCUPATION} in the cell header and
{memberrow.OCCUPATION} in a cell in the same row as {memberrow.FROM}
and {memberrow.USERNAME} -- but nothing comes out.

No error, just blank in both cases. 

Help!

Request for Question Clarification by arimathea-ga on 23 Jun 2003 08:41 PDT
jhabley-ga,

Would http://www.phpbb.com/phpBB/viewtopic.php?t=99605 - PCP - be
suitable?  It offers a customizable memberlist for phpBB.  If this
doesn't answer your question, let me know and i'll dig a little
further...

arimathea-ga
Researcher

Clarification of Question by jhabley-ga on 23 Jun 2003 08:47 PDT
Hi arimathea,

I saw that one and even downloaded and looked at it, but it's not
quite the same thing. It's a control panel for users to be able to
control which fields appear on their profile.

I'm just trying to add that one Occupation field to the memberlist.php
output so that when people look at the memberlist, they can see
people's occupations as well.

Request for Question Clarification by rmn-ga on 23 Jun 2003 12:42 PDT
Would this be of any help?

http://www.phpbb.com/phpBB/viewtopic.php?t=12426

If you scrool about half of the way down the user "Rod" has a post
timestamped as: Sat Apr 13, 2002 4:25 am.  If you use your browser to
find the words memberlist.php on the page, it should be the correct
post.  Otherwise just go about half of the way down and you should see
it.  It describes how to add an extra field to the memberlist.  Let me
know if this solutions works and I will post it as an answer.

Thanks!

Request for Question Clarification by rmn-ga on 23 Jun 2003 12:42 PDT
I applogize for the spelling error, it should be "scroll" in the first line.

Clarification of Question by jhabley-ga on 23 Jun 2003 12:45 PDT
Hmmm... nice find. Let me try it and if it works, I will let you know
so you can answer it formally. Thanks for your trust here -- another
reason why I love using you folks.

One sec while I check...

Clarification of Question by jhabley-ga on 23 Jun 2003 12:58 PDT
Dang, nope. I did everything there, changed from member_no to user_occ
(the actual field name in the database), but again nothing. :(

Request for Question Clarification by sgtcory-ga on 23 Jun 2003 13:56 PDT
Hello jhabley,

I think you still need to add this row to the sql select statement in
the 'memberlist.php':

Example - where it says this :

$sql = "SELECT username, user_id .... user_avatar_type,
user_allowavatar

You would add the select for the user_occ like this :

$sql = "SELECT username, user_id .... user_avatar_type,
user_allowavatar, user_occ


Then you will have to make the changes you made before, and assign a
language variable for this in 'memberlist.php' as well :

'L_OCCUPATION' => $lang['Members Occupation']


Now once you print it out, it should be selected and shown. Let me
know if this helps ;-)


SgtCory

Clarification of Question by jhabley-ga on 23 Jun 2003 14:01 PDT
I had the SQL field reference in there. And adding...

     'L_OCCUPATION' => $lang['Members Occupation'] 

...to memberlist.php only affects the table header -- the actual
columns still come out blank. (And yes, there's data in that field...
<grin> )

Clarification of Question by jhabley-ga on 23 Jun 2003 14:03 PDT
Just to clarify, I've added {L_OCCUPATION} in the template -- this is
what...

     'L_OCCUPATION' => $lang['Members Occupation']  

...seems to be controlled by. And I've added {memberrow.OCCUPATION} in
the row of other fields, and it spits out blank in that case -- all
the other fields come out fine.

Request for Question Clarification by arimathea-ga on 23 Jun 2003 14:30 PDT
Can you provide the exact SQL statement?

Clarification of Question by jhabley-ga on 23 Jun 2003 15:14 PDT
Yup...

$sql = "SELECT username, user_id, user_viewemail, user_posts,
user_regdate, user_from, user_website, user_email, user_icq, user_aim,
user_yim, user_msnm, user_avatar, user_avatar_type, user_allowavatar,
user_occ
	FROM " . USERS_TABLE . "
	WHERE user_id <> " . ANONYMOUS . "
	ORDER BY $order_by";

Request for Question Clarification by arimathea-ga on 23 Jun 2003 18:51 PDT
jhabley-ga,

Thanks for being patient with us through this process.

I'm looking at memberlist.php right now.  I notice that there are the
following places in the file where the L_OCCUPATION probably needs to
be:

around line 109
around line 241

Also check your SQL on line 145.

One last thing:  $occupation = $row['user_occ']; probably needs to be
somewhere around 231.

I'm giving relative line numbers because i'm using 2.0.5.

Let's see how this works for you; let me know.

Best,
arimathea-ga
Researcher

Request for Question Clarification by sycophant-ga on 24 Jun 2003 23:01 PDT
Hey jhabley, 

If you are still get nowhere with the suggestions above, I would be
happy to make the changes required and provide you with new php files
and any SQL statements that are required.

The only problem will be if you need to upgrade phpBB later.

Let me know how you get on.

Regards,
sycophant-ga

Clarification of Question by jhabley-ga on 29 Jun 2003 08:42 PDT
Hi sycophant, sorry about taking so long to get back to you. That
would be great. How do I get the PHP scripts to you?

Request for Question Clarification by sycophant-ga on 29 Jun 2003 16:34 PDT
Um, can you tar up the scripts as you have them at the moment perhaps,
and post a URL when I can download the archive? Remove passwords or
anything sensitive.

I will obtain the original version and compare it to your version,
figure out what needs to change and send you a full tar with the
changes.

As I understand it (I haven't used phpBB for a while), occupation is
not a field offered in the regular version, so you are trying to add
it, and also remove other fields you are not interested in?

When I have it installed and working, I will post a URL for you to
check my work at before I send everything back.

Regards,
Sycophant-ga

Clarification of Question by jhabley-ga on 30 Jun 2003 08:53 PDT
k thanks. They're at http://futurefile.com/transfer2984/

I think I got the main ones. Let me know when you get these and I'll
delete the directory, and if you need me to add any other files
(includes I may have missed, etc.)

Clarification of Question by jhabley-ga on 30 Jun 2003 08:54 PDT
P.S. If you can figure out why the pulldown menus for sorting don't do
anything, I'd love to know.

Request for Question Clarification by sycophant-ga on 01 Jul 2003 04:40 PDT
Hi jhabley, 

I have made the modifications I think you wanted. I had problems
downloading the php files you posted, so I just made the changes from
scratch.

You can view my memberlist at:
http://dylan.wibble.net/programming/ga-test/220715/phpBB2/memberlist.php

The changes I have made are:
- Removed Member Number column.
- Removed IM column.
- Added Occupation column.
- Added $lang["Sort_Occupation"] to lang_main.php (English only).
- Modified sort dropdown to allow sorting by Occupation.
- Altered SQL in memberlist.php to provide required information.

I think that's it.

Have a look at the link, and let me know if I have missed anything.

The altered files are:
templates/subSilver/memberlist_body.tpl
languages/lang_english/lang_main.php
memberlist.php

If these changes do everything you want, let me know and I will zip
them up and post the files for you to download.

Otherwise, let me know what I have missed, and I will post again when
I have that done.

Regards,
Sycophant-ga

Clarification of Question by jhabley-ga on 01 Jul 2003 15:24 PDT
Looks like it would work, but I wouldn't be able to just overwrite my
existing files with your versions, as my files have had mods applied
to them. I'm looking for someone who can code it into the existing
files which you now have.

Request for Question Clarification by sycophant-ga on 01 Jul 2003 22:53 PDT
Hi jhabley,

No problem, at least I am clear on what you need.

However, I was unable to get the files from that download, can you put
them back, as .txt files?

Regards,
Sycophant-ga

Request for Question Clarification by sycophant-ga on 01 Jul 2003 22:54 PDT
Disregard that, I do in fact have the files I need from you. I am
clearly having one of those days.

I will get to work on them ASAP.

Regards,
Sycophant-ga
Answer  
Subject: Re: phpBB change: Add 'Occupation' field to memberlist
Answered By: sycophant-ga on 01 Jul 2003 23:42 PDT
Rated:5 out of 5 stars
 
Done!

I have made a few modifications to the files you supplied me. They
were very close, but a few small errors meant that it just wasn't
quite going to work.

The files are available here:
http://dylan.wibble.net/programming/ga-test/220715/220715.zip

I have included an explaination of what was changed and why. 

Let me know if you have any problems with the files, or anything
remains unresolved.

Regards, 
Sycophant-ga
jhabley-ga rated this answer:5 out of 5 stars
It works! :) Thanks for your help and excellent README file.

Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy