-
Notifications
You must be signed in to change notification settings - Fork 5
Installation
Latest jCommunity version works only with Jelix 1.6 and higher. You need to upgrade Jelix to the latest minor release of the branch you use. Minimum supported version is 1.6.21.
Download the package from https://download.jelix.org/jelix/modules/jcommunity/ and extract it somewhere.
You can then move modules/jcommunity into a module repository of your application, or declare the directory into the mainconfig.ini.php (for Jelix 1.6), or into the application.init.php (for Jelix 1.7+).
In your composer.json, in the require section, indicate:
"jelix/jcommunity-module": "1.3"
After a composer update
:
- if you use Jelix 1.6, you can declare jcommunity in the modulePath
parameter of the configuration. Example:
modulePath=(...);app:vendors/jelix/jcommunity-module/modules/
- if you use Jelix 1.7 or higher, it is automatically declared.
Once the module files are into your application, you should launch the installer.
- if you use Jelix 1.6, launch this command:
php install/installer.php
- if you use Jelix 1.7+, launch this command:
php dev.php module:configure jcommunity
It will ask you some configuration parameters.
If you want jmessenger:
php dev.php module:configure jmessenger
Then, you finish with this command:
php install/installer.php
jCommunity is provided with en_US, fr_FR and pt_PT locales.
If you want other languages, download corresponding zip files from https://download.jelix.org/jelix/langpacks/jcommunity/
and unzip them into the app/locales/
directory of your application if you
are a developper, or into the var/locales
if you want to add locales to
a Jelix application you just installed.
You should do nothing about them. Uninstall and deactivate them. jCommunity provides its own sql table, and its own dao. jCommunity provides all needed things, with some different behaviors.
jCommunity 1.1+ can be used with the master_admin module. Continue the installation by reading the specific manual for this purpose.
If you install jCommunity in an existing application, there is probably an existing table for users, with a corresponding DAO and jForm files.
You have to modify the dao file to add fields required by jCommunity.
If the dao file was not created by you, "overload" it, by copying it into
var/overloads/<the module>/daos/
, and you will modify this copy.
Modify the dao file by adding new fields and adding same methods as in the file jcommunity/daos/user.dao.xml. Fields status, keyactivate, request_date, create_date and login are required.
Modify also the form file you use (or overload it) with the new fields. see an example in jcommunity/forms/account_admin.form.xml.
You will have to add the manualconfig
parameters for the installer (see below).
The install script of the module will automatically add new fields into the table.
In the configuration of the application, activate the module and the auth plugin for the coordinator:
[modules]
jauth.access = 0
jauthdb.access = 0
jcommunity.access = 2
jcommunity.installparam =
[coordplugins]
auth=auth.coord.ini.php
Configure also parameters in the mailer section. jCommunity needs to send mail to users.
The installer supports some parameters. You should list them into the
jcommunity.installparam
, with a semi colon as separator.
-
manualconfig
: indicate to not change configuration of auth.coord.ini.php when it already exists and you want to use your own table, dao, form etc. -
defaultuser
: register an "admin" user (passowrd: "admin") into the community_users table -
masteradmin
(1.1+): indicate that jcommunity is used for master_admin module. see the dedicated chapter -
migratejauthdbusers
(1.1+): indicate to do migration jlx_users records to community_users - Note:
rewriteconfig
andnotjcommunitytable
parameters does not exist anymore since 1.2.
Example:
jcommunity.installparam = "manualconfig;defaultuser"
Don't forget double quotes, else characters after ";" will be interpreted as a comment.
With jCommunity 1.1+, you can use jPref to allow to change some settings. If you want to use it, you should also install the jpref module:
[modules]
jpref.access = 2
To finish the setup, launch the installer
php cmd.php installapp
It then creates or update the table indicated into the dao used for the users.
By default it will be a community_users
table. If you have already a table
of users, you can add new fields of community_users
in your table.
You should then override all DAOs of the jcommunity module to change fieldnames
and the table.
The auth coordplugin is automatically activated in your configuration. However,
verify in your ini file yourapp/var/config/auth.coord.ini.php
, that you have these values:
driver = Db
on_error_action = "jcommunity~login:out"
bad_ip_action = "jcommunity~login:out"
persistant_crypt_key= "INSERT HERE A SENTENCE"
[Db]
; name of the dao to get user datas
dao = "jcommunity~user"
form = "jcommunity~account_admin"
See the dedicated page.
You can integrate the "status" zone into your main template (directly into the template or via your main response).
$response->body->assignZone('STATUS', 'jcommunity~status');
It shows links to the login form, the register form if the user isn't authenticated, or to the logout page and account page if he is authenticated.
You can change the start action in index/config.ini.php like this (Jelix 1.6):
startModule=jcommunity
startAction="login:index"
if you use significant urls, link urls_account.xml, urls_auth.xml and urls_registration.xml to the main urls.xml of the application
<url pathinfo="/auth" module="jcommunity" include="urls_auth.xml"/>
<url pathinfo="/profile" module="jcommunity" include="urls_account.xml"/>
<url pathinfo="/registration" module="jcommunity" include="urls_registration.xml"/>