empty fields variable in bps_add_fields hook since BP Profile Search 4.9.2
-
Hello,
Some times ago I made a plugin based on BP Profile Search, it was using standard text fields so I did not need to use custom fields type (unlike the article https://dontdream.it/bp-profile-search/custom-profile-field-types/). I also did not want to use custom fields type to make fields compatible by default with BuddyPress, even if all other plugins are disabled. It was working great up to version 4.9.1 of BP Profile Search and stopped working since version 4.9.2.
Basically, I was able to customize the search function in the BP Profile Search hook bps_add_fields but now the fields variable is empty in the new versions of BP Profile Search.
Below is the code that is able to return fields in version 4.9.1 but returns an empty array in version 4.9.2. You can create a new test WordPress plugin and copy-paste the code in order to test it (to test with previous versions of BP Profile Search, you can download an old archive at the end of the page https://www.ads-software.com/plugins/bp-profile-search/advanced/).
You will see an empty fields array since version 4.9.2, by opening the BuddyPress search page and viewing the HTML source code in a web browser like Firefox by doing a right click and selecting “View Page Source”. Then you can search for “TEST” without quotes to see the HTML comment with empty fields array by using the Ctrl+F shortcut of your browser.Do you know why the issue happens and do you plan to fix it? I did not see any deprecation notice in the changelog of version 4.9.2.
Thanks.
add_filter('bps_add_fields', myCustomSearch); function myCustomSearch($fields) { echo '<!-- TEST fields: ' . print_r($fields, true) . ' -->'; foreach ($fields as $field) { echo '<!-- TEST field: ' . print_r($field, true) . ' -->'; } return $fields; }
- The topic ‘empty fields variable in bps_add_fields hook since BP Profile Search 4.9.2’ is closed to new replies.