Skip to:
Content

BuddyPress.org

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#5318 closed enhancement (fixed)

using bp_has_members in widgets and conflicts with $_REQUEST['s']

Reported by: megainfo's profile megainfo Owned by: boonebgorges's profile boonebgorges
Milestone: 2.0 Priority: normal
Severity: normal Version: 1.9.1
Component: Members Keywords: needs-patch 2nd-opinion
Cc:

Description

bp_has_members get filter passed by parameter "?s=" and it's implying wrong results for all widgets using bp_has_members when the current URL contain "?s=" as parameter.

Change History (7)

#1 @boonebgorges
10 years ago

  • Keywords 2nd-opinion added

Good catch. I can see why this would be a problem. WordPress (and probably others) use ?s= for its default search param.

Ideally, we'd use our own URL param for this (kinda like we use acpage for activity pagination links). But I'm not sure off the top of my head whether we can do this while maintaining backward compatibility in all cases. Any thoughts?

#2 @r-a-y
10 years ago

I think we default to use ?s for the new search param and switch the members widget to use a different param like ?ws, we should be safe.

Version 0, edited 10 years ago by r-a-y (next)

#3 @boonebgorges
10 years ago

  • Milestone changed from Awaiting Review to 2.0
  • Type changed from defect (bug) to enhancement

Yeah. On reflection, this sounds more like a workaround than a real fix, since any other kind of member loop will still suffer from this problem. That said, I think there's value in having a separate parameter for widgets, if only to protect against the case where a members widget appears on the members directory. So, on balance, let's go with this kind of fix for now.

#4 @boonebgorges
10 years ago

So, maybe an even easier workaround is to pass search_terms => false to the bp_has_groups() loop in the widget. Since our widget doesn't contain an interface for searching, I don't think we need to support it there. (If someone wants a group search widget, they can build it.) What do others think?

#5 @boonebgorges
10 years ago

Er, I meant 'members', not 'groups'.

#6 @boonebgorges
10 years ago

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

In 8166:

Enforce null search_terms for members widgets

Without the explicity search_terms=false param, widgets could pick up
incorrectly on search params elsewhere on the page.

Fixes #5318

#7 @boonebgorges
10 years ago

In 8574:

Only get 'search_terms' out of $_REQUESTs? in bp_group_has_members() if no 'search_terms' param has been passed to the function

This allows secondary, search-free loops to be run on a page, by passing an
empty string to the 'search_terms' param. See #5318 for a similar strategy as
applied to members widgets.

Fixes #5746

Props WCUADD

Note: See TracTickets for help on using tickets.