Skip Navigation

[Resolved] Connecting users with custom post types

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

Supporter timezone: America/Jamaica (GMT-05:00)

Tagged: 

This topic contains 7 replies, has 2 voices.

Last updated by Shane 5 years, 3 months ago.

Assisted by: Shane.

Author
Posts
#1362181

Tell us what you are trying to do?
When a Woocommerce account is created, a new user (subscriber) is created. We would like to connect that subscriber to other post types. For example, we would like the subscriber to be connected to the customer post type that has their email, address, etc.
Is there any documentation that you are following?

Is there a similar example that we can see?

What is the link to your site?
hidden link

#1362211

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hello,

Thank you for contacting our support forum.

Actually what you can do is to create a profile CPT for your users, then add the appropriate fields to this CPT.

When the user creates their account you can then redirect them to a page that would have the frontend form that will allow them to create their profiles.

This will then tie the user to this profile.

Please let me know if this helps.

Thanks,
Shane

#1362957

Doesn't this mean that all the data that they input would then need to be re-input for the Customer Profile CPT? The way it is now, when a new person subscribes to a service plan, they have to input name, address, phone, email, etc. This is needed for Woocommerce. Can we have a one to one relationship from the Woocommerce user to the customer profile that we made in Toolset.

We have a test site set up if you need to look at it to walk me through this.
Thanks Shane!

#1362963

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hello,

Given that the user fills out these fields when signing up "name, address, phone, email, etc" they will be stored on the user itself, so you can retrieve it from the user that way.

"Can we have a one to one relationship from the Woocommerce user to the customer profile that we made in Toolset."

A user is related to a post/page by them being the author of the post. So if they created the post then they will be related to it through the author option.

Now on this profile page I would recommend having other additional information that they would not normally fill in when they are creating their user, as this information from their actual user profiles can still be retrieved on the frontend.

Thanks,
Shane

#1363053

We have a Woocommerce site where client subscribes to a maintenance agreement. I can see where their profile info can be populated by the user metadata. The service agreement is to maintain home appliances. So one CPT would be unit specifics (appliances), another CPT would be service history, another might be location specifics. We would like a service technician (not the customer who bought the maintenance subscription) to be able to view all the accounts (including service history etc) of all the customers and their appliances, but each customer should only be able to see their own appliance/location/profile info.
From what you have described it seems like the service tech would have to be logged into that client's account to create a post with service history that stays connected to that client's user account. Is this technician/client scenerio possible and can you give us some guidance on how to go about this?

#1363581

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hello,

Thank you for the clarity on this.

Ok so how i'm seeing this is that the customer would have to create their profiles on CPT. Its quite possible that we can get their information from the woocommerce fields to autopopulate the profile fields.

Then you can have another CPT called service log where the technician can create a service log. Now the Service log and Profile CPT will be in a Parent/Child relationship. Preferably a One to One relationships so a service log is tied to only one customer.

The technicians will be able to create their service log and add a customer to that service log. You can use our Access plugin to ensure that the users can only see their own profiles.

On the frontend you will need to create a view for them and add it to their profiles so that they can see the service logs that are attached to there profile.

So the ideal thing to do is that allow them to create a profile, that would atleast have the basic information that the technicians would need.

Please let me know what you think of this.

Thanks,
Shane

#1363719

"Its quite possible that we can get their information from the woocommerce fields to autopopulate the profile fields." Can you link me to instructions on how to do this part? Our Woocommerce shop is already built.

#1363723

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Screenshot 2019-10-17 at 1.12.24 PM.png

Hello,

Well there isn't an instruction on how to transfer the data but, when you allow the user to create the post on the frontend form for their profiles you will need to edit the form in Expert mode.

The best thing to do is to set the title of the post to the user's name.

So example how you will transfer there name to this field is by doing this.


<div class="form-group">
		<label>Post Title</label>
		[cred_field field='post_title' value="[wpv-user field='billing_first_name']" urlparam='' class='form-control' output='bootstrap']
	</div>

Where you have the value attribute you will insert [wpv-user field='billing_first_name'] this will enter the value into the post title.

Secondly if you want to copy over the additional billing information such as Company, Address etc you will need to create matching custom fields in types and then populate these like the example above using the value attribute.

To find the correct name of the fields to place in the [wpv-user] shortcode you will need to inspect the field element on a users profile to find the correct field name. See Screenshot

This shows you the correct field name for the zip code field.

Please let me know if this helps.
Thanks,
Shane