0

Having trawled through the Wordpress Plugin centre for many hours, I can't find something to do the job I'm looking for so need to plan how to write this myself / offer a full brief to a professional developer.

We run a site where our users are presented with a list of "tasks" that they can complete. We write up instructions on how to complete each task, so the users can follow and make progress. Tasks are written as "posts" and we have a page which is basically a table of contents, listing links and basic descriptions/info about each task. Each user can complete each task (i.e. if user A completes task 1, then user B can also complete task 1).

We would like to add in the functionality to have a "click to complete" button for each task. When a user clicks the button, the task is marked complete (for the current user) and the table row relating to that task is hidden from the table, possibly shown in another table of "completed tasks".

I'd like some advice on the best way to approach this. My thoughts up to now are to create a new table in the database which has fields of (id, user_id, post_id, completion_status where > 0 = not started, 1 = in progress, 2 = complete) if the user_id/post_id cannot be found in the table the default status would be 0.

My thinking is that I could then write a query to return all "not started" or "in-progress" tasks for each user and output the results in to the table. Then have another table to display completed tasks.

I just want to know from people who have more experience in this field whether I'm about to start embarking on this with the correct plan in place, or whether I should be approaching it in a different way?

Thanks in advance.

0

I'm not entirely sure this is the right place for this question, but I can't say I know of a better place. :)

Your rough proposal is a valid way of building said system, but I would argue that you're losing all of the advantages of using WordPress with the stated method. By creating a new table you have to build all of the "extras" around it. All of the special methods for finding the data you want, or accessing the relationships you need. Wordpress already has a table meant for this type of data, it's called usermeta (generally prefixed to be wp_usermeta, or in code $wpdb->usermeta).

It's structured in such a way as to be open to just about any type of content with WP_Query having special filters (meta_query) for handling the sorting of the data and with the WP_User having methods (get_user_meta()) to access the DB data without having to write any SQL.

  • Great, thanks for your help I'll do some reading on these features and hopefully get the functionality we need at last! :) – kassinopious May 25 '17 at 11:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.