[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: [RC] Search Custom Profile Field

Post by manic2 » Wed Jul 20, 2011 8:46 pm

Mod updated to v1.0.0
  • Return searched paramater to template
See first post for download link
manic

manic2
Registered User
Posts: 435
Joined: Thu Jun 12, 2008 9:16 pm

Re: [RC] Search Custom Profile Field

Post by manic2 » Thu Jul 21, 2011 8:34 pm

Mod updated to v1.0.0a
  • Tested on phpBB3.0.9.
  • Correct pagination when initial search results > 50.
  • Used language file for label.
See first post for download link
manic

cutefan
Registered User
Posts: 17
Joined: Fri Jul 08, 2011 9:08 am

Re: [RC] Search Custom Profile Field

Post by cutefan » Thu Sep 15, 2011 4:32 pm

Hi,

I am looking for a way to search in multiple CPF.

For example let's say that I have 2 CPF named "speciality_one" and "speciality_two". Both are drop-list CPF with the same list.

Again for example let's say that my CPF has the following options:
1- Gaming
2- Cooking

When a user search for a member having the speciality "Gaming", I want PHPBB to search in both speciality_one and speciality_two.

If my guess is correct I have to modify my SQL request, so I tried this:

Code: Select all

$sql_where .= ($speciality_one) ? ' AND (fd.pf_speciality_one ) OR (fd.pf_speciality_two )'. $db->sql_like_expression(str_replace('*', $db->any_char, ($speciality_one))) . ' ': '';
Unfortunately this didn't work.

Any ideas?
Thanks

manic2
Registered User
Posts: 435
Joined: Thu Jun 12, 2008 9:16 pm

Re: [RC] Search Custom Profile Field

Post by manic2 » Thu Sep 15, 2011 6:28 pm

Bit of a guess but have you tried extra brackets, say:-

Code: Select all

$sql_where .= ($speciality_one) ? ' AND ((fd.pf_speciality_one ) OR (fd.pf_speciality_two ))'. $db->sql_like_expression(str_replace('*', $db->any_char, ($speciality_one))) . ' ': '';
untested.
manic

cutefan
Registered User
Posts: 17
Joined: Fri Jul 08, 2011 9:08 am

Re: [RC] Search Custom Profile Field

Post by cutefan » Fri Sep 16, 2011 10:35 am

That code didn't work. The search would always give an empty result.

However, I managed to get the request work this way :D :

Code: Select all

$sql_where .= ($speciality_one) ? ' AND ((( fd.pf_speciality_one )'. $db->sql_like_expression(str_replace('*', $db->any_char, ($speciality_one))) . ' '.') OR (( fd.pf_speciality_two )'. $db->sql_like_expression(str_replace('*', $db->any_char, ($speciality_one))) . ')'.'OR (( fd.pf_speciality_three )'. $db->sql_like_expression(str_replace('*', $db->any_char, ($speciality_one))) . ')'.') ': ''; 

User avatar
master412160
Registered User
Posts: 314
Joined: Sat May 22, 2010 5:45 pm
Location: Belgium, Flanders
Name: Max Pen
Contact:

Re: [RC] Search Custom Profile Field

Post by master412160 » Tue Dec 20, 2011 8:43 pm

this mod works with 3.0.9?

manic2
Registered User
Posts: 435
Joined: Thu Jun 12, 2008 9:16 pm

Re: [RC] Search Custom Profile Field

Post by manic2 » Tue Dec 20, 2011 9:35 pm

master412160 wrote:this mod works with 3.0.9?
Yes, works fine with 3.0.9 :D
manic

lintlin
Registered User
Posts: 4
Joined: Mon Jan 16, 2012 9:00 am

Re: [RC] Search Custom Profile Field

Post by lintlin » Mon Jan 16, 2012 9:08 am

Hi and thanks for your mod!

I uploaded the mod with Automod and made sure to fix all fields to relate to my custom field PLZ (postal code in German, numbers only). The search box shows up fine, label is fine, but when I search for a postal code, I get all members shown to me, as if it doesn't do the search. All other search fields are working fine.

I would really appreciate it if you could point me in the right direction, where I should look for any mistakes on my part.

Thanks!

manic2
Registered User
Posts: 435
Joined: Thu Jun 12, 2008 9:16 pm

Re: [RC] Search Custom Profile Field

Post by manic2 » Mon Jan 16, 2012 9:21 am

Obviously first check all your edits, I tried to keep these fairly simple to make installation & adapting as easy as possible.

Make sure you are using the correct Field Identification, i.e it's likely to be something like postal_code rather than Postal Code, or plz (lower case) rather than PLZ (uppercase).
manic

lintlin
Registered User
Posts: 4
Joined: Mon Jan 16, 2012 9:00 am

Re: [RC] Search Custom Profile Field

Post by lintlin » Mon Jan 16, 2012 1:38 pm

Weird double post, please disregard.
Last edited by lintlin on Wed Jan 18, 2012 2:30 pm, edited 1 time in total.

manic2
Registered User
Posts: 435
Joined: Thu Jun 12, 2008 9:16 pm

Re: [RC] Search Custom Profile Field

Post by manic2 » Mon Jan 16, 2012 1:51 pm

:?: :?: You asked the same question above & I answered 4 hours ago :?: :?:
manic

lintlin
Registered User
Posts: 4
Joined: Mon Jan 16, 2012 9:00 am

Re: [RC] Search Custom Profile Field

Post by lintlin » Wed Jan 18, 2012 2:29 pm

Sorry about that, I have no idea what happened there! I didn't post twice (on purpose, anyways). :shock:

OK, I will go through all the edits again, and get back to you either way.

Thanks!

lintlin
Registered User
Posts: 4
Joined: Mon Jan 16, 2012 9:00 am

Re: [RC] Search Custom Profile Field

Post by lintlin » Wed Jan 18, 2012 2:45 pm

You were right, I had a capitalized PLZ where it should have been lower case. Thank you so much for your help!

Tobias Claren
Registered User
Posts: 51
Joined: Tue Jul 29, 2003 7:14 pm
Location: Cologne
Contact:

Re: [RC] Search Custom Profile Field

Post by Tobias Claren » Sat May 12, 2012 5:21 am

Is it possible to search also via "drop boxes"?

Is it possible to get the memberposts (instead of members) as a result?
If not, that would be a very useful feature. All posts from the searched members.
You should be able to find posts on a narrowing of the search profile data of the members.

E.G. only male carpenters from Berlin with a red car ;-) .


thanks...
.

manic2
Registered User
Posts: 435
Joined: Thu Jun 12, 2008 9:16 pm

Re: [RC] Search Custom Profile Field

Post by manic2 » Sat May 12, 2012 5:51 am

Tobias Claren wrote:Is it possible to search also via "drop boxes"?
Yes.
Tobias Claren wrote:Is it possible to get the memberposts (instead of members) as a result?
No.
Tobias Claren wrote:You should be able to find posts on a narrowing of the search profile data of the members.

E.G. only male carpenters from Berlin with a red car ;-) .
You can!
manic

Locked

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

Who is online

Users browsing this forum: No registered users and 36 guests