Skip Navigation

[Resolved] What type of custom fields to use for online course – user fields? post fields?

This thread is resolved. Here is a description of the problem and solution.

Problem:

Which kind of custom field should I choose? User field or Post field?

Solution:

If you are going to setup search form and query the users by those field, I suggest you try these:

https://toolset.com/forums/topic/what-type-of-custom-fields-to-use-for-online-course-user-fields-post-fields/#post-1759989

Relevant Documentation:

https://toolset.com/documentation/post-relationships/how-to-create-custom-searches-and-relationships-for-users/

This support ticket is created 4 years, 6 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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 5 replies, has 2 voices.

Last updated by GamX 4 years, 5 months ago.

Assisted by: Luo Yang.

Author
Posts
#1759547

I'm building an online course and using Toolset to provide the user with choices, mostly via radio buttons: do you turn left or right at the fork? which potion do you get from the wizard? what personality trait do you like best? what is the answer to this quiz question?

I'm then using Toolset conditional statements to show different things to the user - sometimes a different storyline, sometimes mixed with field values that they have already submitted.

One course may have 50 custom fields answered differently by each user, who are only able to see their own answers (they are not able to see data submitted by other users). I will eventually have 50 courses which would be 2500 user fields per person unless I share some fields across courses (which I may want to do in some cases).

I'm using LearnDash as my LMS, which relies on custom post types for its courses and lessons within each course. In some ways it is a membership site as people need to register in order to take a course... but I'm doing so much more than just collecting registration data with user fields, and I want to make sure I'm on the right track.

1. Am I using the correct approach by using Toolset to make all of these fields that I describe above Custom User Fields? Or is there some other Toolset type I should use instead... I don't know, maybe a post-field that is associated with the current user somehow?

2. If the answer is to use Custom User Fields like I'm already doing... would I be able to use Toolset to create a new admin view of the user profile which only has a subset of the user fields in my view/edit window? I am also using other tools to create other user fields like badges and points, so it is an overwhelming amount of info in the default wordpress user profile screen.

Thank you for any advice!

#1759989

Hello,

Q1) If you are going to setup search form and query the users by those field, I suggest you try these:
1) Create a custom post type "Member", each user can have only one "Member" post
2) setup those field you mentioned above as post fields of post type "Member"
3) Setup many-to-many relationship between post types "courses and lessons" and "Member"

See our document:
https://toolset.com/documentation/post-relationships/how-to-create-custom-searches-and-relationships-for-users/

If you don't need to search user by those fields, then custom user field is good enough.

Q2) It seems you are going to setup search form on those fields, so you will need to consider the answer Q1), since user view does not support custom search form yet.

#1760813

Thanks Luo, I am attempting to follow your advice for Q1 above (will have to get that working before trying Q2).

Q1)
1) I created a custom post type "Player" (instead of "Member")
2) I created 2 custom post fields of post type "Player"
a) First Name (single line text)
b) Job (radio with 3 options)
3) I set up many-to-many relationships between post types "courses and lessons" and "Player"

Then I created a form with those 2 custom post fields. At first I chose "Edit existing content" for the form type. But when I went to one of my Lessons (a custom post type) and used the gutenberg visual editor to insert this Toolset form... then viewed it on the front end... I got this error: "Form type and post type do not match"

So I went back to the form settings and changed the form type to "Add New Content" - then I went back to view the form on the front end. This time I did not get an error, but I only see the field labels that I added:
First Name
Job
I also see a submit button. But there is no place for me to type in the text for the text field (first name) and no options to select for the radio field (Job).

But the WYSIWYG editor shows both the form labels and the places to input and submit the form.

FORM CODE
[credform]
<div class="form-group">
<label>First Name</label>
[cred_field field='player-first-name' class='form-control' output='bootstrap']
</div>
<div class="form-group">
<label>Job</label>
[cred_field field='player-job' class='form-control' output='bootstrap']
</div>
[cred_field field='form_submit' output='bootstrap' value='Submit' class='btn btn-primary btn-lg']
[/credform]

Please advise... thank you!

#1760837

Update... I still get the above error when I select "Edit" as the form type. But when I switch it over to "Add new" I am now able to see the form and add text to the First Name field, and select a radio button for the Job field. But when I click submit, the page refreshes and the values I entered disappear. I had selected "Keep displaying this form" in the form settings, and the form itself remains. But the refreshed form is blank as if it doesn't know that the values I just submitted should be associated with me.

I've been using the custom User Fields and User Forms... is there something different I have to do when using Post Fields and Post Forms to associate it with the "current user"?

Just to clarify: My "players" (custom post type to hold additional user data that up until now I have been holding in the user metadata table) will not be writing posts. In various "lessons" (a custom post type that has been associated as a many<->many relationship with players), users/players will only be entering values for custom fields that are later used for conditional statements and paragraphs that have embedded field values.

#1762059

I assume you are going to edit current user's "Player" post, you can follow our document to display the edit form link in "Player" post content:
https://toolset.com/course-lesson/front-end-forms-for-editing-content/

#1763835

I will table this for now and re-open ticket if needed. Thanks!