diff options
author | Gerrit Uitslag <klapinklapin@gmail.com> | 2014-02-15 00:42:05 +0100 |
---|---|---|
committer | Gerrit Uitslag <klapinklapin@gmail.com> | 2014-02-15 00:42:05 +0100 |
commit | 7f081821c51e704c2720b993ca5364fa5e7e3663 (patch) | |
tree | d365ed9168da897eeb9b8ad04eec3c3d33451b12 /inc/common.php | |
parent | b3d353e634614780173506006921f7545ca81305 (diff) | |
download | rpg-7f081821c51e704c2720b993ca5364fa5e7e3663.tar.gz rpg-7f081821c51e704c2720b993ca5364fa5e7e3663.tar.bz2 |
Extend showuseras config with username_link
uses the user interwiki link as profile link
Diffstat (limited to 'inc/common.php')
-rw-r--r-- | inc/common.php | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/inc/common.php b/inc/common.php index c18f43668..22e57b2c5 100644 --- a/inc/common.php +++ b/inc/common.php @@ -1465,6 +1465,7 @@ function userinfo($username = null) { if(isset($info) && $info) { switch($conf['showuseras']) { case 'username': + case 'username_link': $data['name'] = hsc($info['name']); break; case 'email': @@ -1475,13 +1476,31 @@ function userinfo($username = null) { } } } + + /** @var Doku_Renderer_xhtml $xhtml_renderer */ + static $xhtml_renderer = null; + if($data['link'] !== false && empty($data['link']['url'])){ - if($conf['showuseras'] == 'email_link') { + + if(in_array($conf['showuseras'], array('email_link', 'username_link'))) { if(!isset($info)) { if($auth) $info = $auth->getUserData($username); } if(isset($info) && $info) { - $data['link']['url'] = 'mailto:'.obfuscate($info['mail']); + if($conf['showuseras'] == 'email_link') { + $data['link']['url'] = 'mailto:'.obfuscate($info['mail']); + } else { + if(is_null($xhtml_renderer)){ + $xhtml_renderer = p_get_renderer('xhtml'); + } + if(empty($xhtml_renderer->interwiki)) { + $xhtml_renderer->interwiki = getInterwiki(); + } + $shortcut = 'user'; + $url = $xhtml_renderer->_resolveInterWiki($shortcut, $username); + list($url, $urlparam) = explode('?', $url, 2); + $data['link']['url'] = wl($url, $urlparam); + } } else { $data['link'] = false; } @@ -1495,8 +1514,6 @@ function userinfo($username = null) { $data['userinfo'] = $data['name']; } else{ $data['link']['name'] = $data['name']; - /** @var Doku_Renderer_xhtml $xhtml_renderer */ - static $xhtml_renderer = null; if(is_null($xhtml_renderer)){ $xhtml_renderer = p_get_renderer('xhtml'); } |