Extend showuseras config with username_link

uses the user interwiki link as profile link
This commit is contained in:
Gerrit Uitslag 2014-02-15 00:42:05 +01:00
parent b3d353e634
commit 7f081821c5
3 changed files with 27 additions and 9 deletions

View File

@ -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');
}

View File

@ -245,10 +245,11 @@ $lang['xsendfile_o_2'] = 'Standard X-Sendfile header';
$lang['xsendfile_o_3'] = 'Proprietary Nginx X-Accel-Redirect header';
/* Display user info */
$lang['showuseras_o_loginname'] = 'Login name';
$lang['showuseras_o_username'] = "User's full name";
$lang['showuseras_o_email'] = "User's e-mail addresss (obfuscated according to mailguard setting)";
$lang['showuseras_o_email_link'] = "User's e-mail addresss as a mailto: link";
$lang['showuseras_o_loginname'] = 'Login name';
$lang['showuseras_o_username'] = "User's full name";
$lang['showuseras_o_username_link'] = "User's full name as interwiki user link";
$lang['showuseras_o_email'] = "User's e-mail addresss (obfuscated according to mailguard setting)";
$lang['showuseras_o_email_link'] = "User's e-mail addresss as a mailto: link";
/* useheading options */
$lang['useheading_o_0'] = 'Never';

View File

@ -116,7 +116,7 @@ $meta['fullpath'] = array('onoff','_caution' => 'security');
$meta['typography'] = array('multichoice','_choices' => array(0,1,2));
$meta['dformat'] = array('string');
$meta['signature'] = array('string');
$meta['showuseras'] = array('multichoice','_choices' => array('loginname','username','email','email_link'));
$meta['showuseras'] = array('multichoice','_choices' => array('loginname','username','username_link','email','email_link'));
$meta['toptoclevel'] = array('multichoice','_choices' => array(1,2,3,4,5)); // 5 toc levels
$meta['tocminheads'] = array('multichoice','_choices' => array(0,1,2,3,4,5,10,15,20));
$meta['maxtoclevel'] = array('multichoice','_choices' => array(0,1,2,3,4,5));