• Pete

    (@perthmetro)


    I’d like someone to make me (or point me in the direction of) a plugin that sets a maximum number of posts a user can post. That is, limit the number of posts a user/author can make.

    Ideally this would be able to be determined both individually and also integrated with Role Manager so that i could make up a new Group and assign that group a set number of posts.

    Also… it would ideally be that I could limit the number of posts per user for certain categories.

    Would anyone be interested in making this plugin for me/wordpress… I’ll pay if needed.

Viewing 15 replies - 1 through 15 (of 18 total)
  • Samuel B

    (@samboll)

    Thread Starter Pete

    (@perthmetro)

    Are you saying we aren’t allowed to post job requests or just giving me another choice?

    I’d like to know as well. Isn’t there a setting for this somewhere?

    I’m using a slightly modified version of WordPress for a specific purpose that requires a limit of one post per user.

    That shouldn’t be too hard, right? One line of PHP that turns off the user ability to post (not to edit) when the number of posts counts hit 1 (or whatever)!

    Which database fields should I focus on? Where would I have to edit the code? What would the PHP look like?

    I’m not a PHP coder, but which some pointers I should be able to put this together. ??

    This is an old topic but I am also looking for something like this.

    Does anyone already have a solution for this?

    Hi,

    Did anyone find a solution for this?

    I’ll put my name down for this one too… curious if and when anyone comes up with this, as I’ve been looking for it forever now too.

    Yes, we NEED this!! Maybe it is present in WordPress MU?

    Add me to the list!

    Respuesta en castellano-latino:

    Para limitar la cantidad de post de todos los usuarios a, digamos N posts yo hice lo siguiente:

    Modifique el archivo post-new.php de esta forma:

    <?php
    /**
    * New Post Administration Panel.
    *
    * @package WordPress
    * @subpackage Administration
    */

    /** Load WordPress Administration Bootstrap */
    require_once(‘admin.php’);
    $title = __(‘Add New Post’);
    $parent_file = ‘edit.php’;
    $editing = true;
    wp_enqueue_script(‘autosave’);
    wp_enqueue_script(‘post’);
    if ( user_can_richedit() )
    wp_enqueue_script(‘editor’);
    add_thickbox();
    wp_enqueue_script(‘media-upload’);
    wp_enqueue_script(‘word-count’);

    if ( ! current_user_can(‘edit_posts’) ) {
    require_once (‘./admin-header.php’); ?>
    <div class=”wrap”>
    <p><?php printf(__(‘Since you’re a newcomer, you’ll have to wait for an admin to add the edit_posts capability to your user, in order to be authorized to post.
    You can also e-mail the admin to ask for a promotion.
    When you’re promoted, just reload this page and you’ll be able to blog. :)’), get_option(‘admin_email’)); ?>
    </p>
    </div>
    <?php
    include(‘admin-footer.php’);
    exit();
    }
    //limitar la cantidad a N posts
    $N = 20; max 20 posts por usuario
    $count_posts = count(get_posts(array(‘author’=>$user_ID)));// retorna la cantidad de post escritos por el usuario correspondiente a $user_ID
    if ($count_posts >= N){
    Header(“Location: index.php”);//redirecciona al dashboard, en donde deberia indicarle al usuario que no puede crear un nuevo post
    }
    //fin de la modificacion

    // Show post form.
    $post = get_default_post_to_edit();
    include(‘edit-form-advanced.php’);

    include(‘admin-footer.php’);
    ?>

    Para poder limitar los posts por cada usuario seria necesario cambiar el N del codigo anterior por un campo especifico que pertenezca a cada usuario…
    Estoy trabajando en ello…

    hey, if anyone could translate this into english, that would be awesome!
    cheers!

    Im looking for the exact same thing.

    i want to make a new role using “Capability Manager” and then select the role and be able to chose how many max posts that role can have and also be able to auto default a category just for that role.

    so all “submiters” will be able to submit 1 post and it auto goes into 1 category and they can only edit that one post.

    i have been looking and need this bad!

    @levislibra post translation:

    So you can limit the number of posts of all users, to let’s say N posts, I did this:

    I edited the file post-new.php this way:

    <?php
    /**
    * New Post Administration Panel.
    *
    * @package WordPress
    * @subpackage Administration
    */
    
    /** Load WordPress Administration Bootstrap */
    require_once('admin.php');
    $title = __('Add New Post');
    $parent_file = 'edit.php';
    $editing = true;
    wp_enqueue_script('autosave');
    wp_enqueue_script('post');
    if ( user_can_richedit() )
    wp_enqueue_script('editor');
    add_thickbox();
    wp_enqueue_script('media-upload');
    wp_enqueue_script('word-count');
    
    if ( ! current_user_can('edit_posts') ) {
    require_once ('./admin-header.php'); ?>
    <div class="wrap">
    <p><?php printf(__('Since you’re a newcomer, you’ll have to wait for an admin to add the edit_posts capability to your user, in order to be authorized to post.
    You can also e-mail the admin to ask for a promotion.
    When you’re promoted, just reload this page and you’ll be able to blog. :)'), get_option('admin_email')); ?>
    </p>
    </div>
    <?php
    include('admin-footer.php');
    exit();
    }
    //limit the quantity to N posts
    $N = 20; max 20 posts por usuario
    $count_posts = count(get_posts(array('author'=>$user_ID)));// returns the quantity of written posts by current user to $user_ID
    if ($count_posts >= N){
    Header("Location: index.php");//redirects to dashboard, where it should point the user that he cannot create a new post
    }
    //end of modification
    
    // Show post form.
    $post = get_default_post_to_edit();
    include('edit-form-advanced.php');
    
    include('admin-footer.php');
    ?>

    To limit different number of posts for each user, it would be needed to change the N in the above code to an specific field that would belong to each user…
    I am working on that…

    i just tried that and go syntax error

    Parse error: syntax error, unexpected T_LNUMBER in /home/content/g/i/r/girlsgoneweed/html/_sites/nextpotmodel/wp-admin/post-new.php on line 36

    and… it would be best if the “ADD NEW” link would go away once reached max posts allowed.

    line 36:
    $N = 20; max 20 posts por usuario
    remplace:
    $N = 20; //max 20 posts por usuario

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘Limit the number of posts a user can make’ is closed to new replies.