• Resolved nerdworker

    (@newtonsongbird)


    Any chance you might add a way to remove duplicates from the list based on the field you orderby? Such as a parameter “unique” or duplicates=”no”?

    If not, do you know of a way I can best accomplish this?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author HelgaTheViking

    (@helgatheviking)

    Hi there. Can you explain how you have arrived at duplicate users? To my knowledge, WP_User_Query should return a unique set of matching users. SUL is basically a wrapper for WP_User_Query, which doesn’t support a duplicate or unique parameter because it shouldn’t need it.

    Thread Starter nerdworker

    (@newtonsongbird)

    Thank you for your reply. I’m sorry if I was not more specific – I was not referring to duplicate users, but duplicates with the orderby field. The issue comes up when we are listing certain user fields that we want only unique values. For example, setting up a listing of only user Company names (a custom field – and no other fields). We can do this now, but if we have multiple users with the same company, the list has duplicates. I’m trying to find a way to show the list ordered by company, with only unique company names listed.

    Plugin Author HelgaTheViking

    (@helgatheviking)

    Thank you for the clarification. To the best of my knowledge, this isn’t possible with core WordPress User queries, which means it isn’t possible with SUL by default. I think you’d need to modify the query (the user query can be modified via the pre_get_users filter) with a very custom SQL statement. But it borderline doesn’t seem like you need to use the User query at all and maybe should just go directly to a custom MySQL query.

    Alternatively, if users are being grouped into companies.. it may make sense to use taxonomies. Then to display all companies, you could loop through the taxonomy terms.

    I won’t be able to provide a copy/paste solution as this is well beyond what SUL is capable of. Good luck!

    Thread Starter nerdworker

    (@newtonsongbird)

    Thanks for your response and suggestions.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Removing Duplicates’ is closed to new replies.