custom field - Let users track progress by entering a number daily in profile?

admin2025-06-02  1

I'm building a WordPress site for a reading challenge where users will sign up for an account and visit the site daily to enter the number of pages they've read.

I'm using BuddyPress for the user signup, but would like advice on how to handle the daily page count data entry.

I need to be able to use the page count number they enter to display that data on a graph in their profile of pages per day, and also to display the cumulative data across all users each day in a graph on the home page. Any suggestions on how to code this?

I'm building a WordPress site for a reading challenge where users will sign up for an account and visit the site daily to enter the number of pages they've read.

I'm using BuddyPress for the user signup, but would like advice on how to handle the daily page count data entry.

I need to be able to use the page count number they enter to display that data on a graph in their profile of pages per day, and also to display the cumulative data across all users each day in a graph on the home page. Any suggestions on how to code this?

Share Improve this question asked Mar 18, 2019 at 8:20 Charli PrangleyCharli Prangley 111 bronze badge 3
  • Sounds like a really cool idea! But I have a question, do they just manually record the number of pages they have read or is the actual reading material available on your website for them to "Mark as Read"? – jsmod Commented Mar 18, 2019 at 8:32
  • 1 @jsmod I should have made that clearer sorry! Users will manually enter the number of pages they have read. The reading challenge is only a week long, so I figured I could have 7 fields (one for each day), but I'm not sure of the best way to create these fields and have the data saved to the database for use in graphs. – Charli Prangley Commented Mar 18, 2019 at 8:40
  • I'm not sure either, but I have up-voted your question and hope you get an answer from the good people here soon :) It is a very interesting activity and I wonder to what extent WordPress can be used for this purpose. – jsmod Commented Mar 18, 2019 at 13:08
Add a comment  | 

1 Answer 1

Reset to default 0

Here's a rough outline / concept how I would approach the challenge. Others might come up with different solutions, but I think something like this should get the job done.

  1. Create a custom post type, e.g. reading_challenge, to store the data. Add author support to the post type so that the posts can be linked with your users. The cpt doesn't need to be public.
  2. Create a form (shortcode, maybe?) with a number input field for each day. Add current user ID as a hidden field. If an cpt exists for the user already, add the post's ID in a hidden field, too. Also, prepopulate the fields with daily count data, if it exists in the custom post's meta. Or you could have a form with just one input field and render it only, if the user has not yet submitted the data for that particular day.
  3. On form submit either create a new cpt post for the author and save the submitted data as post_meta or update existing post meta.
  4. Query and use custom post(s) and meta data as needed. Regarding home page usage, you might want to "cache" the count data to a transient instead of doing the query and counting on every home page load.
转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1748795756a313786.html

最新回复(0)