Skip to:
Content

BuddyPress.org

Opened 10 years ago

Closed 10 years ago

#5898 closed defect (bug) (fixed)

Unable to page through search results

Reported by: bomako's profile bomako Owned by: imath's profile imath
Milestone: 2.1.1 Priority: normal
Severity: normal Version: 2.1
Component: Members Keywords: has-patch commit
Cc: mvferguson@…

Description

I am using WordPress 3.9.2 and BuddyPress 2.1. I have a custom field for a building name where people live. The sample values are "~ Aspen ~", "~ Park Manor ~", "~ Duplex Homes ~". Each member has something selected. If I go to the member page and click on the link of their building name, I am taken to a URL ending with (for example) "?s=~+Cottage+Homes+~" and the search results are loaded. But when I try to paginate through those results, the URL changes to "?upage=2&s=~CottageHomes~" and I get a message saying "Sorry, no members were found." It appears that all the spaces are stripped from the search. If I insert the spaces in the URL, the second page displays members just fine.

Attachments (5)

5898.patch (2.6 KB) - added by imath 10 years ago.
5898-02.patch (1.0 KB) - added by imath 10 years ago.
5898-02-unittest.patch (1.1 KB) - added by imath 10 years ago.
5898-03-unittest.patch (1.3 KB) - added by imath 10 years ago.
5898-04-unittest.patch (1.2 KB) - added by imath 10 years ago.

Download all attachments as: .zip

Change History (16)

#1 @imath
10 years ago

  • Component changed from Core to Members
  • Keywords dev-feedback has-patch added
  • Milestone changed from Awaiting Review to 2.1.1

Hi bomako

Thanks for your feedback. It seems to be a side effect of r8928. I suggest the attach patched.

BTW, i was wondering if there were a specific reason why in the member's dir search form, the search term was displayed as a placeholder instead of the input value ?

@imath
10 years ago

This ticket was mentioned in IRC in #buddypress-dev by bgorges. View the logs.


10 years ago

#3 @imath
10 years ago

Worked on a unit test. And it made me edit my previous patch ;)

See 5898-02.patch & 5898-02-unittest.patch

@imath
10 years ago

#4 follow-up: @boonebgorges
10 years ago

Thanks, imath! Couple notes on the test:

  • Could you make the method name a bit more descriptive? Maybe test_bp_has_members_search_pagination_with_spaces()
  • Should be @ticket BP5898
  • Clean up the $members_template global or you may pollute later tests

#5 in reply to: ↑ 4 @imath
10 years ago

Replying to boonebgorges:

Thanks, imath!

You're welcome ;)

Applied your notes in 5898-03-unittest.patch except for @ticket BP5898 as for some weird reason, the test is skipped in this case. So i've used @ticket bp5898 instead.

#6 @boonebgorges
10 years ago

except for @ticket BP5898 as for some weird reason, the test is skipped in this case. So i've used @ticket bp5898 instead.

This is by design - tests that are associated with open tickets are skipped, unless (a) you run them explicitly (phpunit --group BP5898) or (b) you define WP_TESTS_FORCE_KNOWN_BUGS as true in wp-tests-config.php. The fact that the test was being skipped when running phpunit means that you had the annotation correct :)

Also, forgot to mention in my last comment - don't check ! empty( $matches[1] ). You're doing that to avoid PHP notices, which is good practice in BuddyPress, but in a unit test, we want to see the error when your regex doesn't match anything so we know that the test has failed!

#7 @imath
10 years ago

Well phpunit --BP5898 was also skipping the test. Updated the unittest, thanks a lot for the explanations ;)

#8 @boonebgorges
10 years ago

  • Keywords commit added; dev-feedback removed

phpunit --group BP5898 :)

Thanks for the fixes!

#9 @imath
10 years ago

yep that's what i did ;) i mistyped in my previous comment !! Thanks a lot for your help :)

#10 @imath
10 years ago

In 9044:

On members directory, make sure search terms containing spaces are well transported in pagination links.

When a profile field output containing spaces was clicked, the member search functionality wasn't creating consistent pagination links. This behavior was introduced by r8928. Patch is fixing the issue and also includes a unit test.

props boonebgorges

See #5898

#11 @imath
10 years ago

  • Owner set to imath
  • Resolution set to fixed
  • Status changed from new to closed

In 9045:

On members directory, make sure search terms containing spaces are well transported in pagination links.

When a profile field output containing spaces was clicked, the member search functionality wasn't creating consistent pagination links. This behavior was introduced by r8928. Patch is fixing the issue and also includes a unit test.

props boonebgorges

Fixes #5898

Note: See TracTickets for help on using tickets.