Okay
  Public Ticket #3228496
Make a Column visible but locked
Closed

Comments

  • Geoffrey Stertz started the conversation

    Is it possible to make a particular column visible to the end user but editable only to admins?

  •  1,850
    Miloš replied

    Hi, Geoffrey 

    Firstly, I would like to sincerely apologize for the delayed response as we have been experiencing an unusually high number of tickets. I am sorry that it has taken longer than usual to respond to your concern and your patience is highly appreciated.

    -

    At the moment, we don't have any built-in solution to achieve having only one or more specific columns editable only for Admins, but to disable editing for front-end users, if we use one/same table.

    For one table we can only set Editor Roles,   then if we allow editing for certain roles, 

    and any column that we allow one of the available "Editor types", and according to the user roles we allow in 'Editor Roles' in Editing settings of the table, they will be able to edit all these "editable" columns.

    The only solution would be to make two tables - one for Admins, and another SQL table for front-end users.

    ( Both tables have to be SQL-based,  then check in the first table what is the MySQL Table Name for editing, in the Editing tab,

    and make a new SQL Table with Query : "SELECT * FROM table_name")

    In the Admin table you can set which columns will be editable and set Editor Role only to Admin,

    while for the other SQL table for front-end users, you can limit which columns they are only allowed to edit.

    -

    It is an interesting idea for a future improvement/feature, though.

    Please feel free to search on our suggestions page

     to see if someone may be already suggested this feature. If you can't see it, feel free to add your suggestion there,  and as more people vote, the feature will move higher on the priority list.

    You can certainly follow our changeLog page if you'd like ( it is also available in the plugin dashboard), where we state any changes/new features/bug fixes during updates;

    and our newsletter, so you're informed about new features, bug fixes, freebies, etc.

    -

    If you have coding skills and wish to try to make a custom solution now,

    you can check out our available hooks for Developers on this documentation and see if you can find any hook that might help.

    Please be advised that custom solutions with hooks are not included in our support.

    You can also research resources such as Stack Overflow to see if any other user perhaps found a workaround.

    ( We do like to give examples for certain solutions, but for this use-case, we, unfortunately, don't have anything yet)


    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    Try our FREE mapping plugin! MapSVG - easy Google maps, interactive SVG maps and floor plans, choropleth maps and much more - https://wordpress.org/plugins/mapsvg-lite-interactive-vector-maps/

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia 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

  •  1,850
    Miloš replied



    Hi, Geoffrey 

    Sorry about that, actually i found a workaround, there is a way if you use custom CSS on a table, and this only works to disable a column editing on the front-end completely, so nobody will be able to edit it on front-end.

    ( I know it's still not ideal, you probably want to allow Admin to edit it on front and back-end, while disabling it for other users, but we don't have a valid solution for that yet);

    You can make a column editable with an Editor type enabled,  then Admin can edit it on back-end;

    and if you only wish to make it uneditable in the front-end,  then add this CSS, but add it only directly to the WordPress page, 

    because if you add this in the plugin's table settings/Customize/Custom CSS - then Admins also won't be able to edit it on the back-end.

    #table_1_edit_dialog > div.row.wdt-edit-dialog-fields-block > div:nth-child(2) {
        display: none !important;
    }

    This example CSS works on my Editable column which i show on these screenshots, but for your table, you have to open the developer console in the browser, then use this little arrow at the bottom left corner as i highlight it,

    then click on top of the HTML DIV that holds the entire element of this column in the Editor Modal;

    in the HTML right click and "copy selector";

    then go to the right side, in the "Styles tab" and paste this selector as a new CSS rule on the page.

    9067066013.png
    3678460217.png

    And in the end, add the "display: none !important;"  property to it.

    Or you can just try my CSS and change this number for "nth child" in the statement until you pick the right column.

    Custom code needs to be applied to the page where the booking form is. Depending on what you're using (Gutenberg blocks, or some page builder), adding the CSS or JS can be done in a few different ways. 

    If you need help with adding custom CSS to the page, please take a look at this article.

    -

    That's the only workaround i can think of with the current plugin capabilities.

    Let me know if that works as a temporary solution until the devs come up with better solution in the future.

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    Try our FREE mapping plugin! MapSVG - easy Google maps, interactive SVG maps and floor plans, choropleth maps and much more - https://wordpress.org/plugins/mapsvg-lite-interactive-vector-maps/

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia 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

  • Geoffrey Stertz replied

    Thank you! I was able to use this and it's working great.

  •   Miloš replied privately