Skip Navigation

[Resolved] Make a custom post type related to a user account

This support ticket is created 6 years, 8 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)

This topic contains 4 replies, has 2 voices.

Last updated by henrikG 6 years, 7 months ago.

Assisted by: Shane.

Author
Posts
#552685

Hi.

I know this is not possible right now because user accounts cant be related to a custom post type.

But this is what I have to do.

I will be creating an Invoice custom post type, where each invoice has a URL field to a PDF invoice.
But this invoice should only be shown for the user for whom the invoice is for.

So somehow I need to be able to link a custom post type record to a user account, and create a view which lists the invoices for the current logged in user.

Do you have any suggestions on how to achieve this?

Kind Regards

Henrik

#552742

Shane
Supporter

Languages: English (English )

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

Hi Henri,

Thank you for contacting our support forum.

I have an idea that can work. Why not have a custom field on the invoice cpt that stores the ID of the user it is for. I'm not sure how the invoice is generated but you can add the id in the custom field.

Then you can create a view and filter that view based on the ID field.

Please let me know if this helps.
Thanks,
Shane

#554209

Hi Shane

This is exactly how I will solve this, but perhaps you should consider taking user relations into account as well while you are working on the improved post relationship features in types.

I know user accounts are treated differently than posttypes, but you will open up the possibilities more if you are able to link data to an user account.

#554760

Shane
Supporter

Languages: English (English )

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

Hi Henrik,

I could mention this to our team but for now the best solution is as mentioned using a custom field and doing the link manually.

Thanks,
Shane

#556034

Ok I will do by having a field with the user-ID in it for now.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.