user group plugin question registration

Hello,

I have build a custom registration form with Joomla + Fabrik.

I have a "user_group" field. How can I manipulate the user groups that will get assigned to a new registration? My Form will sync with Joomla tables "users" and "user_usergroup_map" as long as I use...

ELEMENT -> user_group (Plugin user_group) -> "Default to current user's groups" -> Yes
 
Currently I believe the only way is to use PHP plugin onBeforeProcess and inject the needed goups. That however would mean, I have to alter "user_usergroup_map" with Joomla tables using PHP as well.

Or is there a better way to pick the groups I want in that field "user_group" (Plugin: user_group) and have a sync with all related Joomla tables?
 
Tried this onBeforeProcess...but it will strip the special characters (willtry to escape them):

$formModel->updateFormData('xfabrik_user___user_group', '["2"]', true);

Therefore in database I only get 2 instead of ["2"]. Also I still have to code the entries for Joomla groups table user_usergroup_map
 
Last edited:
Well, escaping doesn't work or I am doing it wrong:

$formModel->updateFormData('xfabrik_user___user_group', '\[\"2\"\]', true);
 
With my registration form, I am running "Plug-ins -> juser". I have set a Group Whitelist with "Plugi-ins -> juser -> Options" and "Default user group = Public". I am still getting current logged in user groups as predefined groups for a new user. How can I choose the groups a new user will get assigned to?
 
Well, it's actually easy to manipulate the groups. I needed an array with updateFormData.

Once you have created a custom registration form, you need 2 plugins with this form:

1. PHP (onBeforeProcess)
2. JUSER (onBeforeProcess)

Code for 1:

This code will update the field user_group with your registration form. We are assigning user_group 2 and 10 to a new registration or user. Field user_group is an element and uses usergroup plugin.

Code:
$formModel->updateFormData('#___user_group', array(2,10), true);

Code for 2:
Actually you just need to link your fields like password, username, usergroup etc. to Joomla user fields. This plugin will then sync Joomla tables users and user_usergroup_map.

Important:
SQL auto_increment with your custom registration table should match with Joomla table users.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top