Skip to content

Commit

Permalink
Add optional $p_link param to print_user()
Browse files Browse the repository at this point in the history
In 2.20.0, prepare_user_name() received a new optional parameter to
allow username to be printed as-is without making it an HTML link (see
commit e504944, issue #5151).

It makes sense that this capability is extended to print_user() API.
  • Loading branch information
dregad committed Jun 14, 2019
1 parent ae3f4b6 commit 8eeb25f
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions core/print_api.php
Expand Up @@ -194,13 +194,18 @@ function print_avatar( $p_user_id, $p_class_prefix, $p_size = 80 ) {
}

/**
* prints the name of the user given the id. also makes it an email link.
* prints the name of the user given the id.
*
* By default, the username will become a hyperlink to View User page,
* but caller can decide to just print the username.
*
* @param integer $p_user_id A user identifier.
* @param boolean $p_link Whether to add an html link (defaults to true)
*
* @return void
*/
function print_user( $p_user_id ) {
echo prepare_user_name( $p_user_id );
function print_user( $p_user_id, $p_link = true ) {
echo prepare_user_name( $p_user_id, $p_link );
}

/**
Expand Down

0 comments on commit 8eeb25f

Please sign in to comment.