User plugin not syncing with Joomla

develum

New Member
I am having issues getting the User form plugin to Sync users. It worked one time and has since not worked.

I went from using a field to store the User Groups, then switched to the usergroup plugin, found that didn't really work the way I wanted and switched back to field, but it still refuses to sync the users.

I have mapped all the fields and set the menu options to -1 and the userid field name, still no luck.

Here is some screenshots. I heard the usergroup plugin has problems, so its fine that the usergroup field is hidden, but I need the users to sync so I can have them update their profiles.

Not sure what else to try at this point, I feel I have exhausted looking through the options.
 

Attachments

  • Screen Shot 2014-08-11 at 6.21.12 PM.png
    Screen Shot 2014-08-11 at 6.21.12 PM.png
    17.8 KB · Views: 322
  • Screen Shot 2014-08-11 at 6.20.48 PM.png
    Screen Shot 2014-08-11 at 6.20.48 PM.png
    33.4 KB · Views: 346
  • Screen Shot 2014-08-11 at 6.20.31 PM.png
    Screen Shot 2014-08-11 at 6.20.31 PM.png
    30.8 KB · Views: 315
  • Screen Shot 2014-08-11 at 6.19.52 PM.png
    Screen Shot 2014-08-11 at 6.19.52 PM.png
    39 KB · Views: 379
Hmm, looks like the User sync is somewhat misleading, reviewing the code, it seems to check your usertable for users, if it has users in it already, whether or not it matches the number of users in the master Joomla #__users table, it will not sync the users anymore.

I was expecting the code to populate the users that are missing from the #__users table and update any values that might have changed between the Joomla users table and your Fabrik users table.

Does anyone have a modified version of this plugin that syncs on every update?

code review of onLoad() in plugins/fabrik_form/jusers/juser.php

Code:
if ($params->get('synchro_users') == 1)
        {
            $app = JFactory::getApplication();
            $listModel = $formModel->getlistModel();
            $fabrikDb = $listModel->getDb();
            $tableName = $listModel->getTable()->db_table_name; //this is set to your custom fabrik user table
 
            $query = $fabrikDb->getQuery(true);
            $query->select('COUNT(*)')->from($tableName);  //this just gets rows that exist in your custom table
 
            // Is there already any record in our F! table Users
            $fabrikDb->setQuery($query);
            $count = (int) $fabrikDb->loadResult();
 
/*
I was expecting here to check the count of  #__users == #__custom_fabrik_users_table, if they are not the same, then the values would update.
*/
            if ($count === 0)
            {
                try
                {
                    // Load the list of users from #__users
                    $query->clear();
                    $query->select('DISTINCT u.*, ug.group_id')->from($fabrikDb->quoteName('#__users') . 'AS u')
                        ->join('LEFT', '#__user_usergroup_map AS ug ON ug.user_id = u.id')->group('u.id')->order('u.id ASC');
                    $fabrikDb->setQuery($query);
                    $origUsers = $fabrikDb->loadObjectList();
 
That code is for a one time set up to sync previous Joomla users into the synced fabrik list.
Once that is done the sync (or creation of new joomla users) occurs when the form is saved in the onBeforeStore() method.

I set up pretty much the same test case as your screen shots and the form will load my profile data and when I save it - say changing the user name, the J user name is also updated.

Are you using the 3.1 download or the latest code from the github joomla3 branch? If its the 3.1 code perhaps wait till later on today when hopefully I will release a new version.
If it was from github then could you fill in the details of your site on http://fabrikar.com/you/my-sites/ and I will take a look to see what settings might be different to the test case I made
 
Ok well that makes sense, I guess I should be creating new users with my form, although the form doesn't currently expose the usergroup. I will changing things up and see if the user population works better that way.

Thanks.

I am currently working on the 3.1 version. I will attempt to update maybe later today if I run into issues.
 
Oh, and just so's you know, the "sync on edit" feature might need explaining. What it does, is when the form for an existing row is loaded, it'll take whatever is in the J! users table for that user for your linked fields (the ones you have set up associated form elements for in the juser plugin settings), and use those values to populate the form with as it renders, rather than the values in your Fabrik list / table.

HOWEVER, those values are NOT stored to the Fabrik list UNLESS the form is saved. This can be a little misleading, as it means you can load a form and see data from the J! users table, which is different to the actual content of the Fabrik list, and if the you don't save the form, what you saw in the form is not what is stored in your list. I'm not entirely happy with this behavior, but "it is what it is" for the moment.

"One of these days" I'd like to revisit the juser plugin, and re-vamp it so you have a simpler set of clear options, which clearly allow you to set up which way the sync happens ... so that we basically either designate the Fabrik list as the "master" for sync, or the J! users as the master, or as a "two way sync" option, that integrates changes both ways. It's just very nerve wracking making any significant changes (or even small changes!) to the juser plugin, as any booboos can have very nasty side effects.

And of course one of our main problems in any kind of user management is we can't really stop changes being made outside of Fabrik to the J! users, or easily detect when changes are made (unless they are being made "properly", and whatever extension is doing it, fires the right system plugins, which is unfortunately not always the case). That's getting in to full "community extension" territory (like CB or JomSocial), which is a whole big can of worms in itself.

Anyway ... let us know how you get on.

-- hugh
 
Has the 2 way sync been resolved? When I delete a user from the User > Manage section, it doesn't update the Fabrik user list
 
I'm also having a bit of trouble with the juser plugin.
It doesn't seem to synch the J! user id with the Fabrik created ID.
So when I use the pre-filter setting in lists, it finds no records. Eg. User/Patient "X" has ID 13 in J! user ID, and ID 54 in Fabrik.

I'll be glad to fund a fix of the above and the following suggestion:
so that we basically either designate the Fabrik list as the "master" for sync, or the J! users as the master, or as a "two way sync" option, that integrates changes both ways.
 
That doesn't sound like anything to do with the issue in the OP on this thread.

Can you post a new thread? And make sure I have the details I need in My Sites so I can login and check.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top