Smarty's {profile} function now prints the category instead of the promo.
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Fri, 1 Oct 2010 12:06:10 +0000 (14:06 +0200)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Fri, 1 Oct 2010 12:09:55 +0000 (14:09 +0200)
For users with a promotion this does not change anything, for others this
adds useful information. Example:
 DUCHMOL Thierry (Secrétariat de l'AX)
 BRUNEAU Florent (X2003)
 DURET Brigitte (Personnel de l'X)

Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
plugins/function.profile.php

index 77909bd..f3a7fb1 100644 (file)
@@ -22,7 +22,7 @@
 function smarty_function_profile($params, &$smarty)
 {
     $params = new PlDict($params);
-    $with_promo = $params->b('promo', false);
+    $with_promo = $params->b('promo', false) || $params->b('cat', false);
     $with_sex   = $params->b('sex', true);
     $with_link  = $params->b('link', true);
     $with_groupperms = $params->b('groupperms', true);
@@ -36,7 +36,7 @@ function smarty_function_profile($params, &$smarty)
         $name = '&bull;' . $name;
     }
     if ($with_promo) {
-        $promo = $user->promo();
+        $promo = $user->category();
         if ($promo) {
             $name .= ' (' . pl_entities($promo) . ')';
         }