From 8eeb25ff78295d9d61e222a928e8b267fdc960eb Mon Sep 17 00:00:00 2001 From: Damien Regad Date: Tue, 16 Apr 2019 17:27:49 +0200 Subject: [PATCH] Add optional $p_link param to print_user() 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 e504944145090f74a16f11688ec84238243aa2d8, issue #5151). It makes sense that this capability is extended to print_user() API. --- core/print_api.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/core/print_api.php b/core/print_api.php index 6c83048eb2..44d187dfd2 100644 --- a/core/print_api.php +++ b/core/print_api.php @@ -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 ); } /**