Redirects the users to their own page with namespace people after logging in, e.g. people:james:start, if the page does not exist, it will automatically creates the page from a template. This version adds configs into the admin area, you can specify the namespace, template path and on/off if restrict the page to user only.
the following script will move the existing home pages(created by previous versions) into groups(new feature in version 3)
<?php
$userBaseDir = './data/pages/people'; //change this to suit your namespace
$dirs = scandir($userBaseDir);
foreach($dirs as $dir)
{
//if is diretory and not a group directory
if (is_dir($userBaseDir.'/'.$dir)&&(strlen($dir)>1)&&($dir!='..'))
{
echo $dir."<br>";
$gDir = $userBaseDir.'/'.strtolower(substr($dir, 0, 1));
//if the group dir does not exist
if (!file_exists($gDir))
{
mkdir($gDir);
}
//move the dir into group dir
exec('mv '.$userBaseDir.'/'.$dir.' '.$gDir);
echo 'mv '.$userBaseDir.'/'.$dir.' '.$gDir."<br>";
}
}
?>
Create a empty PHP file under the wiki root folder, copy and paste the above code, change the $userBaseDir to point to your users home main namespace, and run that PHP file by browser.
Hi,
I try this plugin with Firefox under Linux and I receive this error:
1
Warning: Cannot modify header information - headers already sent by (output started at
/opt/coolstack/apache2/htdocs/prova/lib/plugins/userhomepage/action.php:28) in
/opt/coolstack/apache2/htdocs/prova/lib/plugins/userhomepage/action.php on line 29
Warning: Cannot modify header information - headers already sent by (output started at
/opt/coolstack/apache2/htdocs/prova/lib/plugins/userhomepage/action.php:30) in /opt/coolstack/apache2/htdocs/prova/inc/actions.php on line 321
Any Idea?
Thanks
Alessandro Celli
Solved!
I have added an output line that damage the header!
Hi, first of all, thanks for this plugin, this is exactly what I was looking for (and I hope that the home button back to the user home page will come soon ).
Perhaps I missed something but I think there is a little issue with ACL. If I turn on the home page restriction for other users, and that there is an ACL which give all rights to all users (* @ALL 8), the home page restriction for other users does not work. Am I clear enough? — Thomas
Great Plugin! For practical usage I'd like to implement some enhancements: Depending on the group of the user an individual template should be loaded. (I know that by default there is only one group (default) available at the moment of resisting. But if you give users time-slots to register, you can change the default-group for this time.)
For this you've to find out the actual-default-group and the used groups. There are some code-snips I don't know how to use, or what you get back: $grps[]=$_SERVER['REMOTE_USER']; and $INFO['userinfo']['grps']
Meta-Code:
if ( groupOfregistingUser is in Array of stored templates ) { //name for templatefile: _template_groupname
use the template
} else {
use a default template (e.g. blank one)
}
When using this plugin an ACL is created for the user-page, not for the user-namespace. I fixed this by editing the action.php:
// Old user-page ACL:// $ns = cleanID($this->home_wiki_ns.':'.$this->homePage());// New user-namespace ACL:$ns= cleanID($this->home_wiki_ns).':*';
Also I've changed the group code @ALL to @users, @ALL has no read access by default, @users is for all registered users and has Read access as I've filled in in the configuration page.
— Luitzen van Gorkum, 2.2.2010
Changed the code so that the ACL actually protects both the users' homepage AND his namespace. The block now looks like this:
{$acl=new admin_plugin_acl();// Old user-page ACL:// $ns = cleanID($this->home_wiki_ns.':'.$this->homePage());// New user-namespace ACL:$ns= cleanID($this->home_wiki_ns).'';// $acl->_acl_add($ns, '@ALL', (int)$this->getConf('set_permissions_others'));$acl->_acl_add($ns,'@user',(int)$this->getConf('set_permissions_others'));$acl->_acl_add($ns,strtolower($_SERVER['REMOTE_USER']), AUTH_DELETE);// New user-namespace ACL:$ns= cleanID($this->home_wiki_ns).':*';// $acl->_acl_add($ns, '@ALL', (int)$this->getConf('set_permissions_others'));$acl->_acl_add($ns,'@user',(int)$this->getConf('set_permissions_others'));$acl->_acl_add($ns,strtolower($_SERVER['REMOTE_USER']), AUTH_DELETE);
The ACL now looks like this:
people:t:test @user 1
people:t:test test 2
people:t:test:* @user 1
people:t:test:* test 16
Thanks for this great plugin! It works well for me after inserting Luitzen van Gorkum's ACL correction. The only other feature I wanted was to have users sorted by their ACL permission groups so I replaced the method homeNamespace() in action.php (near line 64) with the following:
function homeNamespace(){if($this->getConf('use_name_string')){global$INFO;//$raw_string = $INFO['userinfo']['name'];$raw_string=$INFO['userinfo']['grps'][0].':'.$INFO['userinfo']['name'];//first_group:james_linreturn$raw_string;}else{//gli8600returnstrtolower($_SERVER['REMOTE_USER']);};}
I made a small change in order to use Dokuwiki's standard routine for managing replacement patterns. In action.php (near line 88):
// Build a fake data structure for the parser$data=array('tpl'=>$content,'id'=>$this->home_wiki_page);// Use the built-in parser$content= parsePageTemplate($data);//$name = $INFO['userinfo']['name'];//$user = strtolower($_SERVER['REMOTE_USER']);//$content = str_replace('@NAME@',$name,$content);//$content = str_replace('@USER@',$user,$content);
— Christian Nancy - 04/15/2011
plugin/userhomepage.txt · Last modified: 2011/04/16 06:05 by 75.149.44.133