Konstrukt::Plugin::usermanagement::personal - Personal information about the user.
<& usermanagement::personal / &>
#get some data: my $user_personal = use_plugin 'usermanagement::personal' or die; $user_personal->firstname(); $user_personal->homepage(); ...
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.
id
Otherwise a form to change the personal information of the user, which is currently logged in, will be shown.
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.
registered
deregistered
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" / &>
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/
Initializes this object. Sets $self->{backend} and $self->{template_path}
init() will be called the first time this plugin is needed each request.
init()
Installs the templates.
Parameters:
none
Yes, this plugin may return dynamic nodes (i.e. template nodes).
Prepare method
$tag - Reference to the tag (and its children) that shall be handled.
Execute method
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)
Returns a specified personal information field for a specified user, if the uid exists, undef otherwise.
$uid - The user ID
$field - The requested personal information field, e.g. "firstname", "nick", ...
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)
Sets the data specified in the passed hash in the database
$data - Hashreference with the data that should be set: { firstname => .., nick => .., ... }
Creates a new entry for the given user id.
Deletes an entry with the given user id.
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.
Changes the personal information specified in an HTTP POST request.
Returns a confirmation of the successful userdata change or error messages otherwise.
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.
Konstrukt::Plugin::usermanagement::personal::DBI, Konstrukt::Plugin, Konstrukt
To install Konstrukt, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Konstrukt
CPAN shell
perl -MCPAN -e shell install Konstrukt
For more information on module installation, please visit the detailed CPAN module installation guide.