Skip Navigation

[Resolved] Is it possible to create a master "to-do" list that every user can use?

This support ticket is created 7 years, 2 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Author
Posts
#572927

I am building a membership website for one of my clients. We migrated him over from Wishlist Member to a different membership plugin.

His old Wishlist Member site had an extension that "each member can “check-off” the items on their lists as they are accomplished." He was able to create a master checklist that is the same for all users, but each user was able to check off the tasks individually, without affecting anyone else's version of the list.

hidden link

I was wondering if it might be possible to simulate the same functionality with CRED? Something where we might be able to build out a custom post type for tasks, perhaps with custom fields or custom user fields to allow each user of the site to mark the to-do posts as completed?

I'm just giving you some points of reference in hopes that you might be able to think of a way it could be possible with your plugins.

Please let me know if I can elaborate any further.

Thanks so much!

#573044

I think you could accomplish this in a few ways. The easiest way is to use Custom User Fields.
- Create a new User Field group, and include a single checkbox field for each item in the global "To-Do" list.
- Create an Edit User CRED form. Automatically generate the code for this form, then delete all the inputs except the checkboxes for the to-do list and the submit button. Allow Users access to this form by putting it on the front-end of your site somewhere. Each User would only be able to edit his or her own list.
- When new items are added to the global to-do list, you must update the CRED form to include the new input field. When items are deleted from the global to-do list, you must remove them from the CRED form.

Does this sound like something that could work?

#573053

Christian, Just to clarify:

"Create a new User Field group, and include a single checkbox field for each item in the global "To-Do" list."
-- So, first I would create a custom post type called something like "To-Do Lists"? After this, create a single user field called something like "Complete To-Do", and assign it to the "To-Do- List" custom type?

Do you have the repeating fields done yet? Ideally, the custom post type of "To-Do" would create a new list, and there would be a way to add as many to-do items to that list post as we want ... so the post in the post type is a single list, and the user field in the post would be the list items. Is this remotely possible?

Once I hand this over to my client, I want them to be able to spin up a checklist of items for his members without TOO much trouble.

-- Do we need the custom post type? I guess the other way is that each checklist is a field group, and under each group are the checkboxes to create the lists? Then each field group gets its own form, or could it be one big for with a bunch of field groups under the one user form?

Just a little background, so maybe you can visualize what I need to do. My client has a course that runs for 40 weeks. In his original website, every week or the course had a checklist of "things to get done". He wants a master list page, where every week's checklist is there (maybe in an accordion, so they only have to look at one week at a time). Every week, the member watches the video for the lesson, and then has a checklist of to-dos that they can check off as they complete them.

This is strictly for the member to keep themselves organized, so the form doesn't have to be submitted anywhere, the member just has to update their to-do list for recording purposes.

"Create an Edit User CRED form. Automatically generate the code for this form, then delete all the inputs except the checkboxes for the to-do list and the submit button. Allow Users access to this form by putting it on the front-end of your site somewhere. Each User would only be able to edit his or her own list."
-- This sounds straight forward.

"When new items are added to the global to-do list, you must update the CRED form to include the new input field. When items are deleted from the global to-do list, you must remove them from the CRED form."
-- This sounds straight forward.

So, I have there few questions ... this could work, but I want to make sure I understand how to make it easy for my client to manage.

I also want to make sure that it is easy to keep everything organized.

Thanks so much for your suggestions. I found a backup plugin that creates checklists, and lets users update their own, but it doesn't seem to be supported too well. I'd rather figure out how to utilize Toolset, as I know you guys will be around a long time.

If I can clarify anything else, please let me know.

Thanks so much!

#573082

Okay thanks for the background, I think I have a better idea of how this should work.

Once I hand this over to my client, I want them to be able to spin up a checklist of items for his members without TOO much trouble.
With this in mind, I think the custom fields and field groups approach alone (what I was originally proposing) isn't the best idea. Each period, your client would be required to create custom fields in wp-admin, then create a new CRED form that manages those custom fields, or some other way to map those new fields into a CRED form. That's not exactly simple.

Instead, you would probably want them to be able to use a simple CRED form that creates a new To Do List, and then another simple CRED form that adds Activities to that list. This should be really simple, and not require a trip into wp-admin. These forms can be restricted using Access.

You'll want to be able to automate the process that creates CRED forms for the students as well, so they can mark each Activity off one by one. With all that in mind, I think custom post types are required. You'll need two CPTs - List and Activity. List is the parent of Activity. You'll still need a custom User field, but it's a repeating single-line text field that your client does not have to maintain.

Here's how I would do it:
Create a new User field that is a single line text field, that accepts multiple values. This repeating field will be used to store references to each Activity that has been completed by the User. More on that below.

