Skip Navigation

[Resolved] Sortable first and last name columns in a view

This support ticket is created 5 years, 8 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 2 replies, has 2 voices.

Last updated by Waqar 5 years, 8 months ago.

Assisted by: Waqar.

Author
Posts
#1225465
ss.png

Hi,

How to make first and last name columns sortable? I have a view for showing user accounts. I selected a table with sortable columns, but I can only see the email and registration date columns allow to sort data. The wpv-heading has name attribute "first_name" and "last_name".

Peter

#1225609

Hi Peter,

Thank you for contacting us and I'll be happy to assist.

As explained in this reply ( https://toolset.com/forums/topic/wpv-heading-with-user-fields/#post-324702 ), WordPress doesn't support ordering user query results based on "first_name" and "last_name".

I've internally passed this feedback to add a notice or warning about this limitation in view's interface and/or user-facing documentation. I'll keep you updated with the progress through this ticket.

For now, a workaround can be to drop the built-in query based table column sorting and add it through front-end script like:
hidden link

regards,
Waqar

#1226954

Hi Peter,

Just wanted to update you that thanks to your report, we've added a note in our documentation that "Only Post Fields can be used as sorting criteria."
( ref: https://toolset.com/documentation/user-guides/views-shortcodes/#vf-154328 )

Thank you for bringing this forward.

regards,
Waqar