BuddyDev

Search

How to limit the number of post a user can publish per day to one

  • Participant
    Level: Guru
    Posts: 900
    Tosin on #24993

    Hello,

    Please I use this plugin (https://wordpress.org/plugins/accesspress-anonymous-post/) for front end publishing. how can I restrict/limit logged in users to publish only blog post per day. Each logged in user should not be able to post more than one blog post entry per day using the Frontend Post Plugin.

    Thanks

  • Keymaster
    (BuddyDev Team)
    Posts: 24706
    Brajesh Singh on #24994

    Hi Tosin,
    This is a 3rd party plugin.
    Please connect with the plugin author for assistance with it.

    Regards
    Brajesh

  • Participant
    Level: Guru
    Posts: 900
    Tosin on #24998

    I found this code and was wondering if it can be modified to work with (https://wordpress.org/plugins/accesspress-anonymous-post/)

     /**
    * Limit User to One Submission Per Time Period
    * http://gravitywiz.com/2012/04/25/limit-user-to-one-submission-per-time-period/
    */
    
    // update the "5" to your form ID
    add_action('gform_pre_render_5', 'gform_limit_submissions');
    function gform_limit_submissions($form){
        global $wpdb;
        
        $limit_message = 'You may only submit this form once every 24 hours.';
        $limit_time = 86400; // must be specified in seconds; 86400 seconds is equal to 24 hours
        
        /* You do not need to edit below this line */
        
        $current_user = wp_get_current_user();
        $last_submission = $wpdb->get_var($wpdb->prepare("SELECT date_created FROM {$wpdb->prefix}rg_lead WHERE created_by = %d and form_id = %d ORDER BY date_created DESC", $current_user->ID, $form['id']));
        
        if(empty($last_submission))
            return $form;
        
        $time_out = strtotime($last_submission) + $limit_time;
        $current_time = time();
        
        if($current_time > $time_out)
            return $form;
        
        $is_submit = rgpost("is_submit_{$form['id']}");
        
        if(!$is_submit) {
            add_filter('gform_get_form_filter', create_function('', "return '<div class=\"limit-message\">$limit_message</div>';") );
        }
        
        return $form; 
    } 

    I got this code from https://gravitywiz.com/limit-user-to-one-submission-per-time-period/

  • Keymaster
    (BuddyDev Team)
    Posts: 24706
    Brajesh Singh on #25012

    Hi Tosin,
    I am sorry. This involves the plugins which we do not use or don’t have any affiliation.

    That’s why we are unable to support you. We can support any plugin but that takes time and within our free support, we are unable to do that.

    I suggested asking the plugin developer as they have interest in supporting their plugins. That will save you time and cost.

    For any 3rd party code(except BuddyPress, bbPress which we support for free here), Please feel free to use our custom services.

    https://buddydev.com/services/

    Regards
    Brajesh

You must be logged in to reply to this topic.

This topic is: not resolved