diff --git a/action.php b/action.php index bdebe81..3359b7c 100644 --- a/action.php +++ b/action.php @@ -49,8 +49,10 @@ class action_plugin_userhomepage extends DokuWiki_Action_Plugin{ saveWikiText($id,$this->_template_private(),$lang['created']); unlock($id); // } - // redirect to edit home page - send_redirect(wl($id, array("do" => ($this->getConf('edit_before_create'))?"edit":"show"), false, "&")); + // Redirect to edit or show private namespace start page (if edit public page is not on) + if (!($this->getConf('edit_public_before_create'))) { + send_redirect(wl($id, array("do" => ($this->getConf('edit_before_create'))?"edit":"show"), false, "&")); + } } // If Translation plugin is active, determine if we're at wikistart if (!plugin_isdisabled('translation')) { @@ -93,6 +95,10 @@ class action_plugin_userhomepage extends DokuWiki_Action_Plugin{ lock($this->public_page); saveWikiText($this->public_page,$this->_template_public(),$lang['created']); unlock($this->public_page); + // redirect to edit public page + if ($this->getConf('edit_public_before_create')) { + send_redirect(wl($this->public_page, 'do=edit', false, '&')); + } } } } diff --git a/conf/default.php b/conf/default.php index 0fa6069..aacd966 100644 --- a/conf/default.php +++ b/conf/default.php @@ -18,3 +18,4 @@ $conf['edit_before_create'] = 0; $conf['create_public_page'] = 0; $conf['public_pages_ns'] = 'user'; $conf['templatepathpublic'] = 'lib/plugins/userhomepage/_template_public.txt'; +$conf['edit_public_before_create'] = 1; diff --git a/conf/metadata.php b/conf/metadata.php index 204440d..9bb3cf6 100644 --- a/conf/metadata.php +++ b/conf/metadata.php @@ -18,3 +18,4 @@ $meta['edit_before_create'] = array('onoff'); $meta['create_public_page'] = array('onoff'); $meta['public_pages_ns'] = array('string','_pattern' => '/^(|[a-zA-Z\-:]+)$/','_caution' => 'warning'); $meta['templatepathpublic'] = array('string'); +$meta['edit_public_before_create'] = array('onoff'); diff --git a/lang/en/settings.php b/lang/en/settings.php index 8cdff3b..b6abe21 100644 --- a/lang/en/settings.php +++ b/lang/en/settings.php @@ -20,7 +20,8 @@ $lang['set_permissions_others_o_8'] = 'Upload'; $lang['set_permissions_others_o_16'] = 'Delete'; $lang['group_by_name'] = 'Group users\' namespaces by the first character of user name ?'; $lang['templatepath'] = 'Doku relative path to the template file for user\'s namespace start page.'; -$lang['edit_before_create'] = 'Allow users to edit their namespace start page before create.'; +$lang['edit_before_create'] = 'Allow users to edit their private namespace start page on creation (will not work if editing public page on creation is on).'; $lang['create_public_page'] = 'Create a public page for user'; $lang['public_pages_ns'] = 'Namespace under wich public pages ar created. If a value other than \'user\' is used, ?????????????????'; $lang['templatepathpublic'] = 'lib/plugins/userhomepage/_template_public.txt'; +$lang['edit_public_before_create'] = 'Allow users to edit their public on creation.';