Is it possible to allow users to only update existing record in a table. That means that user will not able to create a new row or delete an existing row.
1. Since you have multiple tables on a page, you need to add an identifier to the code. All table wrappers are added as odd numbers; for example if you have three tables, they'd be identified as:
table_1_wrapper
table_3_wrapper
table_5_wrapper
So, to hide the buttons only for the first table on that page, the code needs to be:
this is a solution indeed, but it is a bad one and extremely unsecure. Someone with just a bit of html programming knowledge can simply "unhide" the hidden ADD/DELETE buttons just by using simple css debugger inside each modern browser.
Is there a better solution available to actually disable (not just hide) the ADD/DELETE buttons so the only available operation is EDIT in any case? This would be actually the only viable solution. I know this can be done on MySQL server side as well, but anyway, there should be an option to define desired operactions on specific table.
thank you for your fast answer. I would kindly like to ask you for some hints which lines to comment out, I guess this could be also useful for someone else and maybe also a good idea to make this a selectable option in the next update.
May I ask one more thing? I noticed that no matter which input field type I use (html editor or multi-line input string), there's no option to save some random html tags into the MySQL table. For instance, if I just add string like <table> it will be stripped out and not saved eventually. On the other hand tag <p> is saved ok. Meaning there's no way to save random html structures. How come? Is there a workaround maybe? I would really need an option to save random html code into MySQL cells.
Sure, you can go to ../wp-content/plugins/wpdatatables/source/class.wpdatatable.php and at line 3414 you will see the buttons:
Since you need the "Edit" button, but not "Add new" and "Delete", you can comment the two arrays that contain DTTT_button_new and DTTT_button_delete. You also need to remove the comma in DTTT_button_edit array, so it all looks like this:
When you save this, the table will display only the Edit button:
This then brings up the "Apply and add new" button in the edit modal:
To remove that, go to ../wp-content/plugins/wpdatatables/templates/frontend/edit_dialog.inc.php and around line 166 you'll see that button:
Comment that too, so it looks like this:
And it will disappear from the modal:
That should cover the issue about CSS and front-end. Please note, though, that this will be applied to all your tables, and it can't be excluded only for selected tables.
As for HTML tags, some are being stripped because the plugin's logic cannot include them. <table> for example already exists on the page, so if you add it in a cell, it could become a paradox, so it is automatically removed. On the other hand - some other HTML tags work fine.
thank you so much for this reply regarding the buttons. This is indeed way better solution, than plain css hiding.
In regards to adding various HTML tags to mysql db arrays. Is there maybe an option to somehow overcome this limitation? Or maybe better question, if I'd like to save an array or timetable or price-table or something similar into one single mysql cell, houw would I be able to achieve that anyway? I have another wysiwyg editor which completely ok saves everything into mysql db, but as soon as edit/save with wpdt, the table tags are gone. Is there maybe also an option to edit some lines of code to disable this limitation so you can input anything and everything possible as plain text? This would be the best option I guess.
Since this is a question that's not related to the topic of the ticket, and since we're writing on someone else's ticket, can you please open a new ticket in wpDataTables section, and I'll try to help you there.
Modifying the plugin definitely falls under customization, and is not included in the provided support for the plugin, but I'll see if there's anything we can do about this.
Please go to ../wp-content/plugins/wpdatatables/controllers/wdt_ajax_actions.php, and comment the line 292. Also, in ../wp-content/plugins/wpdatatables/controllers/wdt_ajax_actions.php comment the line 567, and that should help.
now this is a perfect solution. I tried all possible combinations and for now I was unable to create a "paradox" which would destroy outside <table> structure in any case. Also, there's no issues with saving whichever HTML structure in one single mysql cell now. Shortly, it works as it should.
Maybe one question though. Commenting out these two clauses, if I understood correctly, enables completely all HTML tags, not just the ones that are defined there? If this is true, would it be also ok, if I just add the missing tags I need to the list (i.e. <table>,<tr>,<td>,<tbody>, and remaining closing tags...)?
However, this is something that should be included into the final release as well, maybe just like an option to enable/disable it. Something like: "Allow all HTML tags" or "Allow only basic/secure HTML tags".
And of course, besides that, an option to enable "code" editing inside TinyMCE from wp-admin would be perfect with that solution as well. It's described here and it works perfectly:
Stripping the tags is included for security reasons. I have forwarded your request to our development team, and they said they already have this planned. I cannot promise that it will be included in the next update, so please check the file again when the plugin updates.
You will need to comment those two lines again once the plugin updates.
Hi Alex,
Is it possible to allow users to only update existing record in a table. That means that user will not able to create a new row or delete an existing row.
This restriction will be on certain tables only.
Thanks in advance.
Regards,
Syed
Hello Syed.
Sure, you can add this as HTML above the table's shortcode:
That will remove the "New Entry" and "Delete" buttons from that table.
Kind Regards,
Aleksandar Vuković
[email protected]
Rate my support
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables
Thanks Alex.
Will the same code work for popup menu buttons for Edit and Delete?
Regards,
Furqan
Hi again Furqan.
Yeah, the buttons are the same, and it will hide those as well.
Kind Regards,
Aleksandar Vuković
[email protected]
Rate my support
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables
Hi Alex,
Hopw you are doing great. Actually the fix you provided worked but has two problems.
1) It removes Delete and Create buttons on all the tables on that page. Where as wanted this to be implemented only on certain tables.
2) Although I have removed Delete button but the Edit dialogue also has "Apply and Add New" button that break the purpose.
Regards,
Furqan
Hi again Furqan.
Doing well, thanks! Hope you're doing great too!
1. Since you have multiple tables on a page, you need to add an identifier to the code. All table wrappers are added as odd numbers; for example if you have three tables, they'd be identified as:
table_1_wrapper
table_3_wrapper
table_5_wrapper
So, to hide the buttons only for the first table on that page, the code needs to be:
2. To hide "Apply and Add New" button from the modal, you will need to use this CSS:
If you need it for the second table, just change #table_1 to #table_3, and so on.
Please let me know if that worked.
Kind Regards,
Aleksandar Vuković
[email protected]
Rate my support
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables
Hello,
this is a solution indeed, but it is a bad one and extremely unsecure. Someone with just a bit of html programming knowledge can simply "unhide" the hidden ADD/DELETE buttons just by using simple css debugger inside each modern browser.
Is there a better solution available to actually disable (not just hide) the ADD/DELETE buttons so the only available operation is EDIT in any case? This would be actually the only viable solution. I know this can be done on MySQL server side as well, but anyway, there should be an option to define desired operactions on specific table.
Kind regards, Tomaz.
Hello Tomaz
That is true, of course, but unfortunately at the moment it's the only way to hide the buttons.
To remove them completely, you'd need to go into the code, and comment the lines where those two buttons are defined.
If you're interested in that, please let me know and I'll tell you what you need to comment.
Kind Regards,
Aleksandar Vuković
[email protected]
Rate my support
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables
Hi Aleksander,
thank you for your fast answer. I would kindly like to ask you for some hints which lines to comment out, I guess this could be also useful for someone else and maybe also a good idea to make this a selectable option in the next update.
May I ask one more thing? I noticed that no matter which input field type I use (html editor or multi-line input string), there's no option to save some random html tags into the MySQL table. For instance, if I just add string like <table> it will be stripped out and not saved eventually. On the other hand tag <p> is saved ok. Meaning there's no way to save random html structures. How come? Is there a workaround maybe? I would really need an option to save random html code into MySQL cells.
Kind regards, Tomaz.
Hi again Tomaz
Sure, you can go to ../wp-content/plugins/wpdatatables/source/class.wpdatatable.php and at line 3414 you will see the buttons:
Since you need the "Edit" button, but not "Add new" and "Delete", you can comment the two arrays that contain DTTT_button_new and DTTT_button_delete. You also need to remove the comma in DTTT_button_edit array, so it all looks like this:
When you save this, the table will display only the Edit button:
This then brings up the "Apply and add new" button in the edit modal:
To remove that, go to ../wp-content/plugins/wpdatatables/templates/frontend/edit_dialog.inc.php and around line 166 you'll see that button:
Comment that too, so it looks like this:
And it will disappear from the modal:
That should cover the issue about CSS and front-end. Please note, though, that this will be applied to all your tables, and it can't be excluded only for selected tables.
As for HTML tags, some are being stripped because the plugin's logic cannot include them. <table> for example already exists on the page, so if you add it in a cell, it could become a paradox, so it is automatically removed. On the other hand - some other HTML tags work fine.
Kind Regards,
Aleksandar Vuković
[email protected]
Rate my support
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables
Hello Aleksander,
thank you so much for this reply regarding the buttons. This is indeed way better solution, than plain css hiding.
In regards to adding various HTML tags to mysql db arrays. Is there maybe an option to somehow overcome this limitation? Or maybe better question, if I'd like to save an array or timetable or price-table or something similar into one single mysql cell, houw would I be able to achieve that anyway? I have another wysiwyg editor which completely ok saves everything into mysql db, but as soon as edit/save with wpdt, the table tags are gone. Is there maybe also an option to edit some lines of code to disable this limitation so you can input anything and everything possible as plain text? This would be the best option I guess.
Kind regards, Tomaz.
You're welcome Tomaz
Since this is a question that's not related to the topic of the ticket, and since we're writing on someone else's ticket, can you please open a new ticket in wpDataTables section, and I'll try to help you there.
Modifying the plugin definitely falls under customization, and is not included in the provided support for the plugin, but I'll see if there's anything we can do about this.
Kind Regards,
Aleksandar Vuković
[email protected]
Rate my support
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables
Hi again Tomaz.
Here's what you can do:
Please go to ../wp-content/plugins/wpdatatables/controllers/wdt_ajax_actions.php, and comment the line 292. Also, in ../wp-content/plugins/wpdatatables/controllers/wdt_ajax_actions.php comment the line 567, and that should help.
Kind Regards,
Aleksandar Vuković
[email protected]
Rate my support
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables
Hi Aleksander,
now this is a perfect solution. I tried all possible combinations and for now I was unable to create a "paradox" which would destroy outside <table> structure in any case. Also, there's no issues with saving whichever HTML structure in one single mysql cell now. Shortly, it works as it should.
Maybe one question though. Commenting out these two clauses, if I understood correctly, enables completely all HTML tags, not just the ones that are defined there? If this is true, would it be also ok, if I just add the missing tags I need to the list (i.e. <table>,<tr>,<td>,<tbody>, and remaining closing tags...)?
However, this is something that should be included into the final release as well, maybe just like an option to enable/disable it. Something like: "Allow all HTML tags" or "Allow only basic/secure HTML tags".
And of course, besides that, an option to enable "code" editing inside TinyMCE from wp-admin would be perfect with that solution as well. It's described here and it works perfectly:
https://tmsplugins.ticksy.com/ticket/2254255/
Thank you for now, and please include these two fixes into the coming release. They're both really needed additions to this great plugin.
Kind regards, Tomaz.
Hello again Tomaz
I'm glad to hear this works.
Stripping the tags is included for security reasons. I have forwarded your request to our development team, and they said they already have this planned. I cannot promise that it will be included in the next update, so please check the file again when the plugin updates.
You will need to comment those two lines again once the plugin updates.
Kind Regards,
Aleksandar Vuković
[email protected]
Rate my support
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables