Skip Navigation

[Resolved] Restrict number of posts per user

This support ticket is created 3 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.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 5 replies, has 2 voices.

Last updated by Christian Cox 3 years, 10 months ago.

Assisted by: Christian Cox.

Author
Posts
#1897931

Hi,

Is it possible to restrict how many posts a user can post?

Thanks

#1897985

Not exactly, there's no built-in setting to limit the number of posts a User can create. There are some creative ways to work around that and enforce such a limit. For example, if you only want to allow a User to create one single post in a specific custom post type, you can use a View to act like a conditional. Set up a View of the custom post type and filter it by post author, where the post author is the same as the current logged-in User. If the View finds no results, you can display the Create Post Form for that post type.

If you want to allow more than one post per post type per User, you could use a custom field on the User Profile to store a number representing the number of remaining posts they can create. Use the CRED API to decrement that field value each time a new post is created using Forms. Use a conditional on the front-end of the site that checks the value of the User's custom field to determine whether or not they have any remaining posts available. If so, show the Form to create posts. If not, hide the Form.

Let me know if you would like to discuss any specific workaround here, and I can give you more feedback.

#1898379

Thank you Christian,

I will check the links

ps. How do I make my support tickets private? Not in a forum I mean

#1900191

ps. How do I make my support tickets private? Not in a forum I mean
If a supporter is available for chat when you create a ticket, a private chat session will be initiated. However, chat is not always available when our queue is busy. If chat is not available, there is no backup private support system. The fallback is our standard support forum, but there are no private support tickets. A supporter can activate private fields within a public ticket so you can share private information if necessary, like logins or server information. We also have a privacy feature that automatically hides any URL you share in the forum so that it is only visible to yourself and other supporters.

If you have more questions about privacy in support, feel free to open a separate ticket so we can discuss in more detail.

#1901333

I am sorry

"Set up a View of the custom post type and filter it by post author, where the post author is the same as the current logged-in User. If the View finds no results, you can display the Create Post Form for that post type."

Where do I look for that? How do I set this view, could you please send me the steps of add a video, I am sorry for the trouble

#1901449
Screen Shot 2021-01-11 at 10.56.59 AM.png

How do I set this view, could you please send me the steps of add a video
Some basic instructions for creating a View with a filter:
https://toolset.com/course-lesson/creating-a-view/
https://toolset.com/course-lesson/creating-a-view/#filter-the-list-of-posts
Please review the video and the instructions for adding a filter before you begin creating the View. Let us assume you have a custom post type called Books and you want to allow your site visitors to create only one Book post, using front-end Forms. You will create a View of the Books custom post type, and add a Post Author filter, where the post author is the same as the current logged-in User. Do not add any blocks or content inside the View's loop. The idea is that Users who have already created a Book post will see nothing here.

If the View finds no results, you can display the Create Post Form for that post type.
By default, a View will display a message like "No items found" when no results are found. You will replace that message with a Form shortcode to display the Create Post Form. See the screenshot for more information about how to edit this message in the View block editor. You must select the View Loop block to find the correct settings panel in the View editor. Delete everything inside the "No Items Found Text" input field, then insert your Form in the input using a shortcode.

A typical Form shortcode to display a Create Post Form looks like one of these:

//Display the form "Create Car"
[cred_form form="Create Car"]
 
//Display form with numeric ID 120
[cred_form form="120"]

You can find the numeric ID of each Form in Toolset > Post Forms.

I am sorry for the trouble
No trouble, I'm glad to help 🙂