User deletes his account - how to?

Can you post:
* a link to your form.
* screen shots of you list settings
* screen shots of your form settings.

Can you check that you have selected the correct field in the juser form plugins 'User ID field' ?
 
I'm going to have to set up a test, in the configuration I think you have.

There are several potential gotchas with using the J! #__users table as either the main table, or a joined table, when using the juser plugin.

At the moment, I only have a test case set up for one of the three possible scenarios. Been meaning to set the the other two up for ages, ever since I lost them when I had a little, ehem, ok, huge database disaster and lost all my test cases about a year ago!

And unfortunately the one I have set up isn't either of the two possibilities you might using.

-- hugh
 
I have the problem that when I add a new record, UserID is not prefilled to the ID of the Joomla users ID (I guess it should be that way)

Is 'UserID' the element on your userdetails table which stores the user ID?

If so, did you implement the change JFQ gave you, which was "your join should be between the id of the users table and a user_id element in the userdetails table". So basically, your UserId element you mentioned is the "user_id" element in JFQ's description?

If so, is UserId set to be a Fabrik 'user' element?

And is it also the element you have set as the "User ID Field" in the JUser form plugin settings?


-- hugh
 
Joit - you may want to sit tight while Rob and I thrash something out,as I think you have a setup which won't work, and/or can potentially damage your J! users table.

Rob - some notes ...

The reason I'm concerned about what I think is his setup is here, where the "main" table/form with the JUser is the Fabrik table (in this case 'userdetails'), with a join to the #__users table, is that we end up writing the #__user row out.

In the juser code, we check to see if #__users is the main table, and if so we set $formModel->_storeMainRow to false. So #__users row doesn't get saved directly by us, all changes to it are made through the JUser API, but we'll save any joined table row(s).

But ... if #__users is a joined table, this doesn't apply, and we save the joined #__users row during the normal form model processToDb() handling. Which I'm sure will have unwanted side effects, like screwing with any data that has been massaged by any 3rd party plugins running on JUser events, and (from a cursory look) screwing up things like the 'params' field. And ... we have no equivalent of $formModel->_storeMainRow for joined row(s).

My other concern is altering field types on the joined elements. Although that's a worry either way we do the join - need to set "Don't alter" on #__users either way, and I can't remember if we can selectively set that on JUST the main table, or JUST joined tables, or only on all of them as one unit.

What I'm trying to work out is whether this is a "valid" way of doing things ... having the Fabrik list as the master, with #__users joined to it, or whether the only "valid" way of linking a Fabrik extended profile table to #__users is to have #__users as the "main" table.

By "valid", I really mean, whether it is feasible to have Fabrik not save the #__users join, by adding code similar to the $formModel->_storeMainRow logic for a joined row, and how much work that involves in changes to processToDb() and the juser plugin code.

-- hugh
 
I think this is a dangerous setting also.
What I recommended was to have #__users as MAIN table, THEN join another table for additional data, with a join from #__users.id to #__anothertable.user_id (where user_id is a regular "field" element, not a "user" element).
 
Can you post:
* a link to your form.
* screen shots of you list settings
* screen shots of your form settings.

Can you check that you have selected the correct field in the juser form plugins 'User ID field' ?

I have it on a test site, so some things look a bit messy. Here the link:
http://www.joit.de/test/beiladen/index.php/de/anmeldung-users

attached the screen shots. On my user details list I put the join to J! users table. On J! user table form I put juser plugin. I'm not sure about the correct field in the juser form plugins 'User ID field', please see the screen shot.

Thanks to all!
 

Attachments

  • userDetails-list.jpg
    userDetails-list.jpg
    101.3 KB · Views: 343
  • users-form.png
    users-form.png
    109.4 KB · Views: 348
I think this is a dangerous setting also.
What I recommended was to have #__users as MAIN table, THEN join another table for additional data, with a join from #__users.id to #__anothertable.user_id (where user_id is a regular "field" element, not a "user" element).

So did I just do it the wrong way?
 
Is 'UserID' the element on your userdetails table which stores the user ID?
It is joined to it, see the screenshot

If so, did you implement the change JFQ gave you, which was "your join should be between the id of the users table and a user_id element in the userdetails table". So basically, your UserId element you mentioned is the "user_id" element in JFQ's description?
Yes

If so, is UserId set to be a Fabrik 'user' element?
Not sure what you mean by that?

And is it also the element you have set as the "User ID Field" in the JUser form plugin settings?
Yes, please see the screenshot from the post above
 

Attachments

  • userid.png
    userid.png
    19.5 KB · Views: 343
So did I just do it the wrong way?

Well, not so much that you've done it the "wrong" way, just that I'm not 100% sure the way you have it set up will work.

Although if you have the juser plugin on the form which is built on the J! users table, not on your userdetails form, then it may be OK.

But I still have some reservations, and need to test some stuff.

-- hugh
 
Well I think the draw back to this solution is that I think (I haven't test it) users can't delete their account.
The "delete user" option in the JUser plugin is set so when you delete a user in jos_users table, it deletes the corresponding one in the "fabrik_users" table (the table you created with Fabrik), not the other way around.
So to me the safest and most complete method (I have tested it and it works fine), is the first one, as I described it: start with the jos_users table, then left join to your "extra" table.
Your setting might work (start with "extra" table, then right join to jos_users) but, besides being less intuitive, you seem to run into issues, so it is not probably the right solution.
 
So all I need to do to make it run savely is to start with joomla user table and left join the extra table? I can do that!
Just to make sure, on which form do I have to put the juser plugin? On joomla user or extra table?
 
I tried to do a left join from the joomla users table but it just won't work. The tables don't merge. I have no idea why. Can you please look at the screen shot?
eremygat.jpg
 

Attachments

  • uploadfromtaptalk1362485851691.jpg
    uploadfromtaptalk1362485851691.jpg
    64.7 KB · Views: 322
I'm still working through some issues with my various permutations of how to set this kind of thing up.

-- hugh
 
When I had the right join, I could look at the joined / merged table and see the two tables like they where one. Shouldn't that work for left join, too?
 
Yes, in the case of the right join, you probably made a menu link to the "details" list whilst with a left join, you have to make this link to the jos_users list to see the "merged" tables.
 
Sorry about this one. I'm working on my tablet these days and I didn't see the details because they're one the right side next to the user's elements so I have to scroll...
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top