Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Spam has gotten a bit crazy so it would be nice if new users have to wait a week to post something.

I use buddypress and all new members have the role of author. The site is more like a forum with one topic. I'm not worried about comments, just posts.

I'm totally fine with messing with the innards of wordpress. A plugin would be ideal but I am open to any suggestions.

Thanks, John Powell

share|improve this question

1 Answer 1

There won't be a plugin for that, so I wrote one. You can use it as plugin or (better) a mu-plugin (place in your /wp-content/mu-plugins folder).

Mu-Plugin: delay the possibility to publish a post by removing the meta box

<?php
/**
 * Plugin Name: Delay post publishing
 * Plugin URI: http://unserkaiser.com
 * Description: Only allows publishing a post if the user registered one week ago. 
 * Version: 0.1
 * Author: Franz Josef Kaiser
 * Author URI: http://unserkaiser.com
 */
// Not a WordPress context? Stop. Why? Ask @toscho
! defined( 'ABSPATH' ) AND exit;

// Only run this for new "post"-post_type admin UI screens
if ( ! is_admin() AND 'post-new.php' !== $GLOBALS['typenow'] ) return;

function debug_user() 
{
    // User data as object
    $curr_user = get_user_by( 'id', get_current_user_id() );

    // get time/date and format as UNIX timestamp
    $reg_date  = abs( strtotime( $curr_user->user_registered ) );
    $curr_date = abs( strtotime( current_time( 'mysql' ) ) );

    // Human readable difference
    $diff       = human_time_diff( $reg_date, $curr_date );
    $diff_array = explode( ' ', $diff );

    // Remove if we're on the 1st day (diff result is mins/hours)
    if ( 
        strstr( $diff_array[1], 'mins' )
        OR  strstr( $diff_array[1], 'hours' )
    )
        return remove_meta_box( 'submitdiv', null, 'side' );

    // Remove if we're below or equal to 7 days (1 week)
    if ( 7 >= $diff_array[0] )
        return remove_meta_box( 'submitdiv', null, 'side' );
}
add_action( 'add_meta_boxes', 'debug_user', 20 );

Further updates for this plugin can be found in this Gist.

Can also be found in the WPSE plugin repository.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.