• Welcome to the Chevereto user community!

    Here users from all over the world gather around to learn the latest about Chevereto and contribute with ideas to improve the software.

    Please keep in mind:

    • 😌 This community is user driven. Be polite with other users.
    • 👉 Is required to purchase a Chevereto license to participate in this community (doesn't apply to Pre-sales).
    • 💸 Purchase a Pro Subscription to get access to active software support and faster ticket response times.
  • Chevereto Support CLST

    Support response

    Support checklist

Sort users by received user_likes

Saxbald

Chevereto Member
Hi!

I've set up Chevereto as a photography community. I used the lister class to display a list of all photographers (read: users) that are part of the community, like so: https://brinkr.photos/streetphotographers
To avoid conflicts I created a new class: class.mynewlisting.php where I made my changes.
This has worked fine for me, but I wanted to make a new tweak:

I would like to change the sort order for my users from number of uploaded images to received user_likes. So users that publish high quality photos are listed first, because they received more likes. (And users that publish lower quality stuff, get listed below.)

I added 'user_likes' to $valid_sort_types, but I'm stuck from there on. Any ideas on how to change my custom listing class?

With kind regards,


Saxbald
 
Can you show us what you have? Once you call user_likes you should be able to sort by it no? Post your copy if you don't mind of what you have in that file.
 
I got it working!

My new class was exactly the same as class.listing.php, except for the fact that I added 'user_likes' to $valid_sort_types.
When I called the listing class with user_likes as my sort type, I got an internal server error. My error logs gave me this information:
Column not found: 1054 Unknown column 'chv_users.user_user_likes'
That helped me a lot. I should have called the listing class with 'likes' as my sort type, not 'user_likes'.
So for my custom listing class, I copied the exact same code as class.listing.php and added 'likes' to $valid_sort_types. Now my user list is displaying as I want it (users sorted by the number of likes they received).

Thanks SirMoo, for your reaction.
 
Back
Top