Create a CRED form for new Lists. Your client will use this CRED form to create a To Do List each period. Put it on a custom page somewhere and limit access to that page using User roles and Access. Once a List is created, the client can begin adding Activity children to that List using another CRED form on this page. This form will create new Activity posts, and will be set up to predefine the parent List post. Again, you can use Access to restrict this content to your Client only. At that point, you will have a single post page for each List and a single post page for each Activity. You can style these with Content Templates.

Add a View of child Activity posts and place it on the List page. You can restrict this content to Students. In the View's Loop, include a User CRED Form that includes only a hidden field that contains the Activity ID, and a submit button that says "Done!". When this button is pressed, the CRED form is submitted, and with the help of some custom code and the cred_save_data hook, the current Activity ID is added to a repeating custom field on the current User's profile. I can help you with that if you'd like. Each student that submits the CRED form will then have a reference of that Activity ID stored in their profile.

Next, you can modify the Activity View to use conditional HTML that displays the "Done!" button for each Activity only if the User field doesn't contain that Activity ID. Otherwise, you can show something else like an image of a checkmark to indicate this Activity has been completed, or another button that allows the User to un-check it (another CRED form).

I think this approach is simpler for your Client and the Students, even if it takes a bit more work to set up in the beginning.

#573107
to-do-example.jpg

Christian! This is a wonderful explanation. I'm going to have to read it a couple time to get my thoughts in order.

To confirm a few things, I am going to attach a screenshot of what the end result should be, so I can finalize the concept, and start building.

Does this screenshot represent what you were envisioning when writing your reply?

If so, I will begin working through your instructions to build everything out. Your offer to assist would be helpful. I'd like to get it started to see what I can do, but I would appreciate having you on standby.

I did not mock up the forms ... just the end result for the members. Again, each member would see the same to-do list, but they'd be able to interface with it and save their progress individually.

"Create a CRED form for new Lists. Your client will use this CRED form to create a To Do List each period."
-- So, with this statement, it sounds like if my client has a 40 week course, we will need 40 CRED forms? (when you say each period, you mean each week?)
-- Also, I'm not sure if you mentioned this ... for the custom post type for "List" ... would each post be a would list for one week, or would each post be a single to-do item?
-- In addition to the list CRED forms, you mentioned Activity CRED forms. If there is one CRED form for each week's list (40), would I also need one CRED form for Activity on that list (40)?

I am starting to see your vision, but I just want to clarify a few point before attempting to build this out.

Also, does CRED have a way to "save" a form via AJAX ... so, if a person checks a checkbox, can that action be submitted via AJAX? When a member goes to their to-do list page, would they be able to check a to-do off without clicking the submit button? If not, that's okay ... I want to make sure I cover all the bases (It is almost guaranteed my client will ask most of these questions).

Also, are they all User forms, or do any of them have to be Post forms?

Thanks so much!

#573110
Capture1.JPG
Capture2.JPG

Okay ... I think I got pretty far.

I created 2 post types ... Lists and List Activities ... List Activities is a Child of Lists

I created 2 post CRED post forms ... the first is so my client can create a list post, the second is for my client to add activity posts to that list post.

I put these two CRED post forms on a page for testing ... screenshot (capture1) is attached.

Then, I created 2 views ... the first is a view that loops through Lists, and the second loops through List Activities.
-- List Activities View has a filter "Select posts that are a children of the current post in the loop."
-- In the Lists View, I put the Activities View inside the loop "[wpv-view name="to-do-activity"]".
-- Screenshot attached (capture2).

I also created a User field, and a User CRED form, but I am still a bit unclear on this particular part.

Is this pretty good so far?

Thanks!

#573283

Does this screenshot represent what you were envisioning when writing your reply?
Yes, this is pretty close. I assumed you would put each To-Do List on a separate page, but it can work altogether like this in a View of Lists as well.

-- So, with this statement, it sounds like if my client has a 40 week course, we will need 40 CRED forms? (when you say each period, you mean each week?)
-- In addition to the list CRED forms, you mentioned Activity CRED forms. If there is one CRED form for each week's list (40), would I also need one CRED form for Activity on that list (40)?
Just 1 CRED Form for Lists and 1 CRED Form for Activities will be created in the backend. You could put both of the CRED forms on the same page, as you have described, or you can put them in different locations. For instance, you could put the new List CRED on one page, then when that form is submitted, you redirect the Client to the Single List page that was just created. This is where you include the Activity form in the Content Template (the same form shows up on all List pages). We can set up that form to automatically know which List is the Activity's parent. Or they can both be on the same page like you have described. In this case, the Client must select the parent List for each Activity they create. In the approach where the Activity CRED form is on the single List page, the parent List can be predefined.

