Hello lovely MODX community.
I need help with something.
Unfortunately the guy who worked on the modx backend at our firm has left and now i’m stuck with a request from a client which i don’t know how to tackle. I’m mainly a frontend guy but i know my way around things and i might have a gist of the solution… I just need some support on the actual implementation.
The website is on Revo 2.6.5 and has several contexts, user groups, and a lot of users which are imported through a csv file that also carries extra fields.
A page with a search field connected to a specific and unique extra user field that retrieves other details from the corresponding user. So there should never be more than 1 result anyway.
The search field queries for “client_code”, an extra field that is unique to every user.
The query would have to find the user corresponding to such “client_code” and:
- check if the user is active
- check if the user is present in a specific set of user groups
- print results such as the user’s fullname, email, extra_field_1, extra_field_2, etc.
What i had in mind is a 2 snippets systems (something like simplesearch):
The idea is to put here the IDs of the user groups to check upon, a tpl with the search form (for styling and layout purposes) and the ID of the results page (i wouldnt bother with ajax or presenting results on the same page)
This would have to retrieve the results of the query and print values in the tpl like:
- [[+client_code]] <-- this is the same value as the initial query
- Member of [name of userGroup the user is in] with code [[+extra_field_2]]
- Bonus -> An error message if no user is found among the specified user groups.
The problem now is i have NO IDEA of how to even get started with these snippets.
Has anyone already made something like this or can guide me through?
Maybe there’s already a plugin for this which i don’t know of?
I’m also open to different solution but i tought this was the simplest iteration with the tools and knowledge i have at my disposal.
Thanks for your time.