chieff/yii2-user-profile-module

There is no license information available for the latest version (dev-master) of this package.

User profile for webvimark/user-management

dev-master 2023-12-22 09:09 UTC

This package is auto-updated.

Last update: 2024-04-22 09:49:54 UTC


README

Perks

  • Uses yii2-user-management-module (webvimark module-user-management fork)
  • User profile (includes avatar, sex, firstname, lastname, patronymic, date of birth, phone number, about, job title and social links (vk, ok, telegram, whatsapp, viber, youtube, twitter, facebook) fields)
  • Avatar encoding
  • Profile data encoding
  • Forms for create, update, view users and registration

Installation

The preferred way to install this extension is through composer.

Either run

composer require chieff/yii2-user-profile-module

or add

"chieff/yii2-user-profile-module": "dev-master"

to the require section of your composer.json file.

Forked

It is a fork of webvimark module-user-management, so be sure that you are not using that module in require section of composer. This may have an impact because of this fork uses same namespaces. Also you can not use:

But don't be scared, this fork includes that packages but with another name for better working!

Configuration

  1. In your config/web.php
'modules' => [
    'user-profile' => [
        'class' => 'chieff\modules\UserProfile\UserProfileModule',
    ]
],
  • If you want avatar be encoded, use
'avatarEncode' => true
  • If you want data be encoded, use
'dataEncode' => true
  • If you want avatar or data be encoded, also use
'passphrase' => 'your passphare'

Current profile table includes only varchar columns because of possible data encoding that can be string or number. If you don't want to use data encoding at all, use option for migration that will create optimal table:

'dataEncodeMigration' => false
  1. Also add routes for user-management module in your config/web.php
'modules' => [
    'user-management' => [
        'registrationFormClass' => 'chieff\modules\UserProfile\models\forms\RegistrationForm',
        'registrationFormClassView' => '@vendor\chieff\yii2-user-profile-module\views\auth\registration',
        'registrationFormScenario' => 'defaultUser', // Use encodedUser, if you are using dataEncode
        'profileModelClass' => '\chieff\modules\UserProfile\models\UserProfile',
        'userCreatePath' => '/user-profile/profile/create',
        'userUpdatePath' => '/user-profile/profile/update',
        'userViewPath'   => '/user-profile/profile/view',
    ]
],
  1. Follow instructions yii2-user-management-module and complete migrations

  2. Run migrations from the console

./yii migrate --migrationPath=vendor/chieff/yii2-user-profile-module/migrations/

If you want delete tables later and didn't migrate another tables, use:

./yii migrate/down 3 --migrationPath=vendor/chieff/yii2-user-profile-module/migrations/

To see full list of options check UserProfileModule file

Icons

To see icons:

class AppAsset extends AssetBundle
{
	// ...
	public $depends = [
		// ...
		'rmrevin\yii\fontawesome\AssetBundle'
	];
}

Datepicker

For date and datetime fields used kartik-v/yii2-widget-datepicker and kartik-v/yii2-widget-datetimepicker , it need bootstrap directive of version. Put in config/params.php code below for version that you are using:

<?php

return [
    'bsVersion' => '4',
    'adminEmail' => 'admin@example.com',
    // ...
];