-- Also, I'm not sure if you mentioned this ... for the custom post type for "List" ... would each post be a would list for one week, or would each post be a single to-do item?
Each List post would represent a single To-Do List. Each Activity post would represent a single to-do item on each List.

Also, does CRED have a way to "save" a form via AJAX ... so, if a person checks a checkbox, can that action be submitted via AJAX?
A CRED form can submit via AJAX, but only on a button press and not on a checkbox interaction. So if you don't want to include a Submit button next to each checkbox, you can use submit buttons instead of checkboxes. Then if the UI requires checkboxes, you can style each button to look like a checkbox using a CSS replacement technique. This is something I would not be able to assist you with here in the forums, since it's a custom UI.

Also, are they all User forms, or do any of them have to be Post forms?
The three forms required are:
New List - New Post form, creates List posts
New Activity - New Post form, creates Activity posts
Check off each Activity - Edit User form, modifies the repeating field value on a User's profile

I also created a User field, and a User CRED form, but I am still a bit unclear on this particular part.
Okay, the User field needs to be a single line text field, and you should select the option "Allow multiple-instances of this field". In the Edit User CRED form, you will include this input field but hide it using CSS. We will set it up to be pre-populated with the ID of the current Activity. Then when the form is submitted, this Activity ID will be added to the current User's repeating field. We will be able to test this field value to determine whether or not a User has completed an Activity.

Is this pretty good so far?
Yes! I think you're on the right track. Let me know where you get stuck and I can help out.

#574757
Capture01.JPG

Christian,

This is all great information. I will be trying to get this done by the end of the week.

I'll let you know if I can't figure any of it out.

While we are having a conversation about CRED and user posts, perhaps you can tell me if this is possible ...

Again, my client is asking for another piece of functionality from a different plugin, and if I can bring it into the Toolset family, that would be preferred.

There is a plugin called WP Notepad: hidden link

Basically, it allows you to add a "textarea" box to any page, post, custom post type ... it seems like anything ... and any user that is logged in can add notes to that text box specifically on that page/post/etc.

Only they can see the notes that they put there, and they can put notes anywhere there are these text boxes, and the notes stay there.

This website is a learning membership site, so I was thinking that anywhere there are course lessons, or bonus videos, or anything that would benefit from a little private note taking box would be nice.

When text is added to the little note box, it doesn't get saved and blank out ... the content actually stays in the textarea ready to be edited or added to.

My guess is that it is the same textarea, not different textareas, and it associated the current user, the current post, and saves it to the database in order to keep everything organized, and only visible to the right user on the right page.

I'll add some screenshots, so you can see what I mean.

Anyway ... the to-do lists that we're working on now, and this note taking box thing are the last two requests from this client before I can launch, so I figured I'd ask you.

Thanks so much!!

#575151

You may be able to accomplish that with a custom post type like "Note" that is a child of all the other post types. Then you could use a CRED form that allows a User to create a Note attached to any post. If a note already exists by that User for the current post, you will show an Edit CRED form that allows the user to see / edit their existing Note - you can use conditional HTML or a View's "No results found" message for this purpose. How this works with your user roles and permissions may need some investigation, though. I'd recommend creating a separate ticket for this so we can figure out what they should or should not have access to (in the Dashboard, for example) and be sure we have those permissions set up accordingly.

#576246

Christian,

I am trying to complete this functionality today. I'll let you know if I need assistance.

Thanks!

#576267

Christian,

Regarding your comment of:

"This is where you include the Activity form in the Content Template (the same form shows up on all List pages). We can set up that form to automatically know which List is the Activity's parent."

I went to the list post form, and I set it to redirect to the newly created form.

Then, I went to the activity post form, and I added the value of the list parent to [wpv-post-id], so the current post's ID is used as the ID of the parent of this form:

<div class="form-group">
		<label>list Parent</label>
		[cred_field field='_wpcf_belongs_list_id' value='[wpv-post-id]' select_text='--- not set ---' class='form-control' output='bootstrap']
	</div>

Then, I created a content template called "lists and to-dos", and I added the activity form to this content template. I also toggled the checkbox for "Lists" under the usage section on the content template.

Now, in order to get the activity for to show up on every new lists post, I need to add this content template to a layout using layouts where the layout is set to all Lists posts?

Also, is there a way to make this parent field hidden?

Is there another way of doing this, or an I on track?

Thanks!

#576283
Activity.JPG
checklists.JPG

Christian,

I think I covered all the bases with what I need for my client. I have attached a couple screenshots of the final pages.

I was able to hide the parent id field with "display: none" on the parent div.

