I’ve been tasked with setting up a scoreboard of sorts for my local spinning group. The idea is to run a league over a number of weeks where each participant can log the distance they complete during each 45 minute class. We’ve done it with pen and paper in the past, but I thought it might be interesting to see if I could build this with WordPress.
I’m hoping to be able to build this with ACF, but I could do with a little advice on a few things and I’m not completely sure that I can actually build a scoreboard with ACF in the first place.
My thinking is that I would have a front-end form that each participant could complete at the end of class with their name, date of the class, male or female, the decade they were born (we award extra points based on what decade someone was born in or their gender) and the distance completed. These submitted posts would then be displayed in a table and grouped by weeks and we’d be able to see an archive of weekly scoreboards to see how we’ve improved.
The first big question, is it possible to make calculations on fields? Example, a participant selects a field that tells us they were born in the 70s so we award them an extra 4km to the 20km they filled out in a number field. The resulting number of 24km is then shown in the scoreboard.
My second big question, would it be possible to display the weekly entries so the highest distances are always at the top?
I’m also not entirely sure I’d be then able to display these tables by week, is that going to be possible? And it would be awesome if I could also feed the top three highest scores into one main leader board.
Any advice on better ways to approach this are also welcome.
Many thanks.
Hi @leanda
Interesting case study for WordPress/ACF.
What you described can definitely be done.
You can create a Custom Post Type perhaps (or just add Custom Fields to the standard Post), and… during the “Save” process, you can intervene using the acf/save_post filter to do your calculations.
If you would rather the Users not have to login, you can use front end forms as you mentioned. The guide to create Front End Forms with ACF is here.
In addition, all the filtering desires you mentioned (top 3 scores, by-the-week, etc) can be accomplished with custom queries. See this doc here.
If this is helpful, please mark as resolved, and then revisit if you run into anything each step of the way. Perhaps we could have separate threads for each topic as we help you out. Best of luck with your project! Props to giving us older folks a bonus 4k 😉
Keith
Thanks @keithlock your reply gives me the confidence to get cracking with the project.
I may get tripped up when it comes to doing the actual calculations, but I’ll start a new thread for any specific topic.
Thanks so much.
The topic ‘Field Calculations for a scoreboard’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.