Results 1 to 3 of 3

Thread: More spam fighting...

  1. #1
    Thread Starter
    Rookie rustynations's Avatar
    Join Date
    Jul 2010
    Location
    United States
    Posts
    7
    Thanks
    4
    Thanked 0 Times in 0 Posts

    More spam fighting...

    As IP address blocking is a constantly moving target... and can take a toll on speed and resources... I've taken another step.

    I've decided to block users from posting an ad if they have an ad pending.
    PHP Code:
    if ( ! function_exists('cp_limit_pending_ads' ) ) :
        function 
    cp_limit_pending_ads()    {
            global 
    $app_abbr,$current_user;
            if (
    is_page(get_option($app_abbr.'_add_new_url'))):
                    
    $query = array(
                        
    'post_type' => APP_POST_TYPE,
                        
    'author' => $current_user->ID,
                        
    'post_status' => array( 'pending')    
                    );
                    
    $the_query = new WP_Query$query );
                        if(
    $the_query->have_posts()) :
                            
    wp_redirect(CP_DASHBOARD_URL.'?msg=p');
                        endif;
                    
    wp_reset_query();
            endif;
        }
    endif; 
    I'm calling it from a plugin myself using:
    PHP Code:
    add_action('template_redirect''cp_limit_pending_ads'); 
    But it would be easy enough to add to the top of the tpl-add-new.php file and drop a couple of "if" statements.

    My tpl-dashboard.php file has a line added:
    PHP Code:
    if($_GET['msg']=='p') :
        
    $action_msg __('<strong>You have at least one ad pending. You cannot post any addtional ads until all pending ads are approved. Please check your ads below.</strong>''appthemes');
    endif; 
    I envision that this could be integrated into the admin so you could set the number of pending ads... change the message... whatever. But I literally had to hack this together in a few minutes based on a client's request. I would appreciate any comments (as well as any obvious flaws in my logic...).

  2. #2
    8dee's Avatar
    Join Date
    Jul 2010
    Location
    Denmark
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  3. #3
    Member anilkumarkanneboina's Avatar
    Join Date
    Mar 2012
    Location
    India
    Posts
    82
    Thanks
    8
    Thanked 2 Times in 2 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. SPAM! Being flooded with spam accounts and posts.
    By ldesp in forum ClassiPress General Discussion
    Replies: 45
    Last Post: July 16th, 2014, 01:54 PM
  2. Spam signups are ridiculous. Any GOOD anti-spam solutions?
    By mathmoose in forum ClassiPress General Discussion
    Replies: 64
    Last Post: August 8th, 2013, 11:05 PM
  3. You got SPAM
    By nicknolting in forum Report JobRoller Bugs
    Replies: 1
    Last Post: December 21st, 2010, 07:43 PM
  4. Please don't consider this spam
    By sarge in forum ClassiPress General Discussion
    Replies: 0
    Last Post: February 22nd, 2010, 07:46 PM