I have a page called "create checklists". On this page, there is the list cred form. When that is submitted it redirects to the new list post, where I have a content template with the to-dos cred form. I am attaching the content template to each new post with a layout that is assigned to the activity custom post type.

I added a couple extras for user friendliness, like a list of all the checklists on the create checklists page, so my client can go back into those posts to edit them, and add additional to-do items. I also have a big button to send him back to the create checklists page from a single list, so he can add more lists.

I will now attempt to finish this all up with the final user form that allows each individual user to check off their own items on the master list.

More to come!

#576296
cred-user-2.JPG
cred-user-1.JPG

Okay ... I have to stop for right now, so I figure this is a good opportunity to ask a final question before ending this session.

First, I am attaching screenshots of the user cred form I created. There are only 2 options ... "create new user" or "edit existing user" for a user cred form. I assumed "edit existing user" was correct.

Even though I chose "edit", there is a red message at the top stating " This form will auto-generate the password for the new user. In order for the user to receive the password, you need to create a notification which will include that password.
How to create notifications for sending passwords." This might just be an automated message no matter what?

Next, as I mentioned in my previous message, there is no default way to make a custom field hidden in the cred form, so I'll just wrap a div with "display: none" as the style. Is this the correct method?

And lastly, you original message states:

Add a View of child Activity posts and place it on the List page. You can restrict this content to Students. In the View's Loop, include a User CRED Form that includes only a hidden field that contains the Activity ID, and a submit button that says "Done!". When this button is pressed, the CRED form is submitted, and with the help of some custom code and the cred_save_data hook, the current Activity ID is added to a repeating custom field on the current User's profile. I can help you with that if you'd like. Each student that submits the CRED form will then have a reference of that Activity ID stored in their profile.

Next, you can modify the Activity View to use conditional HTML that displays the "Done!" button for each Activity only if the User field doesn't contain that Activity ID. Otherwise, you can show something else like an image of a checkmark to indicate this Activity has been completed, or another button that allows the User to un-check it (another CRED form).

1.) So, in the loop, the user cred from will be duplicated over and over for each to-do item.
2.) I can probably style the "done" button to look like a checkbox?
3.) Upon pressing the button/checkbox the form is submitted .... since this form is duplicated in the loop, do I have to do anything special so the submit button knows which version of the form it is submitting?
4.) "and with the help of some custom code and the cred_save_data hook, the current Activity ID is added to a repeating custom field on the current User's profile." ... so, the repeating activity field I created is blank until we use the "cred_save_data" hook to add data to that field for the specific to-do item in the loop?

I think I am having a bit of trouble wrapping my head around this part. I understand the concept, but I don't know where to start with cred_save_data.

I'll try it out when I get back to it, but if you reply before then, perhaps you can give me a nudge?

Thanks so much. This is the home stretch!

#576612
Screen Shot 2017-10-05 at 11.56.18 AM.png

This might just be an automated message no matter what?
Yes, this is a warning about what happens if you manually change a User's password. You will remove the password field from the form, so this can be disregarded.

I went to the list post form, and I set it to redirect to the newly created form.
Then, I went to the activity post form, and I added the value of the list parent to [wpv-post-id], so the current post's ID is used as the ID of the parent of this form:
Now, in order to get the activity for to show up on every new lists post, I need to add this content template to a layout using layouts where the layout is set to all Lists posts?
Based on your later answers I think these were resolved on your own.

I was able to hide the parent id field with "display: none" on the parent div... Is this the correct method?
Yes, this is the approach I would use.

1.) So, in the loop, the user cred from will be duplicated over and over for each to-do item.
That's correct, you will have the same edit existing User cred form duplicated over and over. Since you pass in the Activity ID, the CRED form knows which Activity to add to the User's profile.

3.) Upon pressing the button/checkbox the form is submitted .... since this form is duplicated in the loop, do I have to do anything special so the submit button knows which version of the form it is submitting?
No you shouldn't, CRED will automatically create unique instances of each form and submitting one will not affect the others.

4.) ... so, the repeating activity field I created is blank until we use the "cred_save_data" hook to add data to that field for the specific to-do item in the loop?
The repeating activity field is cumulative, so if the user has not completed any Activities on any To Do List, then the field will be empty. Each time a new Activity is checked off, a new item is added to this repeating field, and that item will hold the related Activity ID. See the attached screenshot as an example. This User has checked off Activity 123, Activity 124, and Activity 125. The related To-Do list is not important here - we only need to know if the Activities are completed.

I'll try to put together an example cred_save_data function for you, please stand by.

#577044

Thanks Christian,

I'm also going to take a look this weekend.

Cheers!