1. Fabrik 3.8 has been released. As usual, we strongly recommend that you backup your site (using Akeeba) before upgrading. Report any issues in the forums, we will answer promptly.

failed: Duplicate Entry - on std joomla table

Discussion in 'Standard Support' started by Rob_UK, Apr 14, 2012.

  1. Rob_UK

    Rob_UK New Member

    Level: Community
    I've had this issue for over a day and looking at the forums, I am wondering if it is due to a Fabrik limitation, though I am rather hoping that it's me missing something obvious.

    What I am trying to achieve
    To create an input form to add Joomla users and their groups to enable easy adding of users (later Fabrik CSV import) with some preset values, at this point this just being their allocation to a single user group.

    Approach taken
    1. Created and saved a List linked to ##_users (Joomla users)

    2. Linked above list to ##_user_usergroup_map (Joomla user ID and group ID) by using:
    left JOIN ##_user_usergroup_map ON ##_users.id = ##_user_usergroup_map.user_id

    3. Set forms, fields, etc as necessary with the element group_id set to a default of 9 (a new group set up in Joomla) as Integer 10 to match DB setting.

    The forms add a new user fine, but although they show the default group value of 9, it is only storing the user and group value in ##_user_usergroup_map the first time I use the form.

    Any subsequent additions of users generate the error.

    Store row failed:
    Duplicate entry '0-9' for key 'PRIMARY' SQL=INSERT INTO `##_user_usergroup_map` ( `group_id` ) VALUES ( '9' )

    I get the impression that Fabrik needs tables to have unique index (?) but joomla ##_user_usergroup_map doesn't. Not sure if this is the problem or how to get around it.

    This has stopped me on my tracks. Hopefully I have just missed something obvious as I learn to use Fabrik, any help will be much appreciated.
  2. troester

    troester Well-Known Member Staff Member

    Level: Standard
    #_user_usergroup_map has primary key user_id + group_id. As far as I know fabrik doesn't handle PKs on multiple columns.

    But do you know the form plugin juser (create Joomla user)? This should do what you are looking for.
    1 person likes this.
  3. Rob_UK

    Rob_UK New Member

    Level: Community
    JUser Plugin

    Thanks for the reply Troester, that’s very helpful.

    I did not know about the JUser plugin (no notes in wiki yet and it was not installed on the main install that I used) but I have now seen that it is on Github.

    I’ve now done my first Github update and can now see it! It looks promising. I’ll drop my initial approach and will see if I can get the desired results with JUser. Will update this thread once I have progressed further.
  4. Rob_UK

    Rob_UK New Member

    Level: Community
    Juser seems to be working well. Thanks.
  5. cheyennemtnman

    cheyennemtnman Member

    Level: Community
    Can you use Juser to do multiple entries... say 1 - 10 user creations in one session?
  6. Rob_UK

    Rob_UK New Member

    Level: Community
    Although I have yet to use it, one option is to export and import lists from the list view. So you can export a list to a csv file, edit it and import it back in.

Share This Page