Improved getComplexLoggedInAs()
Now shows both links if both private namespace and public page exist or defaults back to a simple link to the one that exist or standard string if none exist
This commit is contained in:
parent
e21925e236
commit
242ee4b4eb
16
helper.php
16
helper.php
|
@ -56,7 +56,21 @@ class helper_plugin_userhomepage extends DokuWiki_Plugin {
|
|||
function getComplexLoggedInAs() {
|
||||
global $INFO;
|
||||
global $lang;
|
||||
return '<li>'.$lang['loggedinas'].' : <a href="'.wl($this->getPrivateID()).'" class="uhp_private" rel="nofollow" title="'.$this->getLang('privatenamespace').'">'.$INFO['userinfo']['name'].'</a> (<a href="'.wl($this->getPublicID()).'" class="uhp_public" rel="nofollow" title="'.$this->getLang('publicpage').'">'.$_SERVER['REMOTE_USER'].'</a>)</li>';
|
||||
// If user's private namespace and public page exist, return a 'Logged in as' string with both style links)
|
||||
if ((page_exists($this->getPrivateID())) && (page_exists($this->getPublicID()))) {
|
||||
return '<li>'.$lang['loggedinas'].' : <a href="'.wl($this->getPrivateID()).'" class="uhp_private" rel="nofollow" title="'.$this->getLang('privatenamespace').'">'.$INFO['userinfo']['name'].'</a> (<a href="'.wl($this->getPublicID()).'" class="uhp_public" rel="nofollow" title="'.$this->getLang('publicpage').'">'.$_SERVER['REMOTE_USER'].'</a>)</li>';
|
||||
// Else if only private namespace exists, return 'Logged in as' string with private namespace link
|
||||
} elseif (page_exists($this->getPrivateID())) {
|
||||
return $this->getPrivateLink("loggedinas");
|
||||
// Else if only ppublic page exists, return 'Logged in as' string with public page link
|
||||
} elseif (page_exists($this->getPublicID())) {
|
||||
return $this->getPublicLink("loggedinas");
|
||||
// Else default back to standard string
|
||||
} else {
|
||||
echo '<li class="user">';
|
||||
tpl_userinfo(); /* 'Logged in as ...' */
|
||||
echo '</li>';
|
||||
}
|
||||
}
|
||||
|
||||
function getButton($type="private") {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
base userhomepage
|
||||
author Simon Delage
|
||||
email simon.geekitude@gmail.com
|
||||
date 2014-09-19
|
||||
date 2014-09-20
|
||||
name User Homepage
|
||||
desc Automatically create user's private namespace and/or public page and redirects users to private namespace on login.
|
||||
url https://www.dokuwiki.org/plugin:userhomepage
|
||||
|
|
Loading…
Reference in a new issue