Joomla - Hika User synchronization

  • Posts: 82
  • Thank you received: 1
10 years 8 months ago #181632

-- HikaShop version -- : 2.3.4 Business

How and when does the user synchronization occur ?
Here is my scenario:
Main registrations on the website are done through Hikashop user registration form.
However I have another 3rd party form, that is also adding users in jos_users, both in front-end and backend. This is required for a few other features of the website...
I noticed though that those users are not added into hikashop.
Is the hika plugin able to synchronize the hika_user table with data from the jos_users table ? When and how is this happening ?
Or I should take care the creation of new hika_user with the submission of my other form?

Please Log in or Create an account to join the conversation.

  • Posts: 82
  • Thank you received: 1
10 years 8 months ago #181636

Upon the creation of a new user, the hika_user table is automatically updated and contains the new user. But I haven't found any way to sync hika_user table with records already existing in jos_users. Is this possible?

Please Log in or Create an account to join the conversation.

  • Posts: 84220
  • Thank you received: 13672
  • MODERATOR
10 years 8 months ago #181661

Hi,

The synchronization is handled with the HikaShop user synchronization plugin which is triggered by the Joomla library each time joomla or another extension calls the Joomla library in order to create a new user.
If you create new users directly in the database, without going through the functions of the Joomla library, you're also bypassing the synchronization plugin of HikaShop and thus you don't get the user in the hikashop_user table
All the properly coded/mainstream extensions for Joomla will call the Joomla library in order to create a new user so that the plugins can be triggered so that other extensions can do their things at that point.

If it's a custom development work for one website you're doing where you're saving the user data directly in jos_users and you don't want to change all your code an have a quick solution, then simply also add an entry in hikashop_user at the same time where the user_cms_id correspond to the id in the jos_user table and the user_email correspond to the email in the jos_user table and then it will work fine.

Please Log in or Create an account to join the conversation.

  • Posts: 82
  • Thank you received: 1
10 years 8 months ago #181707

Thanks Nicolas!
Yep, that's exactly the case - I had imported records directly from the database and this how exactly I figured this out after studying the hika_user table. I run an SQL insert query containing the jos_user.id and the jos_user.email fields of the records.

Here is a sample of a complete INSERT query syntax for the hikashop_user table, for anyone who might need something similar:

INSERT INTO `jos_hikashop_user` (`user_id`, `user_cms_id`, `user_email`, `user_partner_email`, `user_params`, `user_partner_id`, `user_partner_price`, `user_partner_paid`, `user_created_ip`, `user_unpaid_amount`, `user_partner_currency_id`, `user_created`, `user_currency_id`, `user_partner_activated`)
VALUES

('', 3387, 'This email address is being protected from spambots. You need JavaScript enabled to view it.', '', '', 0, 0.00000, 0, '127.0.0.1', 0.00000, 0, 1417187337, 0, 0),
('', 3388, 'This email address is being protected from spambots. You need JavaScript enabled to view it.', '', '', 0, 0.00000, 0, '127.0.0.1', 0.00000, 0, 1417187337, 0, 0);

Please Log in or Create an account to join the conversation.

Time to create page: 0.062 seconds
Powered by Kunena Forum