[Resolved] Limiting User Front End Cred to creating ONE new Custom Post Type

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.

Author
Posts
#1379147

How would I achieve this?:

I would like a PAID USER to be able to Create one "custom post type" - {Member/landing page}

Ex: website.com/MEMBER-LANDING/USERSID

I have Created the custom post type of {Member/Landing Page} as well as the "Field Groups for {member/landing page}"

Ex: website.com/MEMBER-LANDING/BOB

{Field Groups Example}
USERID = BOB
Name = Bob Jones
Email = Bob@bob.com
Phone = 555-555-5555
WEBSITE LINK = affiliate.com/bobslink

After a user registers/Pays for membership they will have access in the back end to the create & Edit Page (I can manage this multiple ways; restrict content pro, toolset access etc)

Website.com/MEMBERS-AREA/home
here:

USER (BOB) CAN EITHER (Ideally this would show either or Create/Edit based on if user had already created post)

<Create New {Member/Landing Page}> | or | <Edit BOB's {Member/Landing Page}>

IF USER (BOB) is [PAID USER]
User should be able to create one *& Only one* of the "Member/Landing Page" post types

Then the User (BOB) Will also require access (CRED) to Edit the 1 (BOB) post {Member/Landing Page} that they created.
(edit access restricted to logged in user - (BOB))

I don't want a user (BOB) to be able to create multiple "Member/Landing page" post types, only to be able to edit the 1 they (BOB) created/purchased.

Ideally I would like the custom post type to expire should the user not pay ongoing Monthly membership *expire 30 days* (or annual membership *expire 356 days*)
If this is possible to automate, I would like to know how. Otherwise worst case I can Manually Cancel/Move to PENDING STATUS when a member expires/doesn't pay

Also USING OCEANWP and Elementor

#1379457

Christian Cox
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

After a user registers/Pays for membership they will have access in the back end to the create & Edit Page
Create New {Member/Landing Page} | or | Edit BOB's {Member/Landing Page}
Hi, the technique to handle this on the front-end of the site is described in the following document, in the first FAQ:
https://toolset.com/documentation/post-relationships/how-to-create-custom-searches-and-relationships-for-users/
Basically you will use a View of Member/Landing Page posts, filtered by post author, where the author is the current User. If a post is found, then you display the "Edit post" link. If no post is found, then you display the "Create post" link instead.
I'm not quite clear from your description if you are trying to implement this conditional also on the backend wp-admin area of the site. Toolset does not provide any limitation on the number of posts that a single User can create on the backend of the site, so that would require custom code.

Ideally I would like the custom post type to expire should the user not pay ongoing Monthly membership *expire 30 days* (or annual membership *expire 356 days*)
If this is possible to automate, I would like to know how.

Let's assume you use WooCommerce Subscriptions to handle recurring membership payments. Post expiration based on Subscription status will require custom code. It could be possible to change the post status when the Subscription expires or is reinstated, using WooCommerce Subscription event hooks and your own PHP to query and edit posts:
https://docs.woocommerce.com/document/subscriptions/develop/action-reference/

Subscription integration features are explained a bit in this document:
https://toolset.com/learn/create-membership-site-wordpress-using-toolset-plugins/how-to-use-the-woocommerce-subscriptions-plugin-with-toolset/

Another ticket includes some code suggestions for a similar request:
https://toolset.com/forums/topic/delete-users-posts-when-woocommerce-subscription-cancels/

#1380249

What about any documentation in regards to easy digital downloads instead of woocommerce. As it is a digital product this may work better for my needs. I have the all access package w all plugins licensed already as well.

And ideas on what custom coding may cost for this simple feature?

#1380337

Shane
Supporter

Languages: English (English )

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

Hi Paula,

Christian is currently on Holiday today but will be back tomorrow to continue this ticket with you.

Thanks,
Shane

#1381097

Christian Cox
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

What about any documentation in regards to easy digital downloads instead of woocommerce.
No, I'm not aware of any special integration with that plugin so we don't have any documentation available. I searched the forum for other tickets related to that plugin:
https://www.google.com/search?q=site%3Atoolset.com+%22easy+digital+downloads%22&oq=site%3Atoolset.com+%22easy+digital+downloads%22
You can scan through those tickets to see issues other Users experienced, and some solutions.

And ideas on what custom coding may cost for this simple feature?
I would estimate the amount of work to be less than a week, but it all depends on the complexity of what you need to achieve on both the front-end and wp-admin area of the site.

#1384489

Is there a way to add a capture form to the landing page (that non logged in users can submit)

that saves the data where landing page (post owner)

can view form data when logged in?

New threads created by Christian Cox and linked to this one are listed below:

https://toolset.com/forums/topic/allow-guest-users-to-submit-form-that-posts-to-landing-page-owner/

#1384663

having issues using the access for non logged in users to create new user. It isn't allowing me to click any of the boxes in this field/area.

however Post Forms Frontend Access is working fine for checking boxes

New threads created by Christian Cox and linked to this one are listed below:

https://toolset.com/forums/topic/unable-to-allow-guest-users-to-submit-new-user-form-with-toolset-access/

#1384975

for anyone viewing this forum, this code worked to delete the custom post when i made a plugin with (puginception -free plugin creator) and pasted the code below (simply set your woocommerce subscription role to customer when canceled (or replace code with applicable role) and post type "YOURPOSTTYPEHERE" member was the name of the custom post type in this scenario

add_action( 'set_user_role', 'delete_customer_posts', 10, 2 );
function delete_customer_posts( $user_id, $role ) {

if ( 'customer' == $role ) {

$args = array(
'numberposts' => -1,
'author' => $user_id,
'post_type' => 'member',

);

$expired_member_posts = get_posts( $args );
foreach( $expired_member_posts as $postid ) {

wp_delete_post( $postid->ID );

}
}
}

#1385235

Christian Cox
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

I have split those two new questions into separate tickets so we can keep this ticket focused on the original issue, which is limiting the User to creating only one post in a specific post type with Forms.