Aleš Sýkora wrote

Limit Toolset Form to one submission per user only

25. 6. 2021 in

The easiest way to enable user submit only one post is to hide the form when they already submitted it. So you need to count the number of posts user created and if it is more than 1 then with conditional hide the form.

  1. Check the number of posts user created with custom function
 *Count posts of given type, so each user can create post only once
function twiki_post_count() {
    $your_current_user_id = get_current_user_id();
    return count_user_posts( $your_current_user_id , "your-post-type-slug" , false );

3. Add function twiki_post_count then need to be added to Toolset > Settings > Front End Content > Functions inside conditional evaluations:

Adding function to be used in conditionals in Toolset

4. Then use conditional to restrict the content

[wpv-conditional if="( twiki_post_count() lt '1' )"]
 This user can add this post type currently. Toolset form will be displayed.

You can also use this function in Oxygen Builder custom conditional PHP function value (without need to adding in toolset setting).

2 comments on “Limit Toolset Form to one submission per user only”

  1. Hello, it is not working for me, it still shows the form.
    [wpv-conditional if=”( twiki_post_count() lt ‘1’ )”]

    is there a capital letter there?

    1. Hello Gabriel, are u using the right Quotes? Did you followed all steps? Point 3 is needed, do not forget!

      However, you can try if the function itself works with php. Add following code in PHP to your page:

      echo twiki_post_count();

      It should return the number of posts. If that works, then problem is something else. But I suggest to start with this test.

      regards, Aleš

Leave a Reply to Gabriel Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

More from category
Aleš Sýkora wrote
Fluent Forms activation – You do not have sufficient permissions to access this page.
25. 3. 2021 in
If you got “You do not have sufficient permissions to access this page.” error when you click on activation of Fluent Forms Pro licence, you need to go to the integration modules settings of Fluent Forms plugin and activate the plugin from there.
Read More
Aleš Sýkora wrote
Custom SCROLLBAR with Oxygen Builder
7. 12. 2020 in ,
Are you looking for some cool scroollbar, like on CSS-Tricks website? for a specific DIV use this in your custom CSS: for a whole document use body instead.
Read More
Aleš Sýkora wrote
Custom Taxonomy Term Archive Query in Oxygen Builder
If you want to use advanced query builder and build the template for All taxonomy terms of one taxonomy and do not use the default query in repeater, you can do that with advanced query builder: Post_type = post type slug tax_query = array taxonomy = taxonomy slug field = slug terms = (optional) no_found_rows […]
Read More
magnifiercross linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram