Introduction
This plug-in allows you to create new Joomla users, or edit existing Joomla users
Note if you want to
update the Joomla user associated with the form's record when you edit the form's data you must supply a field (type field or dbjoin,
not type user) in the "User ID field" and a "usergroups" element in the "User group field" option in the 'Fields' section.
These fields may be hidden but must be accessible (writable). So if you allow user registration via the Fabrik form the access (
Elements and group containing the
Elements) must be public.
Options - Fields
The first series of dropdowns (name, username, password, email, block, user id and user group) allow you to map your Fabrik element's to the Joomla user properties.
Joomla default value for Block: 0 = enabled / unblock; 1 = disabled / block
Options - Bypass Joomla Settings
- Bypass activation - By default, and with this option set to 'No' the plug-in will use Joomla's standard activation emails and settings to control how users confirm their account. If you don't want this to occur, then set this option to 'Yes', by doing so users are automatically created and confirmed.
- Bypass registration - Again by default, and with this option set to 'No' the plug-in will respect Joomla's 'Allow User Registration' setting (found under Joomla's user manager -> Options section). If set to 'Yes' users can always be created regardless of the Joomla setting
- Account details email - If set to 'No' then the default email will not be sent to the registering user confirming their account creation. This could be useful if you wanted to use the Fabrik email form plugin to send a custom email
- Bypass all Email - If Yes, no email will be sent by this plugin. Instead you can use an Fabrik form email plugin. This will allow you to use HTML, PHP or article templates to customize your registration email.
Options
- Default user group - this is the default user group that the user will be assigned to - will be overridden by the user group field, if it is selected.
- Condition - PHP code that if supplied should return true to enable the plugin, or return false to disable the plugin. Example:
Code:
return '{mytable___myelement}' == 'some value needed to enable the plugin';
Options - Sync
- Delete users - If set to yes, then the associated Joomla user is deleted when the Fabrik row is deleted, for this to work a user id field must have been selected
- Auto Login - if set to yes we will try to log in the user as soon as the form is submitted.
- Synchronize Users - If you have existing Joomla users and are creating this form, and want to copy over those previous users into the form's list, then set this option to 'yes'. Upon loading the form for the first time and creating a new user, the juser plugin will create Fabrik list records for all the previously created Joomla users. Note this only occurs when the form's list is empty (e.g. upon the first submission of the form)
- Sync on Edit - If set to 'yes' then upon saving an exisitng record, the Joomla user's details are syncronised with the form's data.
Creating a Menu Item
Once you have created a registration or profile form using the juser plugin, you will usually wish to link to it with a J! menu item. To do this, you will need to specify two additional
Options in the usual Fabrik Form menu creation. Usually when loading a form, Fabrik uses the Primary Key value as the row ID. But in the case of a profile form, you need to tell Fabrik to look up the row using the logged on user's J! user ID. If the user already has a form, their row will be used. if they don't, a new one will be created.
The two special
Options are:
- Row ID - set this to -1, which tells Fabrik to use the logged on J! user ID, if the user is logged on.
- Key name - you need to tell Fabrik which element on your form is the User element, the one that stores the J! user ID. In this example, that would be 'userid'.
Overriding J! Registration Link
Something else you may need to do is override your default J! site registration link to point to your form. To do this, you need to override the standard J! registration link, using J!'s standard template override mechanism.
For example, if you are using the Cassiopeia template :
- create the following folder : ./templates/cassiopeia/html/com_users/registration
- replace cassiopeia with whatever J! template you are using. In that folder, create a default.php file with the following code:
PHP:
<?php
defined('_JEXEC') or die;
$myurl = 'index.php?option=com_fabrik&view=form&formid=X&rowid=0'; //Replace X with your fabrik form ID
/*if you have a menu item calling this form you can redirect to it, something like
$myurl = '/userreg-form'; //replace with whatever URL the steps from Creating a Menu Item produces
*/
$app = Joomla\CMS\Factory::getApplication();
$app->redirect(Joomla\CMS\Router\Route::_($myurl));
?>