adds a get_webfinger_identifier
method (#397)
also `get_at_url` needed an update for the Blog User, who would throw an error otherwise
This commit is contained in:
parent
14b91cf760
commit
d6ff82b337
2 changed files with 23 additions and 0 deletions
|
@ -77,6 +77,15 @@ class Blog_User extends User {
|
|||
return \esc_url( \trailingslashit( get_home_url() ) . '@' . $this->get_preferred_username() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the User-URL with @-Prefix for the username.
|
||||
*
|
||||
* @return string The User-URL with @-Prefix for the username.
|
||||
*/
|
||||
public function get_at_url() {
|
||||
return \esc_url( \trailingslashit( get_home_url() ) . '@' . $this->get_preferred_username() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a default Username.
|
||||
*
|
||||
|
|
|
@ -98,10 +98,24 @@ class User extends Actor {
|
|||
return \esc_url( \get_author_posts_url( $this->_id ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the User-URL with @-Prefix for the username.
|
||||
*
|
||||
* @return string The User-URL with @-Prefix for the username.
|
||||
*/
|
||||
public function get_at_url() {
|
||||
return \esc_url( \trailingslashit( get_home_url() ) . '@' . $this->get_username() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a user@domain type of identifier for the user.
|
||||
*
|
||||
* @return string The Webfinger-Identifier.
|
||||
*/
|
||||
public function get_webfinger_identifier() {
|
||||
return sprintf( '%s@%s', $this->get_preferred_username(), wp_parse_url( home_url(), PHP_URL_HOST ) );
|
||||
}
|
||||
|
||||
public function get_preferred_username() {
|
||||
return \esc_attr( \get_the_author_meta( 'login', $this->_id ) );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue