HOWTO: Create a user in CB - with Auto Action

fribse 17 Jan, 2017
I just got a super easy way of creating a user in CB, if you have the AutoAction CB plugin.
Instead of doing a lot of PHP coding, and including all sorts of stuff from CB, just ask CB to register the user for you, this is the way to do it, and it will work even if the framework in CB is changed.

1) Add a Custom Code module in your chronoforms, add this code:
<?php
global $_PLUGINS;
if ( ( ! file_exists( JPATH_SITE . '/libraries/CBLib/CBLib/Core/CBLib.php' ) ) || ( ! file_exists( JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php' ) ) ) {
	echo 'CB not installed'; return;
}
include_once( JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php' );
cbimport( 'cb.html' );

$_PLUGINS->loadPluginGroup( 'user' );

$_PLUGINS->trigger( 'OnChronoUser', array( $form->data ) );

?>

2) Create a Custom Trigger in CB, in auto actions, create a new auto action, and under Triggers you enter what you like, with this code example it's OnChronoUser and press Enter, this will create a new trigger
3) Set the Type of Auto Action to Registratin
4) Set access to Everybody
[attachment=0]global.png[/attachment]
5) In the Action Tab, fill in the form field names so they fit the user registration, if you have more fields than the standard set, they can be added as well
[attachment=1]action1.png[/attachment]
[attachment=2]action2.png[/attachment]

That's it, all the fields you want to register is just a question of entering their form names.
GreyHead 17 Jan, 2017
Hi fribse,

Looks useful thank you.

In case you had missed it there is an Enable CB Support option in the ChronoForms Joomla! Registration action that will add a new user to the CB Tables. That probably has less flexibility than your method though.

Bob
fribse 18 Jan, 2017
I know the CB checkmark, but the problem is, as far as I can see, that it does not 'fire' the CB Triggers when used, the AutoAction will do that.
The drawback of this method here is that you need autoaction plugin.
This topic is locked and no more replies can be posted.