WordPress.org

Make WordPress Core

Ticket #11684: comment-moderation.2.patch

File comment-moderation.2.patch, 918 bytes (added by miqrogroove, 8 years ago)
  • comment.php

     
    4545        if ( 1 == get_option('comment_moderation') )
    4646                return false; // If moderation is set to manual
    4747
    48         if ( get_option('comment_max_links') && preg_match_all("/<[Aa][^>]*[Hh][Rr][Ee][Ff]=['\"]([^\"'>]+)[^>]*>/", apply_filters('comment_text',$comment), $out) >= get_option('comment_max_links') )
    49                 return false; // Check # of external links
     48        // Check # of external links
     49        if ( get_option('comment_max_links') ) {
     50                $links = preg_match_all("/<[Aa][^>]*[Hh][Rr][Ee][Ff]=['\"]([^\"'>]+)[^>]*>/", apply_filters('comment_text',$comment), $out);
     51                if ( 0 != strlen($url) )
     52                        $links += 1;
     53                if ( $links >= get_option('comment_max_links') )
     54                        return false;
     55        }
    5056
    5157        $mod_keys = trim(get_option('moderation_keys'));
    5258        if ( !empty($mod_keys) ) {