Added new test before redirection

This commit is contained in:
Simon DELAGE 2016-02-09 02:30:36 +01:00
parent e2abf31c39
commit b4c049327c
2 changed files with 14 additions and 10 deletions

View file

@ -80,6 +80,7 @@ class action_plugin_userhomepage extends DokuWiki_Action_Plugin{
function redirect(&$event, $param) {
global $conf;
global $lang;
global $ID;
if ($this->multiNsOk()) {
$created = array();
@ -148,6 +149,8 @@ class action_plugin_userhomepage extends DokuWiki_Action_Plugin{
array_push($wikistart, $language.':'.$conf['start'], ':'.$language.':'.$conf['start']);
}
}
// If user isn't on public or private page yet, check for redirection conditions
if (($ID != $this->public_page) && ($ID != $this->private_page)) {
// If Public page was just created, redirect to it and edit (or show)
if (($created['public']) && (page_exists($this->public_page))) {
send_redirect(wl($this->public_page, array('do='.$this->getConf('action')), true));
@ -159,6 +162,7 @@ class action_plugin_userhomepage extends DokuWiki_Action_Plugin{
send_redirect(wl($this->private_page, '', true));
}
}
}
} else {
return flase;
}

View file

@ -1,7 +1,7 @@
base userhomepage
author Simon Delage
email simon.geekitude@gmail.com
date 2016-02-05
date 2016-02-09
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