From f88ba74523829ee03ef5f38629d7a232cc444069 Mon Sep 17 00:00:00 2001 From: Simon DELAGE Date: Sat, 20 Feb 2016 09:09:16 +0100 Subject: [PATCH] Prevent page creation when showing image details --- action.php | 9 +++++---- plugin.info.txt | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/action.php b/action.php index 00b85dc..b2b3168 100644 --- a/action.php +++ b/action.php @@ -35,9 +35,10 @@ class action_plugin_userhomepage extends DokuWiki_Action_Plugin{ } else { $dest = $this->getConf('templates_path'); } + //if ($event == "DETAIL_STARTED") { return false; } $this->dataDir = $conf['savedir']; - // CREATE PRIVATE NAMESPACE START PAGE TEMPLATES IF NEEDED (is required by options, doesn't exist yet and a known user is logged in) - if (($this->getConf('create_private_ns')) && (!is_file($this->dataDir.'/'.$this->getConf('templates_path').'/userhomepage_private.txt')) && ($this->userOk())) { + // CREATE PRIVATE NAMESPACE START PAGE TEMPLATES IF NEEDED (is required by options, doesn't exist yet and a known user is logged in and not showing image details page) + if (($this->getConf('create_private_ns')) && (!is_file($this->dataDir.'/'.$this->getConf('templates_path').'/userhomepage_private.txt')) && ($this->userOk()) && ($event != "DETAIL_STARTED")) { // If a template exists in path as builded before 2015/05/14 version, use it as source to create userhomepage_private.txt in new templates_path if ((is_file(DOKU_CONF.'../'.$this->getConf('templates_path').'/userhomepage_private.txt')) && ($this->getConf('templatepath') != null)) { $source = DOKU_CONF.'../'.$this->getConf('templates_path').'/userhomepage_private.txt'; @@ -50,8 +51,8 @@ class action_plugin_userhomepage extends DokuWiki_Action_Plugin{ } $this->copyFile($source, $dest, 'userhomepage_private.txt'); } - // CREATE PUBLIC PAGE TEMPLATES IF NEEDED (is required by options, doesn't exist yet and a known user is logged in) - if (($this->getConf('create_public_page')) and (!is_file($this->dataDir.'/'.$this->getConf('templates_path').'/userhomepage_public.txt')) and ($this->userOk())) { + // CREATE PUBLIC PAGE TEMPLATES IF NEEDED (is required by options, doesn't exist yet and a known user is logged in and not showing image details page) + if (($this->getConf('create_public_page')) and (!is_file($this->dataDir.'/'.$this->getConf('templates_path').'/userhomepage_public.txt')) and ($this->userOk()) && ($event != "DETAIL_STARTED")) { // If a template exists in path as builded before 2015/05/14 version, use it as source to create userhomepage_private.txt in new templates_path if ((is_file(DOKU_CONF.'../'.$this->getConf('templates_path').'/userhomepage_public.txt')) && ($this->getConf('templatepath') != null)) { $source = DOKU_CONF.'../'.$this->getConf('templates_path').'/userhomepage_public.txt'; diff --git a/plugin.info.txt b/plugin.info.txt index 8244ad8..f387cee 100644 --- a/plugin.info.txt +++ b/plugin.info.txt @@ -1,7 +1,7 @@ base userhomepage author Simon Delage email simon.geekitude@gmail.com -date 2016-02-09 +date 2016-02-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