From: Raphaël Barrois Date: Sun, 4 Nov 2012 22:51:34 +0000 (+0100) Subject: Improve (and fix) {profile} smarty plugin. X-Git-Tag: xorg/1.1.6~10 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=4533e245b8c97acd1bfe12cfa01547e8eac9761a;p=platal.git Improve (and fix) {profile} smarty plugin. Signed-off-by: Raphaël Barrois --- 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 . ''; }