Buy Now
Sign in

Edit and Delete Table Records

hangbill , June 18 2019, 11:00
H
hangbill 270
June 18 2019, 11:00 #387612
Have looked through posts but cannot find how to do this. And I don't see any component documentation.
So a couple of related questions here, one for a logged in user and another for the administrator.
Logged In User
Want this person to edit own record (no delete)
Administrator
This person can edit and delete all records
How to approach this.
Thanks
healyhatman 8
June 18 2019, 11:36 #387615
{user:id} gets the current user id so you can read the requisite record or save the correct record.
You can check if the user is an admin by checking if there is an entry on user_usergroup_map with the user id and the required group id
Web developer at SkySpider.com.au - I DO NOT work for ChronoEngine!
Donations: paypal.me/healyhatman
Professional Work: kamron@skyspider.com.au
Custom CF / CC Plugins and Extensions: skyspider.com.au/store
H
hangbill 270
August 21 2019, 09:09 #388941
Back at this prob again.
Am sure in ConnectivityV5 I had a table listing with an edit and delete tick box at end of table. So admin could do rapid edits/ deletes.
How to do this in ConnectivityV6, on 2 joined tables ?
Thanks
healyhatman 8
August 21 2019, 09:17 #388942
Look at the dynamic actions demo
Web developer at SkySpider.com.au - I DO NOT work for ChronoEngine!
Donations: paypal.me/healyhatman
Professional Work: kamron@skyspider.com.au
Custom CF / CC Plugins and Extensions: skyspider.com.au/store
H
hangbill 270
August 21 2019, 09:18 #388943
k, thanks
H
hangbill 270
August 28 2019, 11:05 #389011
Installed dynamic actions demo and have the delete page looking like it should delete but seems delete event not firing. Have tried to follow the demo as closely as possible. I am deleting a record from 2 related tables => a user record from the Joomla users table and the record in the related table that holds additional user data.
Have included some pics to try show what I've done.
Also not sure why there are 2 delete icons, one red one black - followed the dynamic action demo classes and content settings, and tried omitting some settings. Anyway most important task now is getting the delete working.
One thing I do not follow in the dynamic action demo is the article_id= .... . For eg the delete condition id:{data:article_id} in the delete_article function. Is article_id an url parameter created in the view article_delete_confirm ?
Thanks
https://snipboard.io/B5XWli.jpg
https://snipboard.io/9zBuW3.jpg
https://snipboard.io/SCLOPl.jpg
https://snipboard.io/389f6a.jpg
https://snipboard.io/dlK61C.jpg
https://snipboard.io/ijCcEy.jpg
https://snipboard.io/IKzwdh.jpg
H
hangbill 270
August 30 2019, 11:31 #389041
Any feedback on this one, please.
H
hangbill 270
September 01 2019, 16:52 #389077
OK, made some progress.
Two related Joomla tables => users (joomla core) and misc_user_addfields.
users (pk) = id
misc_user_addfields (pk) = id
misc_user_addfields (fk) = userid
Want to delete a record, ie all fields (39) where users.id = misc_user_addfields.userid.
So in a delete_member function have created and linked 2 models (member and member_misc_fields). This returns all 39 fields if I tick include all the provider fields in the list view. But this creates a directory list of 39 columns. I want a list with just a few columns from each table , just enough for the admin person to identify the correct record for deletion.
I have been experimenting with different delete conditions in the delete_member function but have repeatedly been deleting all users from the users table. But not from the related misc_user_table. Then have to reinstall the Super User with phpMyAdmin. Took an hour to figure how to do this, getting quite good at it now. Think caused by using continuous in the delete conditions. Ticking protect against full deletion did not protect against full deletion.
The deletion conditions
id={data:id}use
userid={data:id}use
results in 1052 Column 'id' in where clause is ambiguous
Any help?
Thanks
healyhatman 8
September 01 2019, 21:57 #389079
What are you using for your where condition in the delete action
Web developer at SkySpider.com.au - I DO NOT work for ChronoEngine!
Donations: paypal.me/healyhatman
Professional Work: kamron@skyspider.com.au
Custom CF / CC Plugins and Extensions: skyspider.com.au/store
H
hangbill 270
September 02 2019, 05:28 #389081
Is this the where condition you mean?
https://snipboard.io/EmL7YB.jpg
H
hangbill 270
September 04 2019, 01:40 #389101
The delete event fails although seems correct url parameter is passed.
https://snipboard.io/kgTEF1.jpg
https://snipboard.io/udU9cf.jpg
Where to start looking?
Thanks
H
hangbill 270
September 04 2019, 01:46 #389102
Partially solved - in the where condition changed {data:id} to {data:user_id}. But success messg not firing.
H
hangbill 270
September 05 2019, 01:47 #389115
The delete function works now. The correct record is deleted from both fields. And in the Where condition have said that users 62 and 1258 are not to be deleted. This works.
But cant figure why the success and error messgs are not firing. I have followed the dynamic actions demo closely and cannot see why it does not work.
Any thoughts?
Thanks
https://snipboard.io/kqZhDK.jpg
https://snipboard.io/VQEiAW.jpg
https://snipboard.io/EAn9hI.jpg
https://snipboard.io/ebwBdc.jpg
H
hangbill 270
September 05 2019, 12:04 #389122
Although the delete_member function works correctly, seems the switch function check_delete_result is not receiving a true or false value.
H
hangbill 270
September 06 2019, 10:45 #389133
Any help on this one, thanks.
H
hangbill 270
September 11 2019, 11:50 #389169
Solved the delete messg not firing, thanks Max.
In the data provider I had {var:delete_member} => copied the format in the dynamic actions demo.
Should be {var.empty:delete_member}
https://snipboard.io/kUdhvL.jpg