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;
add_action('template_redirect', 'cp_limit_pending_ads');
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;
There are currently 1 users browsing this thread. (0 members and 1 guests)