BP Profile Search › Member type directories
-
AuthorPost
-
Henry Wright
GuestHi Andrea,
I’ve created 2 member types using the BuddyPress Member Type API. Each member type has a directory. For example:
- example.com/members/type/students
- example.com/members/type/teachers
I’m outputting a different form in each directory using a template tag.
When a user submits a form, they are taken to a results page at example.com/members. Does BP Profile Search allow me to use the member type directory as the results page.
For example, User A submits Form 1 on page:
example.com/members/type/students
Results are displayed at:
example.com/members/type/students
andrea
Plugin AuthorHi Henry,
Sorry for the late reply!
It should work as you expect but, if that’s not the case, please let me know.
Henry Wright
GuestIt should work as you expect but, if that’s not the case, please let me know.
When I submit the form at example.com/members/type/student, I always seem to be redirected to example.com/members page to view results.
andrea
Plugin AuthorHello Henry,
If your search form is in a widget, it always redirects to the example.com/members page.
At this moment possible workarounds are:
1) you could change the form action attribute in the form template, or
2) you could use the hook bps_search_form_data to change the $F->action value, which will then be used by the form template as the form action attribute.
Henry Wright
GuestThanks for pointing out
bps_search_form_data. I think the issue I’m seeing is related to me using a shortcode to output the form. In my case, I noticed the$F->location != 'directory'condition inside bps-form-sample-1.php always sets form action to “shortcode”.Here’s the fix I ended up with:
add_filter( 'bps_search_form_data', function( $F ) { switch ( buddypress()->current_member_type ) { case 'student': $F->location = 'directory'; break; default: // Do nothing for now. } return $F; } );Thanks again for pointing me in the right direction.
andrea
Plugin AuthorHello Henry,
Thank you for your feedback and code. I’ll try to add support for member type directories directly in BP Profile Search.
Henry Wright
GuestYou may be able to do something as simple as:
if ( buddypress()->current_member_type ) { // Set location to "directory" }andrea
Plugin AuthorHello Henry,
I’ve just released BP Profile Search 4.6.1, to support member type directories.
Would you like to test it?
Henry
GuestThank you Andrea, I’ll give it a try this week and report back if I find any issues.
-
AuthorPost