From 4533e245b8c97acd1bfe12cfa01547e8eac9761a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Barrois?= Date: Sun, 4 Nov 2012 23:51:34 +0100 Subject: [PATCH] Improve (and fix) {profile} smarty plugin. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Raphaël Barrois --- plugins/function.profile.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/function.profile.php b/plugins/function.profile.php index abfb165..ccf45fc 100644 --- a/plugins/function.profile.php +++ b/plugins/function.profile.php @@ -29,6 +29,8 @@ function smarty_function_profile($params, $smarty) $with_groupperms = $params->b('groupperms', true); $raw = $params->b('raw', false); $user = $params->v('user'); + $profile = $params->v('profile'); + if (is_int($user) || ctype_digit($user)) { $user = User::getWithUID($user); } @@ -52,7 +54,10 @@ function smarty_function_profile($params, $smarty) $name = '•' . $name; } if ($with_link) { - $profile = ($user instanceof Profile) ? $user : $user->profile(); + if (is_null($profile)) { + $profile = $user->profile(); + } + if ($profile) { $name = '' . $name . ''; } -- 2.1.4