This support ticket is created 7 years, 11 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.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
Hi I am busy looking at a bit of a complex custom post type. I need some guidance in how to handle it.
This will be for an online advertisement site.
The basics is as follow:
Client will buy a package deal for advertising space. (done via Woocommerce) no problem)
Each package deal will offer a few different options as to the amount of space allocated. This is where my first question comes in.
The 1st package ad1
will allocate eg 1 space
The 2nd package ad2
will allocate eg 2 spaces ETC
The client will load their own add onto the system with a cred form. The spaces availabel to load the jpg adds must be limited by the package they select. With the forms you can select one or multiple instanced of file uploads to be used. Is it possible to limit it to the value that will be determined by the package deal (ad1 or ad2) they select.
Second point as far as i can see you can not user a user as a parent relationship with a custom post type. The problem this creates for me is as follow:
When a client log in i need the client to access their and only their adds so that they can maintain their adds. The problem is that without creating a relationship with a user how will i be able to do that?
My database structure will look something like this:
Data base name (relationship status)
User profile(one to one Advertiser)
Industry (one to many Advertiser)
Advertiser(client) (one to one Classified; one to one Business cards; one to one VIP advertising; one to many Block adds; one to many promotional. The question above will relate to the last two (black adds and promotional)
Classified add ( this be limited to one text based post only)
Business card ( this be limited to one imaged based post only)
Block adds ( this be limited to multiple imaged based post depending on the package deal opted for)
Promotional ( this be limited to multiple imaged based post depending on the package deal opted for)
So what I am hoping to achieve is that then client login with their user, their account details show up for editing purposes and that all the adds loaded show up on one screen.
I am relatively ok with creating the correct types and views etc for this and creating the correct cred forms. My problem is thus:
Showing the correct advertiser account depending on the login details and limiting the amount of adds ( block adds and promotional) depending on the package deal taken.
Hello. Thank you for contacting the Toolset support.
You can use the custom field to set up the limit per package for example field name should be "package_upload_limit" and using CRED form you can update the custom field "package_upload_limit" as per the selected package.
To limit the number of uploads it will require some custom programming where you should have one hidden variable that contains the "package_upload_limit" value and restrict the upload using jQuery or using CRED API validation hook. Please note both require some custom programming.:
Regarding displaying the current logged in user ads - it will be easily done using views and you can filter the view by logged in user or use [wpv-current-user] shortcode to get info about current logged in user.
You may also try to use the different form for the different package. Each Form creates the same Post Type eventually, but would hold different Fields (as example a single instance Media field for Role A and a repeatable instance for Role B)
On Role B CRED forms you apply a Custom CRED API validation to check the repeatable instance is not greater than 5 or any amount of instances.
Also, actually the user should hold a Custom Field, so you can additionally evaluate by this field if the user is allowed to upload more images (after a purchase), otherwise, it will simply keep the Role evaluation and never let the user upload more images.
HI MInesh,
Thanks for your very detailed reply to my inquiry.
If it is ok I would like to keep this thread open for a while while i am busy working through the solution in case I may need further assistance. It way take me a week or two as I am doing this project in between my other projects.
Thx Minesh. I will keep in mind. If it is same topic related i will keep it here but if it is outside the scope of this question i will post a new topic.
My first issue right now is i need to create a relationship between the user post type and a cpt named advertisers. it seems that the challenge is that the one is a custom post type (advertisers) and the other is a system post type, and I can not find a way to create a relationship as there are no system post types available in the linking option.
How do I go about doing that?
I assume that would be necessary to do if i want to do some of the filtering later where the user can only access the company and advertising details allocated to that user .