User Home Page plugin

Compatible with DokuWiki

No compatibility info given!

plugin 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.

Last updated on
2009-02-23
Provides
Action

Similar to mypage

Tagged with authentication, redirect, users

other plugins:

Donation

If you have used this plugin and you think it saved your development time, please show some mercy to my time by donating a dollar or two.

The Adobe Flash Plugin is needed to display this content.

Version 3.0.4

userhomepage.tar.gz

this version allows you to set the option to edit the home page before create or just create the page directly.

  • Korean language are not implemented for this new setting.

Installation

extract the userhomepage folder into the plugins folder

Add Home Button/Link

depending how you customize your template.

Home Link:

if you use tpl_actionlink for your menu, go to your template folder, edit the main.php file add the following line

<li><?php include_once('lib/plugins/userhomepage/action.php');$uhp=new action_plugin_userhomepage();$uhp->homeLink();?></li>

to the navigation <ul>

Home Button

if you use tpl_button for your menu, go to your template folder, edit the main.php file add the following line

<?php include_once('lib/plugins/userhomepage/action.php');$uhp=new action_plugin_userhomepage();$uhp->homeButton();?>

to the bar div

move flat user pages to groups

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.

Question

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!

Discussion

ACL issue? [resolved]

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

this is resolved.

template depending on group

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)
}

deshi, 29.12.2008

ACL for a namespace

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

Cheers,
— Harmen P. (Murf) de Ruiter, 2.3.2010


Groups

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_lin
	        return $raw_string;
	    } else {
		//gli8600
                return strtolower($_SERVER['REMOTE_USER']);
	    };
	}

Standard template behavior

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
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 3.0 Unported
Imprint Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki
WikiForumIRCBugsGitXRefTranslate