PDA

View Full Version : Memberlist: Only show members who have an entry in a certain profilefield.


mini2
02-10-2003, 06:09 PM
Hello,

The story (you can skip this if you like)....

I've been hacking away at my forums, and trying to make what is basically a 'second' profile for each user.

My site is car enthusiasts site, and I have completed most of the work to make this happen.

The registration works, and I have integrated another hack on here (search custom fields) to enable searching of these 'car profiles'.

I now have two member.php and memberlist.php files. I want to keep it that way, I have member_mini.php and memberlist_mini.php (and they have some unique templates).

EVERYTHING works, apart from one snag.

The plea for help!

For the memberlist_mini.php to work (i.e. list ONLY members who have completed their car profiles) I need to add to the condition on "getall" (it think) so that it only ever lists users who have completed at least one of the customfields, field22.

I can get this to work using this code:


if ($usememberlistadvsearch) {
if (!strstr($condition,"field22 LIKE")) {
$condition.=" AND userfield.field22 LIKE '%e%'";
}


or something like this:


if ($usememberlistadvsearch) {
if (!strstr($condition,"field22 LIKE")) {
$condition.=" AND userfield.field22 LIKE '%e%'";
}


However the mysql take AGES to make this query.

There MUST be a way to do this (I need to check they are not searching for this particular field, hence the first 'if' statement).

I used the hack to show process times at the bottom of the page, and it takes about 33 seconds with the above solutions, and 90ish% is MySQL.

Anyone help at all?

Steve Machol
02-10-2003, 06:11 PM
This problem is probably due to the user and userfield tables no longer matching. There should be one entry for each user in both tables. You can verify this by using phpMyAdmin to access and view your database. If they don't match then you can use the script posted here to fix the problem:

http://www.vbulletin.com/forum/showthread.php?s=&postid=248984#post248984

mini2
02-10-2003, 06:16 PM
I'll check that out, but it proceses nice and fast if I remove that required userfield. ie If it's just a pure list of all users.

I'll let you know...

:)

mini2
02-10-2003, 06:51 PM
That's not the problem.

How would others here code the memberlist so it ONLY shows people who have a certain usefield filled in, ie !="" or contains something!

It just seems to take forever.

www.mini2.com/forum/memberlist.php works www.mini2.com/forum/memberlist_mini.php takes an age. (Don't too many look at once, or you'll kill my site?!).

Paul