Changeset 48140
- Timestamp:
- 06/23/2020 01:51:03 PM (4 years ago)
- Location:
- trunk/src/wp-includes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/comment-template.php
r48133 r48140 1331 1331 * 1332 1332 * @since 1.5.0 1333 * @since 5.5.0 Removed the need to use the $user_ID global.1334 1333 * 1335 1334 * @global WP_Query $wp_query WordPress Query object. … … 1397 1396 } 1398 1397 1399 $include_unapproved = wp_get_include_unapproved_comments_argument(); 1400 if ( $include_unapproved ) { 1401 $comment_args['include_unapproved'] = $include_unapproved; 1398 if ( is_user_logged_in() ) { 1399 $comment_args['include_unapproved'] = array( get_current_user_id() ); 1400 } else { 1401 $unapproved_email = wp_get_unapproved_comment_author_email(); 1402 1403 if ( $unapproved_email ) { 1404 $comment_args['include_unapproved'] = array( $unapproved_email ); 1405 } 1402 1406 } 1403 1407 … … 2098 2102 2099 2103 if ( is_user_logged_in() ) { 2100 $comment_args['include_unapproved'] = get_current_user_id();2104 $comment_args['include_unapproved'] = array( get_current_user_id() ); 2101 2105 } else { 2102 2106 $unapproved_email = wp_get_unapproved_comment_author_email(); -
trunk/src/wp-includes/comment.php
r48133 r48140 1055 1055 * @param array $args { 1056 1056 * Array of optional arguments. 1057 * @type string $type Limit paginated comments to those matching a given type. Accepts 'comment', 1058 * 'trackback', 'pingback', 'pings' (trackbacks and pingbacks), or 'all'. 1059 * Default is 'all'. 1060 * @type int $per_page Per-page count to use when calculating pagination. Defaults to the value of the 1061 * 'comments_per_page' option. 1062 * @type int|string $max_depth If greater than 1, comment page will be determined for the top-level parent of 1063 * `$comment_ID`. Defaults to the value of the 'thread_comments_depth' option. 1057 * @type string $type Limit paginated comments to those matching a given type. 1058 * Accepts 'comment', 'trackback', 'pingback', 'pings' 1059 * (trackbacks and pingbacks), or 'all'. Default 'all'. 1060 * @type int $per_page Per-page count to use when calculating pagination. 1061 * Defaults to the value of the 'comments_per_page' option. 1062 * @type int|string $max_depth If greater than 1, comment page will be determined 1063 * for the top-level parent `$comment_ID`. 1064 * Defaults to the value of the 'thread_comments_depth' option. 1064 1065 * } * 1065 1066 * @return int|null Comment page number or null on error. … … 1133 1134 ); 1134 1135 1135 $include_unapproved = wp_get_include_unapproved_comments_argument(); 1136 if ( $include_unapproved ) { 1137 $comment_args['include_unapproved'] = $include_unapproved; 1136 if ( is_user_logged_in() ) { 1137 $comment_args['include_unapproved'] = array( get_current_user_id() ); 1138 } else { 1139 $unapproved_email = wp_get_unapproved_comment_author_email(); 1140 1141 if ( $unapproved_email ) { 1142 $comment_args['include_unapproved'] = array( $unapproved_email ); 1143 } 1138 1144 } 1139 1145 … … 1148 1154 * Array of WP_Comment_Query arguments. 1149 1155 * 1150 * @type string $type Limit paginated comments to those matching a given type. Accepts 'comment',1151 * 'trackback', 'pingback', 'pings' (trackbacks and pingbacks), or 'all'.1152 * Default is'all'.1156 * @type string $type Limit paginated comments to those matching a given type. 1157 * Accepts 'comment', 'trackback', 'pingback', 'pings' 1158 * (trackbacks and pingbacks), or 'all'. Default 'all'. 1153 1159 * @type int $post_id ID of the post. 1154 1160 * @type string $fields Comment fields to return. 1155 * @type bool $count Whether to return a comment count (true) or array of1156 * comment objects (false)1161 * @type bool $count Whether to return a comment count (true) or array 1162 * of comment objects (false). 1157 1163 * @type string $status Comment status. 1158 1164 * @type int $parent Parent ID of comment to retrieve children of. … … 1162 1168 * } 1163 1169 */ 1164 $comment_args = apply_filters( 'get_page_of_comment_query_args', $comment_args ); 1170 $comment_args = apply_filters( 'get_page_of_comment_query_args', $comment_args ); 1171 1165 1172 $comment_query = new WP_Comment_Query(); 1166 1173 $older_comment_count = $comment_query->query( $comment_args ); … … 1925 1932 1926 1933 return $commenter_email; 1927 }1928 1929 /**1930 * Get include unapproved comments query argument.1931 *1932 * Used to include unapproved comments of currrent commenters to1933 * keep them informed their comments were successfully saved.1934 *1935 * @since 5.5.01936 *1937 * @return array The unapproved comments query argument.1938 */1939 function wp_get_include_unapproved_comments_argument() {1940 $user_id = get_current_user_id();1941 $include_unapproved = array();1942 1943 if ( $user_id ) {1944 $include_unapproved = array( $user_id );1945 } else {1946 $unapproved_email = wp_get_unapproved_comment_author_email();1947 1948 if ( $unapproved_email ) {1949 $include_unapproved = array( $unapproved_email );1950 }1951 }1952 1953 return $include_unapproved;1954 1934 } 1955 1935
Note: See TracChangeset
for help on using the changeset viewer.