NAME
Konstrukt::Plugin::usermanagement::personal - Personal information about the user.
SYNOPSIS
Tag interface
<& usermanagement::personal / &>
Perl interface
#get some data:
my $user_personal = use_plugin 'usermanagement::personal' or die;
$user_personal->firstname();
$user_personal->homepage();
...
DESCRIPTION
This plugin offers functionality to let each user manage some personal data of itself.
If the HTTP parameter id
is set, the personal information page of the user with that id will be shown.
Otherwise a form to change the personal information of the user, which is currently logged in, will be shown.
DEPENDENCIES
This plugin create a new entry for every newly registered user and deletes it when the user deregisters.
To know when a user (de)registers, this plugin has to register itself for the registered
and deregistered
events, that the basic usermanagement plugin fires.
So this plugin must be initialized before the basic user management plugin is executed. For this to happen, you can preload this plugin like this on the page, where the basic usermanagement is executed:
<& perl &>
#preload plugins, which will react on events (register, deregister)
use_plugin 'usermanagement::personal';
<& / &>
<& usermanagement::basic show="login, changepass, register, sendpass" / &>
CONFIGURATION
You have to do some konstrukt.settings-configuration to let the plugin know where to get its data and which layout to use. Defaults:
#backend
usermanagement/basic/backend DBI
See the documentation of the backend modules (e.g. "CONFIGURATION" in Konstrukt::Plugin::usermanagement::basic::DBI) for their configuration.
#layout
usermanagement/personal/template_path /templates/usermanagement/personal/
METHODS
init
Initializes this object. Sets $self->{backend} and $self->{template_path}
init()
will be called the first time this plugin is needed each request.
install
Installs the templates.
Parameters:
none
execute_again
Yes, this plugin may return dynamic nodes (i.e. template nodes).
prepare
Prepare method
Parameters:
$tag - Reference to the tag (and its children) that shall be handled.
execute
Execute method
Parameters:
$tag - Reference to the tag (and its children) that shall be handled.
data
Returns all relevant user data as an anonymous hash, if uid exists:
{ nick => .., firstname => .., lastname => .., sex => ..,
birth_year => .., birth_month => .., birth_day => ..,
email => .., jabber => .., icq => .., aim => .., msn => .., yahoo => .., homepage => ...}
Returns an empty hash if the uid doesn't exist.
Parameters (optional):
$uid - The user id (optional)
get
Returns a specified personal information field for a specified user, if the uid exists, undef otherwise.
Parameters:
$uid - The user ID
$field - The requested personal information field, e.g. "firstname", "nick", ...
get wrappers
For an easier access to the data fields of an user you may also use these wapper methods:
firstname($uid)
lastname($uid)
nick($uid)
sex($uid)
birth_year($uid)
birth_month($uid)
birth_day($uid)
jabber($uid)
icq($uid)
aim($uid)
msn($uid)
yahoo($uid)
homepage($uid)
set
Sets the data specified in the passed hash in the database
Parameters:
$uid - The user ID
$data - Hashreference with the data that should be set: { firstname => .., nick => .., ... }
new_user
Creates a new entry for the given user id.
Parameters:
$uid - The user ID
del_user
Deletes an entry with the given user id.
Parameters:
$uid - The user ID
show
Shows the personal information of the user, whose id has been specified via HTTP, or of the current user, if no user id is specified. Only the user itself may change the user data.
Displays the form with the personal user information.
change
Changes the personal information specified in an HTTP POST request.
Returns a confirmation of the successful userdata change or error messages otherwise.
AUTHOR
Copyright 2006 Thomas Wittek (mail at gedankenkonstrukt dot de). All rights reserved.
This document is free software. It is distributed under the same terms as Perl itself.
SEE ALSO
Konstrukt::Plugin::usermanagement::personal::DBI, Konstrukt::Plugin, Konstrukt