• Resolved infinitelinx

    (@infinitelinx)


    Hi there, I just installed this plugin and it’s great. I’m looking to create a form with it that limits 10 form entries per logged in user per month. If they’ve used all 10 entries before the month is up then they cannot submit the form. Once the month is over, the entry resets and they can submit another 10 for the month. If anything, just the per user would be good and I can find a plugin to auto delete all entries every month. Please advise. Much appreciated.

Viewing 1 replies (of 1 total)
  • Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @infinitelinx

    You can try using the action hook um_submit_form_profile to catch the post submission. And then use the method UM()->form()->add_error( ) to add the error notice to prevent the form from being saved.

    e.g.

    add_action('um_submit_form_profile','um_011120_custom_profile_validation',5 ); 
    function um_011120_custom_profile_validation( $args )
      $current_user_id = get_current_user_id();
      $max_post_limit = 10;
      $user_posts = "Insert your database query or function to retrieve the user post by ID {$current_user_id}";
      if( $user_posts >= $max_post_limit ){
         UM()->form()->add_error( 'sample_post_title_key', 'You have exceeded the maximum posting rate per month' );.
      }
    
    }
    

    The above is somewhat pseudocode to help you improve it.

    Regards,

Viewing 1 replies (of 1 total)
  • The topic ‘Form Entry Limit Per User Per Month’ is closed to new replies.