LdcUserProfile is an extensible user profile system for ZfcUser. It allows the authenticated user to modify their own account profile.
-
Install the Composer package:
composer require adamlundrigan/ldc-user-profile:1.*@stable
-
Enable the module (
LdcUserProfile
) in your ZF2 application. -
Profit! The user profile page is mounted on the URL path
/user/profile
by default.
If you're fortunate enough to be on a *nix system with PHP >=5.4 and pdo_sqlite
, pop into the demo
folder and run the setup script (run.sh
). This will build the demo application, install the example profile extension module, and start a webserver. Once that's all done just open your browser and:
- Navigate to
http://localhost:8080/user/register
- Create an account
- Navigate to
http://localhost:8080/user/profile
You can override the configuration of LdcUserProfile by copying the dist config file into the config/autoload
folder of your ZF2 application and dropping the .dist
suffix. Now you can modify the configuration variables within to change the behavior of LdcUserProfile
!
Using the configuration override you can specify which fields in each extension are editable. For example, to allow only the user to change their display name and password in the ZfcUser extension you would put this in the ldc-user-profile.global.php.dist
file:
'validation_group_override' => array(
'zfcuser' => array(
'display_name
'password',
'passwordVerify',
),
),
The structure provided to validation_group_override
is fed directly into Form::setValidationGroup
to enable only the specified form fields.
The bundled demo module ExtensionModule
provides a succinct example of how to implement your own profile extension.