X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=plugins%2Ffunction.profile.php;h=516f019f2b48fe4f750fe517b552c26c76428988;hb=refs%2Ftags%2Fxorg%2F1.1.0;hp=8d34076a02c85357b93db5fdf9320817454810fc;hpb=4ca15c312b905eea712b71d077c7a8b24f9d3b01;p=platal.git diff --git a/plugins/function.profile.php b/plugins/function.profile.php index 8d34076..516f019 100644 --- a/plugins/function.profile.php +++ b/plugins/function.profile.php @@ -1,6 +1,6 @@ b('promo', false) || $params->b('cat', false); + $with_sex = $params->b('sex', true); + $with_link = $params->b('link', true); + $with_dir = $params->b('directory', true); + $with_groupperms = $params->b('groupperms', true); + $user = $params->v('user'); + if (is_int($user) || ctype_digit($user)) { + $user = User::getWithUID($user); + } - $name = pl_entities($user->fullName()); + if ($with_dir) { + $name = pl_entities($user->directoryName()); + } else { + $name = pl_entities($user->fullName()); + } if ($with_sex && $user->isFemale()) { - $name = '•' . $name; + $name = '•' . $name; } if ($with_promo) { - $promo = $user->promo(); - if ($promo) { - $name .= ' (' . pl_entities($promo) . ')'; - } + $promo = $user->category(); + if ($promo) { + $name .= ' (' . pl_entities($promo) . ')'; + } } if ($with_link) { - $profile = ($user instanceof Profile) ? $user : $user->profile(); - if ($profile) { - $name = '' . $name . ''; - } + $profile = ($user instanceof Profile) ? $user : $user->profile(); + if ($profile) { + $name = '' . $name . ''; + } + } + if ($user->lost) { + $name .= ' Patte cassée'; + } + if ($with_groupperms && $user instanceof User && $user->group_perms == 'admin' && !empty($name)) { + $name = '' . $name . ''; } return $name; }