X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=plugins%2Ffunction.profile.php;h=f97016017b7b77b4d5a4a1dec16ef086cb9e052b;hb=e557b0dbd21096d0fdd5c18f62dab460d20c90c3;hp=98448ee8431ba4e9b2e79bdc8a368627e5253f92;hpb=12262f1306059765d8625a6752364679c8625d31;p=platal.git
diff --git a/plugins/function.profile.php b/plugins/function.profile.php
index 98448ee..f970160 100644
--- a/plugins/function.profile.php
+++ b/plugins/function.profile.php
@@ -19,7 +19,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************/
-function smarty_function_profile($params, &$smarty)
+function smarty_function_profile($params, $smarty)
{
$params = new PlDict($params);
$with_promo = $params->b('promo', false) || $params->b('cat', false);
@@ -27,7 +27,10 @@ function smarty_function_profile($params, &$smarty)
$with_link = $params->b('link', true);
$with_dir = $params->b('directory', true);
$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);
}
@@ -37,22 +40,31 @@ function smarty_function_profile($params, &$smarty)
} else {
$name = pl_entities($user->fullName());
}
- if ($with_sex && $user->isFemale()) {
- $name = '•' . $name;
- }
if ($with_promo) {
$promo = $user->category();
if ($promo) {
$name .= ' (' . pl_entities($promo) . ')';
}
}
+ if ($raw) {
+ return $name;
+ }
+
+ if ($with_sex && $user->isFemale()) {
+ $name = '•' . $name;
+ }
if ($with_link) {
- $profile = ($user instanceof Profile) ? $user : $user->profile();
+ if (is_null($profile)) {
+ $profile = $user->profile();
+ }
+
if ($profile) {
$name = '';
}
}
- if ($user->lost) {
+ if ($profile && $profile->isDead()) {
+ $name .= ' †';
+ } else if ($user->lost) {
$name .= ' ';
}
if ($with_groupperms && $user instanceof User && $user->group_perms == 'admin' && !empty($name)) {