Skip Navigation

[Resolved] Sort by User ID in Descending Order

This support ticket is created 7 years, 3 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 – 10:00 - - - - -
- - - - - - -

Supporter timezone: Africa/Cairo (GMT+02:00)

Tagged: 

This topic contains 5 replies, has 2 voices.

Last updated by triggeru571 7 years, 2 months ago.

Assisted by: Mohammed.

Author
Posts
#470968

I am trying to: Sort users by User ID in descending order via a view.

I visited this URL:

I expected to see: In Views, I thought I could "Add a query filter to this View" by User ID, =< the current logged in user.

Instead, I got: No option to query by User ID exists.

I am sure the older versions of toolset has this but it is missing from my toolset which is the latest version.

If I cannot use this query, then do you have any suggestions? Thanks

#471024
Edit View ‹ replicate — WordPress - Google Chrome 2016-12-26 16.59.03.png

Hello,

I’m Mohammed: the Toolset support team leader. I’ll give my best to help you to achieve your needs through Toolset components.

There an option to filter by specific post IDs (please check the attached screenshot)

But this will not filter by IDs that are greater than a specific value.

You can you a condition to achieve this in the loop output editor like the following:
[wpv-conditional if="( '[wpv-post-id]' gt '[wpv-user field='ID']' )"]
Display your results
[/wpv-conditional]

Please let me know if this works with you.

Thanks.

#471163

Hi Mohammed,

Actually it is User ID I need not Post ID. However, let me be specific about the actual need, maybe we can come up with something as I have been trying to figure this out for a week :). Bare with me a little.

This is how I have the requirement working in my head. This is based on a multi level referrer system, so person A refers B, B refers C, C refers D and so on...

Step 1: QUery list of all referrals in the Heirarchy for the user being displayed. So if this query is for person D above, then is would show C, B, A.
(This is where I was thinking of user ID in descending order).

Step 2: Check if a specific custom field in the referrer is empty. If empty, then move to the next refferer (again in descending order). If custom field found the display it.

Ex: C no CF > check B
B has CF - then display and end query.

Step 3: If no referrer has custom field, then display default (this part is easy).

On paper it seems pretty straight forward, simply check for custom field for each referrer of this user with an ID less than this user. However, I have not been able to achieve this in views as there is no USER ID query option (I think I could do it if there was).

Any help would be greatly appreciated.

#471669

any idea?

#471719

Hi,

Could you try this using nested Views?
https://toolset.com/documentation/user-guides/using-a-child-view-in-a-taxonomy-view-layout/

You may create a View that lists users,
I the loop output, you can call another view that lists users.
You can pass the current user ID to the inner View via a shortcode parameter
Please check this as well: https://toolset.com/documentation/user-guides/passing-arguments-to-views/

Please let me know if this close to what you need.

Thanks.

#472590

Thanks I resolved this in a very different way to what I was expecting or what you described above 🙂

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.