[RC] Search Custom Profile Field

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment!
Suggested Hosts
manic2
Registered User
Posts: 435
Joined: Thu Jun 12, 2008 9:16 pm

Re: [BETA] Search Custom Profile Field

Post by manic2 »

Stoker 4.0 wrote:Try delete the family name in your profile and do a search using only the wildcard: *
Then your user with the deleted field appears in the search.
Ah :!:

That's not a bug, that's the way wildcards work :!:

If you try a * & nothing else in your username field you will pull up all members. If you try a * in the 'Standard' AIM field you will pull up all users as well, even those with no entry in the AIM field.
manic
User avatar
Stoker 4.0
Registered User
Posts: 1487
Joined: Sun Feb 13, 2011 1:33 pm
Location: Funen, Denmark
Name: Ulrik Christensen
Contact:

Re: [BETA] Search Custom Profile Field

Post by Stoker 4.0 »

Its doesnt pull up all members.
Members who never have filled out this profile field doesnt show up.
manic2
Registered User
Posts: 435
Joined: Thu Jun 12, 2008 9:16 pm

Re: [BETA] Search Custom Profile Field

Post by manic2 »

Stoker 4.0 wrote:Its doesnt pull up all members.
Members who never have filled out this profile field doesnt show up.
Yep, see what you mean.

It pulls up users with fields that are blank, it doesn't however pull up those in the database with the value NULL. Think it's the age old difference between null and blank in databases.
manic
mattconley2011
Registered User
Posts: 114
Joined: Sat Jan 16, 2010 6:49 am

Re: [BETA] Search Custom Profile Field

Post by mattconley2011 »

getting this error when trying to search

Code: Select all

General Error
SQL ERROR [ mysqli ]

Unknown column 'fd.pf_real_name' in 'where clause' [1054]

SQL

SELECT COUNT(u.user_id) AS total_users FROM (phpbb_users u) LEFT JOIN phpbb_profile_fields_data fd ON (u.user_id = fd.user_id) WHERE u.user_type IN (0, 3) AND fd.pf_real_name LIKE 'Matt'

BACKTRACE

FILE: includes/db/mysqli.php
LINE: 163
CALL: dbal->sql_error()

FILE: memberlist.php
LINE: 1265
CALL: dbal_mysqli->sql_query()
manic2
Registered User
Posts: 435
Joined: Thu Jun 12, 2008 9:16 pm

Re: [BETA] Search Custom Profile Field

Post by manic2 »

mattconley2011 wrote:getting this error when trying to search

Code: Select all

General Error
SQL ERROR [ mysqli ]

Unknown column 'fd.pf_real_name' in 'where clause' [1054]

[/quote]
Have you created the custom profile field called real_name ?
manic
mattconley2011
Registered User
Posts: 114
Joined: Sat Jan 16, 2010 6:49 am

Re: [BETA] Search Custom Profile Field

Post by mattconley2011 »

manic2 wrote:
mattconley2011 wrote:getting this error when trying to search

Code: Select all

General Error
SQL ERROR [ mysqli ]

Unknown column 'fd.pf_real_name' in 'where clause' [1054]

[/quote]
Have you created the custom profile field called real_name ?[/quote]

Well yeah, lol
mattconley2011
Registered User
Posts: 114
Joined: Sat Jan 16, 2010 6:49 am

Re: [BETA] Search Custom Profile Field

Post by mattconley2011 »

anyone know how to fix my problem?
manic2
Registered User
Posts: 435
Joined: Thu Jun 12, 2008 9:16 pm

Re: [BETA] Search Custom Profile Field

Post by manic2 »

mattconley2011 wrote:anyone know how to fix my problem?
Hi mattconley2011

You would only get that message if the field pf_real_name doesn't appear in your database. Have a look in there using phpMYAdmin & check that the Custom Profile Field data field is called exactly that, same case, same underscores etc.
manic
manic2
Registered User
Posts: 435
Joined: Thu Jun 12, 2008 9:16 pm

Re: [BETA] Search Custom Profile Field

Post by manic2 »

Danno61 wrote: 1. Can you search multiple (unlimited) CPF's with the mod you are suggesting?
Yes, see the screenshot on the first page, I have given the example of given_name & family_name .
Danno61 wrote: 2. Does this include a drop down CPF that would contain countries for example?
No, not straight out of the box however you could easily build this into the HTML file or, with a bit more experience / effort, auto generate the drop down from the entries in the users Custom Profile Fields.
Alternatively you could set up your CPFs with the various countries as options & generate the HTML from these.
manic
Danno61
Registered User
Posts: 12
Joined: Sat Mar 05, 2011 6:03 am

Re: [BETA] Search Custom Profile Field

Post by Danno61 »

Ok I tried this mod and added 3 CPF's Everything shows up fine... looks good. But, I have 2 problems.

