You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Visit this page. This is a brand new, clean install with no additional plugins. You'll see a list of therapists ordered by last name. Enter a state in the search field. The list is now sorted by first name and not last name as expected.
BEHAVIOR THAT I EXPECTED
The shortcode is [s2Member-List enable_list_search="yes" orderby="last_name" order="ASC" show_fields="state_province, ID"/]. I would expect that a search would return the results ordered by last name because because orderby="last_name" is in the shortcode.
I did import the S2member configuration and users from the live website so I suppose it's possible the problem moved with that.
I added an even more bare bones site, still the same behavior. I sent login info to support@wpsharks.com subject 'Orderby with Search Not Working'. Sorry if I'm sending duplicate info. I hadn't heard from support until after I posted the bug report.
https://river-graphics-design.net/sstarr3/ I used everything fresh. First I used the current version of S2Member. Then to see if it's an update issue, I used version 170221 and then version 161129. Still no luck.
NOTE: To try to rule out a hosting issue, the above clean installations are hosted at Siteground. The original website, sstarnet.org, is hosted at GoDaddy.
Was unable to reproduce original issue on clean installation.
Tested Using:
WordPress Version: 4.8-RC2-40880 / WordPress 4.7 Current WordPress Theme: Twenty Seventeen version 1.2 Active Plugins: s2Member Framework Version 170524 + s2Member Pro v170524 PHP Version: 7.1.3-3+deb.sury.org~xenial+1 MySQL Version: 10.0.29-MariaDB-0ubuntu0.16.04.1
However, I don't see a search field in your screen shots. The problem does not occur when the page first loads. The problem occurs only when the page is searched from the search box. Your code above does not include the shortcode [s2Member-List-Search-Box placeholder="Search"/] for a search box.
As I have mentioned, everything is fine with simply loading the page, as your test affirms. The problem only occurs when a search is executed.
I've included a search box and was unable to replicate your original error consistently based only off ofDisplay Names / First / Last:
Click for Search Results Page
The names would always be alphabetical order in first couple of tests:
However, I continued to experiment to try and replicate your original error. I was able to replicate it more consistently when I included usernames that were not based off of their names.
For Example:
Click for Search Results Page
Search results ordered by Username:
First Name
Last Name
Username
State
Hank
Pym
Antman
New York
Steve
Rogers
Captain America
New York
Charles
Xavier
Prof X
New York
Peter
Parker
Spidey
New York
Search Results:
The Usernames are sorted in Alphabetical order despite having set it to sort by Last Name, (orderby="last_name" order="ASC" ).
On your search page https://river-graphics-design.net/sstar/?s2-s, the results look like they are being sorted by First name, but that could be the result of the Username being based off of their First and Last name.
Status : Bug Found
Search list results sort order by set username, not by set search parameter in shortcode, in this case: orderby="last_name" order="ASC"
Ensure that you have at least two users with different last names and different usernames (in my example, I'm using "Raam Dev" raamdev, and "Example User" example).
Load the page with the [s2Member-List /] shortcode and observe that the order is (correctly) sorted by last name (orderby="last_name") in ascending order (order="ASC"):
Now do a search that will result in the same list of users appearing in the results. In my case, both users have an email address that has raam in them, so I'll do a search for raam. Note how the results are no longer sorted by last name (orderby="last_name") in ascending order (order="ASC"); instead the order of the results appears to be sorted by username (orderby="username"):
I'm not sure if this is because the orderby="last_name" and order="ASC" attributes are not supposed to apply to the search results, or if there's actually a bug here that's preventing that from working as expected.
@jaswrks we could use some clarification from you here when you get a chance.
Thanks @renzms, @raamdev, and @jaswrks for pursing this issue. Sorry but I don't see how orderby="display_name" is short-term workaround.
display_name uses the first name and last name as a string. So Aaron Marsh comes before Abby Girard. Here's a screenshot without a search ordered="display_name".
Additionally, it looks to me like the sort order is by display_name when a search is done, not by ID. Here's a screenshot sorted on New York. You'll see that the IDs are not in order and it appears to be sorted by first name then last name.
@jaswrks I'm not familiar with procedures for addressing bugs. Do you know if this will be addressed in the next update? I'm sure my client is going to ask. Thanks
Activity
stevenwolock commentedon Jun 6, 2017
I added an even more bare bones site, still the same behavior. I sent login info to support@wpsharks.com subject 'Orderby with Search Not Working'. Sorry if I'm sending duplicate info. I hadn't heard from support until after I posted the bug report.
renzms commentedon Jun 8, 2017
@stevenwolock
Hi Steven, for personal details such as login info, etc you can continue sending those in the email support thread you have open with us.
We will attempt to reproduce this issue in a clean installation and add the findings in this GitHub Issue.
stevenwolock commentedon Jun 8, 2017
Thank you for taking a look at this. I don't know how to use Github, so pardon me if I should have provided this info in a different way.
Here's the template member-list.php.zip for https://sstarnet.org/find-a-researcher/ . I really don't think it's that because the following clean installations use the default template and you'll see the same results.
I'll email the login credentials for these tests again. They all use the same credentials.
NOTE: To try to rule out a hosting issue, the above clean installations are hosted at Siteground. The original website, sstarnet.org, is hosted at GoDaddy.
Also, https://sstarnet.org/find-a-researcher/?s2-s=Home sorts by first name when searched. I haven't changed any parameters at all so I don't know what you saw the first time.
Please let me know if there's anything I can do to help.
Thanks again for helping with this issue.
Steve
renzms commentedon Jun 9, 2017
Status:
Unable to Replicate IssueWas unable to reproduce original issue on clean installation.
Tested Using:
WordPress Version: 4.8-RC2-40880 / WordPress 4.7
Current WordPress Theme: Twenty Seventeen version 1.2
Active Plugins: s2Member Framework Version 170524 + s2Member Pro v170524
PHP Version: 7.1.3-3+deb.sury.org~xenial+1
MySQL Version: 10.0.29-MariaDB-0ubuntu0.16.04.1
cc: @raamdev / @jaswrks
Hi @stevenwolock
Tested the exact same shortcode you had used:
[s2Member-List enable_list_search="yes" orderby="last_name" order="ASC" show_fields="state_province, ID"/]
with the addition of adding of using
exclude="1"to remove admin user.Front End test for [s2Member-List /]:
As you can see, the names are listed in
ascendingorder (alphabetical order) by last name.@stevenwolock wrote:
Those also show a listed ascending order by last name. If you mean that they don't show the
Last Namefirst, and actually want thelast_nameto display before thefirst_name, please create a custom template. Please see: https://s2member.com/kb-article/using-a-custom-template-for-s2member-list/The display name is
display_name, which is the full display name of the user, not two separate data fields:first_namelast_namePlease refer to this line of code here
stevenwolock commentedon Jun 9, 2017
Hi Renz,
Thanks again for your help with this issue.
However, I don't see a search field in your screen shots. The problem does not occur when the page first loads. The problem occurs only when the page is searched from the search box. Your code above does not include the shortcode [s2Member-List-Search-Box placeholder="Search"/] for a search box.
As I have mentioned, everything is fine with simply loading the page, as your test affirms. The problem only occurs when a search is executed.
stevenwolock commentedon Jun 9, 2017
renzms commentedon Jun 12, 2017
@stevenwolock
I've included a search box and was unable to replicate your original error consistently based only off of Display Names / First / Last:
Click for Search Results Page
The names would always be alphabetical order in first couple of tests:
However, I continued to experiment to try and replicate your original error. I was able to replicate it more consistently when I included usernames that were not based off of their names.
For Example:
Click for Search Results Page
Search results ordered by Username:
Search Results:
The Usernames are sorted in Alphabetical order despite having set it to sort by Last Name, (
orderby="last_name" order="ASC").On your search page https://river-graphics-design.net/sstar/?s2-s, the results look like they are being sorted by First name, but that could be the result of the Username being based off of their First and Last name.
Status :
Bug FoundSearch list results sort order by set
username, not by set search parameter in shortcode, in this case:orderby="last_name" order="ASC"cc: @raamdev / @jaswrks
stevenwolock commentedon Jun 12, 2017
Thanks for continuing to explore this issue. Can you please respond to/confirm the following so I can relay this info to my client?
usernameeven though the shortcode specifieslast_name.Thanks again.
raamdev commentedon Jun 14, 2017
I've also been able to reproduce this issue, although I'm not 100% sure that it's a bug and not just unnecessarily confusing.
Steps to Reproduce the Issue
Ensure that you have at least two users with different last names and different usernames (in my example, I'm using "Raam Dev"
raamdev, and "Example User"example).Load the page with the [s2Member-List /] shortcode and observe that the order is (correctly) sorted by last name (
orderby="last_name") in ascending order (order="ASC"):Now do a search that will result in the same list of users appearing in the results. In my case, both users have an email address that has
raamin them, so I'll do a search forraam. Note how the results are no longer sorted by last name (orderby="last_name") in ascending order (order="ASC"); instead the order of the results appears to be sorted by username (orderby="username"):I'm not sure if this is because the
orderby="last_name"andorder="ASC"attributes are not supposed to apply to the search results, or if there's actually a bug here that's preventing that from working as expected.@jaswrks we could use some clarification from you here when you get a chance.
jaswrks commentedon Jun 15, 2017
@stevenwolock @renzms @raamdev
Nice find. Yep, that's a confirmed bug. Thank you for reporting this.
Referencing: https://github.com/websharks/s2member-pro/blob/170524/src/includes/classes/member-list.inc.php#L110-L135
And this line, where we need to merge the dummy meta keys so that
WP_User_Queryis capable of sorting bylast_namewhenever a search is being performed. See: https://github.com/websharks/s2member-pro/blob/170524/src/includes/classes/member-list.inc.php#L256jaswrks commentedon Jun 15, 2017
A short-term workaround is to set
orderby="display_name"jaswrks commentedon Jun 15, 2017
What happens currently is that results are ordered by user User ID in this buggy scenario.
stevenwolock commentedon Jun 15, 2017
Thanks @renzms, @raamdev, and @jaswrks for pursing this issue. Sorry but I don't see how
orderby="display_name"is short-term workaround.display_nameuses the first name and last name as a string. So Aaron Marsh comes before Abby Girard. Here's a screenshot without a searchordered="display_name".Additionally, it looks to me like the sort order is by

display_namewhen a search is done, not byID. Here's a screenshot sorted on New York. You'll see that the IDs are not in order and it appears to be sorted by first name then last name.Thanks again
stevenwolock commentedon Jun 15, 2017
@jaswrks I'm not familiar with procedures for addressing bugs. Do you know if this will be addressed in the next update? I'm sure my client is going to ask. Thanks
stevenwolock commentedon Jun 26, 2017
Reminder about previous comment...
stevenwolock commentedon Jul 24, 2017
Is this issue resolved in the new update v170722?
raamdev commentedon Jul 28, 2017
@stevenwolock No, it has not been resolved yet. You can see the changelog here: https://s2member.com/changelog
We don't have an ETA on when this will be resolved at this time, but we hope to get it out with the next release.
stevenwolock commentedon Dec 12, 2017
Hi S2 Member gang... any updates on this issue? I know my client is going to be asking any day now. Thanks
s2Member-List search orderby meta_value. wpsharks/s2member#1103