wp/wp-includes/author-template.php
author ymh <ymh.work@gmail.com>
Mon, 08 Sep 2025 19:44:41 +0200
changeset 23 417f20492bf7
parent 21 48c4eec2b7e6
permissions -rw-r--r--
Update Docker configuration and plugin versions - Upgrade MariaDB from 10.6 to 11 with auto-upgrade support - Add WordPress debug environment variable to FPM container - Update PHP-FPM Dockerfile base image - Update Include Mastodon Feed plugin with bug fixes and improvements - Update Portfolio plugin (v2.58) with latest translations and demo data enhancements - Remove old README.md from Mastodon Feed plugin 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
<?php
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
 * Author Template functions for use in themes.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
 * These functions must be used within the WordPress Loop.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
 *
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
     7
 * @link https://codex.wordpress.org/Author_Templates
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     8
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
 * @package WordPress
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
 * @subpackage Template
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    11
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    12
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    13
/**
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
    14
 * Retrieves the author of the current post.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    15
 *
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    16
 * @since 1.5.0
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    17
 * @since 6.3.0 Returns an empty string if the author's display name is unknown.
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    18
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
    19
 * @global WP_User $authordata The current author's data.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    20
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    21
 * @param string $deprecated Deprecated.
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    22
 * @return string The author's display name, empty string if unknown.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    23
 */
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    24
function get_the_author( $deprecated = '' ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    25
	global $authordata;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    26
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    27
	if ( ! empty( $deprecated ) ) {
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    28
		_deprecated_argument( __FUNCTION__, '2.1.0' );
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    29
	}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    30
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    31
	/**
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    32
	 * Filters the display name of the current post's author.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    33
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    34
	 * @since 2.9.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    35
	 *
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    36
	 * @param string $display_name The author's display name.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    37
	 */
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    38
	return apply_filters( 'the_author', is_object( $authordata ) ? $authordata->display_name : '' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    39
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    40
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    41
/**
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
    42
 * Displays the name of the author of the current post.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    43
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    44
 * The behavior of this function is based off of old functionality predating
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    45
 * get_the_author(). This function is not deprecated, but is designed to echo
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    46
 * the value from get_the_author() and as an result of any old theme that might
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    47
 * still use the old behavior will also pass the value from get_the_author().
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    48
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    49
 * The normal, expected behavior of this function is to echo the author and not
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    50
 * return it. However, backward compatibility has to be maintained.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    51
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    52
 * @since 0.71
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
    53
 *
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    54
 * @see get_the_author()
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
    55
 * @link https://developer.wordpress.org/reference/functions/the_author/
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    56
 *
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    57
 * @param string $deprecated      Deprecated.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    58
 * @param bool   $deprecated_echo Deprecated. Use get_the_author(). Echo the string or return it.
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    59
 * @return string The author's display name, from get_the_author().
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    60
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    61
function the_author( $deprecated = '', $deprecated_echo = true ) {
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    62
	if ( ! empty( $deprecated ) ) {
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    63
		_deprecated_argument( __FUNCTION__, '2.1.0' );
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    64
	}
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    65
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    66
	if ( true !== $deprecated_echo ) {
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    67
		_deprecated_argument(
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    68
			__FUNCTION__,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    69
			'1.5.0',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    70
			sprintf(
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
    71
				/* translators: %s: get_the_author() */
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    72
				__( 'Use %s instead if you do not want the value echoed.' ),
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    73
				'<code>get_the_author()</code>'
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    74
			)
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    75
		);
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    76
	}
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    77
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    78
	if ( $deprecated_echo ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    79
		echo get_the_author();
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    80
	}
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    81
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    82
	return get_the_author();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    83
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    84
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    85
/**
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
    86
 * Retrieves the author who last edited the current post.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    87
 *
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    88
 * @since 2.8.0
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    89
 *
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
    90
 * @return string|void The author's display name, empty string if unknown.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    91
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    92
function get_the_modified_author() {
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    93
	$last_id = get_post_meta( get_post()->ID, '_edit_last', true );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    94
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    95
	if ( $last_id ) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    96
		$last_user = get_userdata( $last_id );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    97
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    98
		/**
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    99
		 * Filters the display name of the author who last edited the current post.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   100
		 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   101
		 * @since 2.8.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   102
		 *
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   103
		 * @param string $display_name The author's display name, empty string if unknown.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   104
		 */
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   105
		return apply_filters( 'the_modified_author', $last_user ? $last_user->display_name : '' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   106
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   107
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   108
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   109
/**
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   110
 * Displays the name of the author who last edited the current post,
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   111
 * if the author's ID is available.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   112
 *
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   113
 * @since 2.8.0
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   114
 *
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   115
 * @see get_the_author()
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   116
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   117
function the_modified_author() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   118
	echo get_the_modified_author();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   119
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   120
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   121
/**
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   122
 * Retrieves the requested data of the author of the current post.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   123
 *
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   124
 * Valid values for the `$field` parameter include:
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   125
 *
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   126
 * - admin_color
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   127
 * - aim
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   128
 * - comment_shortcuts
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   129
 * - description
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   130
 * - display_name
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   131
 * - first_name
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   132
 * - ID
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   133
 * - jabber
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   134
 * - last_name
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   135
 * - nickname
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   136
 * - plugins_last_view
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   137
 * - plugins_per_page
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   138
 * - rich_editing
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   139
 * - syntax_highlighting
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   140
 * - user_activation_key
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   141
 * - user_description
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   142
 * - user_email
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   143
 * - user_firstname
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   144
 * - user_lastname
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   145
 * - user_level
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   146
 * - user_login
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   147
 * - user_nicename
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   148
 * - user_pass
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   149
 * - user_registered
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   150
 * - user_status
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   151
 * - user_url
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   152
 * - yim
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   153
 *
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   154
 * @since 2.8.0
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   155
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   156
 * @global WP_User $authordata The current author's data.
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   157
 *
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   158
 * @param string    $field   Optional. The user field to retrieve. Default empty.
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   159
 * @param int|false $user_id Optional. User ID. Defaults to the current post author.
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   160
 * @return string The author's field from the current author's DB object, otherwise an empty string.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   161
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   162
function get_the_author_meta( $field = '', $user_id = false ) {
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   163
	$original_user_id = $user_id;
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   164
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   165
	if ( ! $user_id ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   166
		global $authordata;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   167
		$user_id = isset( $authordata->ID ) ? $authordata->ID : 0;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   168
	} else {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   169
		$authordata = get_userdata( $user_id );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   170
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   171
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   172
	if ( in_array( $field, array( 'login', 'pass', 'nicename', 'email', 'url', 'registered', 'activation_key', 'status' ), true ) ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   173
		$field = 'user_' . $field;
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   174
	}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   175
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   176
	$value = isset( $authordata->$field ) ? $authordata->$field : '';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   177
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   178
	/**
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   179
	 * Filters the value of the requested user metadata.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   180
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   181
	 * The filter name is dynamic and depends on the $field parameter of the function.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   182
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   183
	 * @since 2.8.0
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   184
	 * @since 4.3.0 The `$original_user_id` parameter was added.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   185
	 *
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   186
	 * @param string    $value            The value of the metadata.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   187
	 * @param int       $user_id          The user ID for the value.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   188
	 * @param int|false $original_user_id The original user ID, as passed to the function.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   189
	 */
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   190
	return apply_filters( "get_the_author_{$field}", $value, $user_id, $original_user_id );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   191
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   192
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   193
/**
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   194
 * Outputs the field from the user's DB object. Defaults to current post's author.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   195
 *
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   196
 * @since 2.8.0
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   197
 *
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   198
 * @param string    $field   Selects the field of the users record. See get_the_author_meta()
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   199
 *                           for the list of possible fields.
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   200
 * @param int|false $user_id Optional. User ID. Defaults to the current post author.
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   201
 *
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   202
 * @see get_the_author_meta()
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   203
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   204
function the_author_meta( $field = '', $user_id = false ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   205
	$author_meta = get_the_author_meta( $field, $user_id );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   206
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   207
	/**
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   208
	 * Filters the value of the requested user metadata.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   209
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   210
	 * The filter name is dynamic and depends on the $field parameter of the function.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   211
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   212
	 * @since 2.8.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   213
	 *
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   214
	 * @param string    $author_meta The value of the metadata.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   215
	 * @param int|false $user_id     The user ID.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   216
	 */
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   217
	echo apply_filters( "the_author_{$field}", $author_meta, $user_id );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   218
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   219
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   220
/**
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   221
 * Retrieves either author's link or author's name.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   222
 *
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   223
 * If the author has a home page set, return an HTML link, otherwise just return
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   224
 * the author's name.
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   225
 *
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   226
 * @since 3.0.0
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   227
 *
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   228
 * @global WP_User $authordata The current author's data.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   229
 *
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   230
 * @return string An HTML link if the author's URL exists in user meta,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   231
 *                otherwise the result of get_the_author().
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   232
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   233
function get_the_author_link() {
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   234
	if ( get_the_author_meta( 'url' ) ) {
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   235
		global $authordata;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   236
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   237
		$author_url          = get_the_author_meta( 'url' );
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   238
		$author_display_name = get_the_author();
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   239
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   240
		$link = sprintf(
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   241
			'<a href="%1$s" title="%2$s" rel="author external">%3$s</a>',
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   242
			esc_url( $author_url ),
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   243
			/* translators: %s: Author's display name. */
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   244
			esc_attr( sprintf( __( 'Visit %s&#8217;s website' ), $author_display_name ) ),
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   245
			$author_display_name
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   246
		);
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   247
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   248
		/**
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   249
		 * Filters the author URL link HTML.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   250
		 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   251
		 * @since 6.0.0
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   252
		 *
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   253
		 * @param string  $link       The default rendered author HTML link.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   254
		 * @param string  $author_url Author's URL.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   255
		 * @param WP_User $authordata Author user data.
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   256
		 */
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   257
		return apply_filters( 'the_author_link', $link, $author_url, $authordata );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   258
	} else {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   259
		return get_the_author();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   260
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   261
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   262
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   263
/**
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   264
 * Displays either author's link or author's name.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   265
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   266
 * If the author has a home page set, echo an HTML link, otherwise just echo the
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   267
 * author's name.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   268
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   269
 * @link https://developer.wordpress.org/reference/functions/the_author_link/
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   270
 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   271
 * @since 2.1.0
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   272
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   273
function the_author_link() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   274
	echo get_the_author_link();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   275
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   276
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   277
/**
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   278
 * Retrieves the number of posts by the author of the current post.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   279
 *
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   280
 * @since 1.5.0
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   281
 *
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   282
 * @return int The number of posts by the author.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   283
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   284
function get_the_author_posts() {
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   285
	$post = get_post();
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   286
	if ( ! $post ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   287
		return 0;
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   288
	}
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   289
	return count_user_posts( $post->post_author, $post->post_type );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   290
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   291
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   292
/**
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   293
 * Displays the number of posts by the author of the current post.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   294
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   295
 * @link https://developer.wordpress.org/reference/functions/the_author_posts/
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   296
 * @since 0.71
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   297
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   298
function the_author_posts() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   299
	echo get_the_author_posts();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   300
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   301
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   302
/**
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   303
 * Retrieves an HTML link to the author page of the current post's author.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   304
 *
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   305
 * Returns an HTML-formatted link using get_author_posts_url().
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   306
 *
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   307
 * @since 4.4.0
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   308
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   309
 * @global WP_User $authordata The current author's data.
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   310
 *
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   311
 * @return string An HTML link to the author page, or an empty string if $authordata is not set.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   312
 */
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   313
function get_the_author_posts_link() {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   314
	global $authordata;
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   315
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   316
	if ( ! is_object( $authordata ) ) {
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   317
		return '';
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   318
	}
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   319
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   320
	$link = sprintf(
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   321
		'<a href="%1$s" title="%2$s" rel="author">%3$s</a>',
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   322
		esc_url( get_author_posts_url( $authordata->ID, $authordata->user_nicename ) ),
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   323
		/* translators: %s: Author's display name. */
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   324
		esc_attr( sprintf( __( 'Posts by %s' ), get_the_author() ) ),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   325
		get_the_author()
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   326
	);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   327
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   328
	/**
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   329
	 * Filters the link to the author page of the author of the current post.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   330
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   331
	 * @since 2.9.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   332
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   333
	 * @param string $link HTML link.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   334
	 */
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   335
	return apply_filters( 'the_author_posts_link', $link );
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   336
}
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   337
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   338
/**
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   339
 * Displays an HTML link to the author page of the current post's author.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   340
 *
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   341
 * @since 1.2.0
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   342
 * @since 4.4.0 Converted into a wrapper for get_the_author_posts_link()
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   343
 *
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   344
 * @param string $deprecated Unused.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   345
 */
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   346
function the_author_posts_link( $deprecated = '' ) {
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   347
	if ( ! empty( $deprecated ) ) {
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   348
		_deprecated_argument( __FUNCTION__, '2.1.0' );
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   349
	}
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   350
	echo get_the_author_posts_link();
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   351
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   352
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   353
/**
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   354
 * Retrieves the URL to the author page for the user with the ID provided.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   355
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   356
 * @since 2.1.0
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   357
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   358
 * @global WP_Rewrite $wp_rewrite WordPress rewrite component.
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   359
 *
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   360
 * @param int    $author_id       Author ID.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   361
 * @param string $author_nicename Optional. The author's nicename (slug). Default empty.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   362
 * @return string The URL to the author's page.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   363
 */
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   364
function get_author_posts_url( $author_id, $author_nicename = '' ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   365
	global $wp_rewrite;
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   366
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   367
	$author_id = (int) $author_id;
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   368
	$link      = $wp_rewrite->get_author_permastruct();
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   369
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   370
	if ( empty( $link ) ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   371
		$file = home_url( '/' );
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   372
		$link = $file . '?author=' . $author_id;
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   373
	} else {
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   374
		if ( '' === $author_nicename ) {
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   375
			$user = get_userdata( $author_id );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   376
			if ( ! empty( $user->user_nicename ) ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   377
				$author_nicename = $user->user_nicename;
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   378
			}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   379
		}
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   380
		$link = str_replace( '%author%', $author_nicename, $link );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   381
		$link = home_url( user_trailingslashit( $link ) );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   382
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   383
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   384
	/**
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   385
	 * Filters the URL to the author's page.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   386
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   387
	 * @since 2.1.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   388
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   389
	 * @param string $link            The URL to the author's page.
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   390
	 * @param int    $author_id       The author's ID.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   391
	 * @param string $author_nicename The author's nice name.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   392
	 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   393
	$link = apply_filters( 'author_link', $link, $author_id, $author_nicename );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   394
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   395
	return $link;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   396
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   397
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   398
/**
19
3d72ae0968f4 upgrade wordpress to 6.0.2
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   399
 * Lists all the authors of the site, with several options available.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   400
 *
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   401
 * @link https://developer.wordpress.org/reference/functions/wp_list_authors/
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   402
 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   403
 * @since 1.2.0
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   404
 *
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   405
 * @global wpdb $wpdb WordPress database abstraction object.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   406
 *
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   407
 * @param string|array $args {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   408
 *     Optional. Array or string of default arguments.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   409
 *
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   410
 *     @type string       $orderby       How to sort the authors. Accepts 'nicename', 'email', 'url', 'registered',
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   411
 *                                       'user_nicename', 'user_email', 'user_url', 'user_registered', 'name',
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   412
 *                                       'display_name', 'post_count', 'ID', 'meta_value', 'user_login'. Default 'name'.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   413
 *     @type string       $order         Sorting direction for $orderby. Accepts 'ASC', 'DESC'. Default 'ASC'.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   414
 *     @type int          $number        Maximum authors to return or display. Default empty (all authors).
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   415
 *     @type bool         $optioncount   Show the count in parenthesis next to the author's name. Default false.
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   416
 *     @type bool         $exclude_admin Whether to exclude the 'admin' account, if it exists. Default true.
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   417
 *     @type bool         $show_fullname Whether to show the author's full name. Default false.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   418
 *     @type bool         $hide_empty    Whether to hide any authors with no posts. Default true.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   419
 *     @type string       $feed          If not empty, show a link to the author's feed and use this text as the alt
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   420
 *                                       parameter of the link. Default empty.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   421
 *     @type string       $feed_image    If not empty, show a link to the author's feed and use this image URL as
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   422
 *                                       clickable anchor. Default empty.
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   423
 *     @type string       $feed_type     The feed type to link to. Possible values include 'rss2', 'atom'.
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   424
 *                                       Default is the value of get_default_feed().
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   425
 *     @type bool         $echo          Whether to output the result or instead return it. Default true.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   426
 *     @type string       $style         If 'list', each author is wrapped in an `<li>` element, otherwise the authors
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   427
 *                                       will be separated by commas.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   428
 *     @type bool         $html          Whether to list the items in HTML form or plaintext. Default true.
18
be944660c56a Site enmi version 09/2022
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   429
 *     @type int[]|string $exclude       Array or comma/space-separated list of author IDs to exclude. Default empty.
be944660c56a Site enmi version 09/2022
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   430
 *     @type int[]|string $include       Array or comma/space-separated list of author IDs to include. Default empty.
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   431
 * }
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   432
 * @return void|string Void if 'echo' argument is true, list of authors if 'echo' is false.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   433
 */
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   434
function wp_list_authors( $args = '' ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   435
	global $wpdb;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   436
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   437
	$defaults = array(
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   438
		'orderby'       => 'name',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   439
		'order'         => 'ASC',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   440
		'number'        => '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   441
		'optioncount'   => false,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   442
		'exclude_admin' => true,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   443
		'show_fullname' => false,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   444
		'hide_empty'    => true,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   445
		'feed'          => '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   446
		'feed_image'    => '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   447
		'feed_type'     => '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   448
		'echo'          => true,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   449
		'style'         => 'list',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   450
		'html'          => true,
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   451
		'exclude'       => '',
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   452
		'include'       => '',
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   453
	);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   454
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   455
	$parsed_args = wp_parse_args( $args, $defaults );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   456
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   457
	$return = '';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   458
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   459
	$query_args           = wp_array_slice_assoc( $parsed_args, array( 'orderby', 'order', 'number', 'exclude', 'include' ) );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   460
	$query_args['fields'] = 'ids';
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   461
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   462
	/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   463
	 * Filters the query arguments for the list of all authors of the site.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   464
	 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   465
	 * @since 6.1.0
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   466
	 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   467
	 * @param array $query_args  The query arguments for get_users().
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   468
	 * @param array $parsed_args The arguments passed to wp_list_authors() combined with the defaults.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   469
	 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   470
	$query_args = apply_filters( 'wp_list_authors_args', $query_args, $parsed_args );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   471
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   472
	$authors     = get_users( $query_args );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   473
	$post_counts = array();
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   474
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   475
	/**
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   476
	 * Filters whether to short-circuit performing the query for author post counts.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   477
	 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   478
	 * @since 6.1.0
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   479
	 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   480
	 * @param int[]|false $post_counts Array of post counts, keyed by author ID.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   481
	 * @param array       $parsed_args The arguments passed to wp_list_authors() combined with the defaults.
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   482
	 */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   483
	$post_counts = apply_filters( 'pre_wp_list_authors_post_counts_query', false, $parsed_args );
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   484
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   485
	if ( ! is_array( $post_counts ) ) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   486
		$post_counts       = array();
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   487
		$post_counts_query = $wpdb->get_results(
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   488
			"SELECT DISTINCT post_author, COUNT(ID) AS count
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   489
			FROM $wpdb->posts
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   490
			WHERE " . get_private_posts_cap_sql( 'post' ) . '
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   491
			GROUP BY post_author'
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   492
		);
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   493
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   494
		foreach ( (array) $post_counts_query as $row ) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   495
			$post_counts[ $row->post_author ] = $row->count;
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   496
		}
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   497
	}
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   498
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   499
	foreach ( $authors as $author_id ) {
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   500
		$posts = isset( $post_counts[ $author_id ] ) ? $post_counts[ $author_id ] : 0;
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   501
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   502
		if ( ! $posts && $parsed_args['hide_empty'] ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   503
			continue;
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   504
		}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   505
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   506
		$author = get_userdata( $author_id );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   507
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   508
		if ( $parsed_args['exclude_admin'] && 'admin' === $author->display_name ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   509
			continue;
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   510
		}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   511
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   512
		if ( $parsed_args['show_fullname'] && $author->first_name && $author->last_name ) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   513
			$name = sprintf(
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   514
				/* translators: 1: User's first name, 2: Last name. */
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   515
				_x( '%1$s %2$s', 'Display name based on first name and last name' ),
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   516
				$author->first_name,
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   517
				$author->last_name
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   518
			);
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   519
		} else {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   520
			$name = $author->display_name;
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   521
		}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   522
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   523
		if ( ! $parsed_args['html'] ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   524
			$return .= $name . ', ';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   525
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   526
			continue; // No need to go further to process HTML.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   527
		}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   528
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   529
		if ( 'list' === $parsed_args['style'] ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   530
			$return .= '<li>';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   531
		}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   532
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   533
		$link = sprintf(
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   534
			'<a href="%1$s" title="%2$s">%3$s</a>',
18
be944660c56a Site enmi version 09/2022
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   535
			esc_url( get_author_posts_url( $author->ID, $author->user_nicename ) ),
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   536
			/* translators: %s: Author's display name. */
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   537
			esc_attr( sprintf( __( 'Posts by %s' ), $author->display_name ) ),
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   538
			$name
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   539
		);
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   540
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   541
		if ( ! empty( $parsed_args['feed_image'] ) || ! empty( $parsed_args['feed'] ) ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   542
			$link .= ' ';
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   543
			if ( empty( $parsed_args['feed_image'] ) ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   544
				$link .= '(';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   545
			}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   546
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   547
			$link .= '<a href="' . get_author_feed_link( $author->ID, $parsed_args['feed_type'] ) . '"';
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   548
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   549
			$alt = '';
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   550
			if ( ! empty( $parsed_args['feed'] ) ) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   551
				$alt  = ' alt="' . esc_attr( $parsed_args['feed'] ) . '"';
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   552
				$name = $parsed_args['feed'];
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   553
			}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   554
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   555
			$link .= '>';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   556
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   557
			if ( ! empty( $parsed_args['feed_image'] ) ) {
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   558
				$link .= '<img src="' . esc_url( $parsed_args['feed_image'] ) . '" style="border: none;"' . $alt . ' />';
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   559
			} else {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   560
				$link .= $name;
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   561
			}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   562
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   563
			$link .= '</a>';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   564
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   565
			if ( empty( $parsed_args['feed_image'] ) ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   566
				$link .= ')';
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   567
			}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   568
		}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   569
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   570
		if ( $parsed_args['optioncount'] ) {
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   571
			$link .= ' (' . $posts . ')';
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   572
		}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   573
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   574
		$return .= $link;
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   575
		$return .= ( 'list' === $parsed_args['style'] ) ? '</li>' : ', ';
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   576
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   577
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   578
	$return = rtrim( $return, ', ' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   579
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   580
	if ( $parsed_args['echo'] ) {
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   581
		echo $return;
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   582
	} else {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   583
		return $return;
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   584
	}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   585
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   586
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   587
/**
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   588
 * Determines whether this site has more than one author.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   589
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   590
 * Checks to see if more than one author has published posts.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   591
 *
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   592
 * For more information on this and similar theme functions, check out
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   593
 * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   594
 * Conditional Tags} article in the Theme Developer Handbook.
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   595
 *
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   596
 * @since 3.2.0
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   597
 *
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   598
 * @global wpdb $wpdb WordPress database abstraction object.
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   599
 *
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   600
 * @return bool Whether or not we have more than one author
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   601
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   602
function is_multi_author() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   603
	global $wpdb;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   604
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   605
	$is_multi_author = get_transient( 'is_multi_author' );
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   606
	if ( false === $is_multi_author ) {
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   607
		$rows            = (array) $wpdb->get_col( "SELECT DISTINCT post_author FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' LIMIT 2" );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   608
		$is_multi_author = 1 < count( $rows ) ? 1 : 0;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   609
		set_transient( 'is_multi_author', $is_multi_author );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   610
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   611
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   612
	/**
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   613
	 * Filters whether the site has more than one author with published posts.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   614
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   615
	 * @since 3.2.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   616
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   617
	 * @param bool $is_multi_author Whether $is_multi_author should evaluate as true.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   618
	 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   619
	return apply_filters( 'is_multi_author', (bool) $is_multi_author );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   620
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   621
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   622
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   623
 * Helper function to clear the cache for number of authors.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   624
 *
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   625
 * @since 3.2.0
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   626
 * @access private
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   627
 */
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
   628
function __clear_multi_author_cache() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore,PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   629
	delete_transient( 'is_multi_author' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   630
}