1. Text entered has to be exact ... text is case sensitive.

2. It seems to be very buggy. Searching is not consistent and accurate.

example:

I added a zip code field and when I searched this field using different #'s it always brought up my admin profile. There was no match and it still brought up my profile on the search.

I appreciate your assistance. I am am beginning to think this platform is not for me. Most of my emphasis is going to be based on the end users and information they enter in their UCP/profile.

3. I also realized that I will have to do a mod on what actually shows in the memberlist columns after a search.

This would be my third mod in this section to get close to what I need ( I have already had to do a mod to get rid of existing fields like ICQ)

I have spent hours on this (all mods) and have decided to get back on my horse and ride slowly back out onto the internet horizon.

Thank you sincerely for your assistance ;)

Have a great day!
manic2 wrote:
Danno61 wrote: 1. Can you search multiple (unlimited) CPF's with the mod you are suggesting?
Yes, see the screenshot on the first page, I have given the example of given_name & family_name .
Danno61 wrote: 2. Does this include a drop down CPF that would contain countries for example?
No, not straight out of the box however you could easily build this into the HTML file or, with a bit more experience / effort, auto generate the drop down from the entries in the users Custom Profile Fields.
Alternatively you could set up your CPFs with the various countries as options & generate the HTML from these.
manic2
Registered User
Posts: 435
Joined: Thu Jun 12, 2008 9:16 pm

Re: [BETA] Search Custom Profile Field

Post by manic2 »

Danno61 wrote:1. Text entered has to be exact ... text is case sensitive.
No, it isn't, searching on Smith, smith smITH, SmItH all bring up users with the family_name of Smith. You can also use the * wildcard.
Edit: Apologies, was case insensitive on one of my test boards but sensitive on another :oops: . Mod now updated to be case insensitive.
Danno61 wrote:2. It seems to be very buggy. Searching is not consistent and accurate.
Haven't experienced this at all, if you want to PM me with some more examples then I'll see where the confusion lies.
Danno61 wrote:3. I also realized that I will have to do a mod on what actually shows in the memberlist columns after a search.
Yep, says so in the second post in this thread, there was no point in repeating the long thread referenced & dealing with those issues in this mod thread.
Last edited by manic2 on Fri Mar 11, 2011 6:36 am, edited 2 times in total.
manic
User avatar
Boardtalk.net
Registered User
Posts: 1243
Joined: Fri Jun 05, 2009 8:12 pm
Location: Ireland
Name: Colette
Contact:

Re: [BETA] Search Custom Profile Field

Post by Boardtalk.net »

Hi Manic,
Great to see this mod, I was wondering if its possible to search for date fields? I tried with the Adding custom profile field to memberlist topic before, but it didnt work out as you can read here.

Thanks
;)
User avatar
4_seven
I've Been Banned!
Posts: 5155
Joined: Wed Apr 30, 2008 1:41 am

Re: [BETA] Search Custom Profile Field

Post by 4_seven »

of course it works. see demo link from a cross-version of cpfs and search eg. for *197* in 'Birthday', which is a cpf date-field. important is, that this cpf must setup in the acp, so it is within the database
Current Mods | Mod Base | php(BB) programming | No help via PM
User avatar
Boardtalk.net
Registered User
Posts: 1243
Joined: Fri Jun 05, 2009 8:12 pm
Location: Ireland
Name: Colette
Contact:

Re: [BETA] Search Custom Profile Field

Post by Boardtalk.net »

4_seven wrote:of course it works. see demo link from a cross-version of cpfs and search eg. for *197* in 'Birthday', which is a cpf date-field. important is, that this cpf must setup in the acp, so it is within the database
that’s very a impressive mod 4_seven, I’ll take it on a test run the next chance I get and let you know how I get on. It may be just what I’ve been looking for. Thanks :D
Cubguy501
Registered User
Posts: 141
Joined: Mon Feb 07, 2011 8:39 pm

Re: [BETA] Search Custom Profile Field

Post by Cubguy501 »

Code: Select all

$sql_where .= ($family_name) ? ' AND fd.pf_family_name ' . $db->sql_like_expression(str_replace('*', $db->any_char, $family_name)) . ' ' : '';
the part "AND fd.pf_family_name"

Am i correct is this the only spot that needs changed if my custom field is "name" i just remove the "family_
correct?
EDIT: well thats what i changed and it works! yayyyy... now im having a similair problem as someone else i think i read on this thread, is the search is Case-Sensitive! I also have installed the search location mod and having the same problem with that. im wondering if not everyone is seeing this if its something to do with the SQL server? Which doesnt really make sense cause if u search the email field its not case sensitive. And we are duplicating everything just like the other search parameters! i beleive im on mysql 5.... but i have to double check

If u dont beleive me i got a few test user accounts.
Locked

Return to “[3.0.x] MODs in Development”