New joomla users

4 months 3 days ago #329588 by activha
New joomla users was created by activha
Hello

It may be a simple solution but I cannot see it :

- we use CB for all users management and have set as recommended : do not allow joomla registration
- we use a new component RS Tickets pro for ticket management which allow not registered users to post a ticket and automatically create a new joomla user with name and password.

At this stage, the joomla user is created, it's linked with a new profile in acymailing, but it does not sync with CB and so does not receive the email with credentials, nor can it access all CB area.

What did I miss to have the new joomla user be synced with CB ?
Plugin Cb core redirect is activated and all is enabled.

Please Log in to join the conversation.

4 months 2 days ago #329592 by krileon
Replied by krileon on topic New joomla users
We don't have automatic user synchronization. Your extension is directly calling Joomla API to create a new user. That would need to be changed to call CB API. If there's a Joomla event in RS Tickets Pro just before that happens you might be able to override that behavior using CB Auto Actions, but you'd need to contact them about that.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

4 months 2 days ago #329597 by activha
Replied by activha on topic New joomla users
This is what RS Joomla team is doing :

We've however just included 2 more triggers for this since you're saying this needs specific RSTickets!Pro triggers (which shouldn't normally matter as your third party product could had used these Joomla! triggers and then further modify that else they may need in the database).

Nevertheless, you'll need to download RSTickets!Pro once again from our website and install it over your current one (this acts as an update and will include 2 new extra triggers; we haven't officially released a new version for this since we're still working on the next one) - note that if you've made source code to RSTickets!Pro, such changes will be lost.

After the manual update, the component will include these 2 triggers:

$app->triggerEvent('onRsticketsproBeforeCreateUser', array($user));

$app->triggerEvent('onRsticketsproAfterCreateUser', array($user));


Within your third party plugin where the user is being manipulated, you could use these as (examples):

public function onRsticketsproBeforeCreateUser($user)
{
//overriding the name property before creating the user:
$user->set('name', 'Jean');
}


public function onRsticketsproAfterCreateUser($user)
{
//after the user is created, this dumps the user's data within the respective pointed out file:
file_put_contents(JPATH_SITE . '/user.txt', print_r($user, true));
}


For example, data user dump:

Joomla\CMS\User\User Object
(
[isRoot:protected] =>
[id] => 96
[name] => Jean
[username] => nuexist
[email] => nuexist@nuexist.com
[password] => $2y$10$xWLaVrKj7q33XtVK07FAQ.tbPS7JIF2MA2tOBolLWs0xDZqu1lJ.S
[password_clear] => 4gIQzyBF
[block] => 0
[sendEmail] => 0
[registerDate] => 2022-06-03 06:27:01
[lastvisitDate] =>
[activation] =>
[params] => {}
[groups] => Array
(
[0] => 2
)

[guest] => 1
[lastResetTime] =>
[resetCount] =>
[requireReset] =>
[_params:protected] => Joomla\Registry\Registry Object
(
[data:protected] => stdClass Object
(
)

[initialized:protected] =>
[separator] => .
)

[_authGroups:protected] =>
[_authLevels:protected] =>
[_authActions:protected] =>
[_errorMsg:protected] =>
[_errors:protected] => Array
(
)

[aid] => 0
[password2] => 4gIQzyBF
)


As you can see from this data, you have details like the $user->id available to return the user's created ID (as I'm assuming this being the most important detail in further adjusting data).

Regards!


Now, how can I set up an autoaction from this to sync joomla users and CB users ?

Please Log in to join the conversation.

4 months 1 day ago - 3 months 4 weeks ago #329602 by krileon
Replied by krileon on topic New joomla users
You can act on onRsticketsproBeforeCreateUser and onRsticketsproAfterCreateUser in CB Auto Actions by prefixing it with joomla_. So in CB Auto Actions you'd have the following.

Global
Triggers: joomla_onRsticketsproAfterCreateUser
Type: Code
User: Automatic
Access: Everybody
Action
Method: PHP
Code:
$newUser	=	new \CB\Database\Table\UserTable();

$newUser->load( (int) '[var1_id]' );

if ( ( ! $newUser->getInt( 'id', 0 ) ) || ( ! $newUser->store() ) ) {
	return;
}

activateUser( $newUser, 1, 'UserRegistration' );

$_PLUGINS->trigger( 'onAfterUserRegistration', [ &$newUser, &$newUser, true ] );

I believe that should work. It should load the existing Joomla user into a CB user, store them so they exist in CB, then run normal registration activation process (confirmation email, etc..), followed by the normal registration trigger for integrations.

We'll eventually have an automatic synchronization process for when a user is created outside of CB, but currently we do not so it requires something like this.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

4 months 1 day ago - 4 months 1 day ago #329605 by activha
Replied by activha on topic New joomla users
I have an error
Action 283 :: Code failed. Error: Class 'UserTable' not found

then I added
use \Joomla\CMS\Table\Table;

but still no sync...

I guess that as I'm adding a new external user, shouldn't I use something else for User ?
For instance a php code to retrieve the new user added by their function createUser ?

Please Log in to join the conversation.

4 months 1 day ago #329606 by krileon
Replied by krileon on topic New joomla users
Retry with my edited code above. It includes the namespace.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.231 seconds