Okay
  Public Ticket #3532285
Front end editing
Closed

Comments

  • Graham started the conversation

    Hello

    I have seen and read as much as I can with front-end editing. I have played with this in my wp-local-app.  I like this functionality, but I would like to change the functionality. It will be a genealogy Surname Table for all (logged-in and non-logged-in) to view all records.

    I require non-logged-in users to be able to see all of the table but not edit it. 

    Logged-in members to create new entries and edit their entries (Works well; now I have the used ID working, and the only editors are Admin and Subscribers) and logged-in members to see all the data in the table, just not theirs.

    I have seen the video about SQL for admins to see the entire table in another wpDataTable, and this would work for the admins. 

    Is there a way this can be achieved?

    Thanks

    Graham

  •  1,708
    Miloš replied

    Hi Graham,

    I am not sure if i fully understood all the details of the desired use-case.


    1. For example, if you need one main Table for Administrators, so they can see and edit everything;

    and another SQL Query based table that calls/pulls the same Data, and any editing will get saved in the same "main Table", while setting certain limitations such as "each user can only see and edit their own rows", for that we have an easy solution, like this :

    You can have one main/master Manual table which will store all the data in the database.

    Then, you can check this table's MySQL Table name from the Editing tab in the back-end table settings,

    and you will be able to make multiple SQL tables that pulls data from the same "master table",

    and any editing you do on all these other SQL tables are going to be stored in the same table in the database,

    This will be my example table :

    3791094982.png

    Now, to make a new SQL Table from it,

    first, check in Editing Tab/MySQL table name for editing:

    6795720227.png

    in my example, the Manual table name is wp_wpdatatable_39,

    so i make a new SQL table that will pull data from it;

    and we can choose all columns like :

    SELECT * FROM Table_Name

    or just specific columns;

    we can also have completely different settings/filtering/sorting and limitations for front-end users on each table;

    and you can make multiple SQL Query tables that pull the same data from the "main table".

    SELECT  column_name1,
            column_name2,
            column_name3
    FROM table_name

    -

    In this example, if i want to limit to only show the "Company" column, and i will leave wdt_ID ( because we got to have row ID)  and userid ( if we want userID for limiting rows per currently logged user ID),

    when i hide those columns in the end, the front-end user will only see the "company" column.

    SELECT  wdt_ID,    
        userid,     
      company    
       FROM wp_wpdatatable_39
    4596672496.png

    Later, you can make another SQL Table that will show some other columns, have other filters and so on ( depending on what you need to achieve)...

    You can see my Video example here https://watch.screencastify.com/v/jOXrsJ9jaspWG5m3VqZH



    2. When it comes to "Editor Roles", you can use this if you need a Table which can be seen by everyone, but just edited by specific Roles, as you did now to only allow Admin role and Subscriber Role to edit.

    But this restriction does not limit them to just edit "their own rows" - they can edit all rows in that case.


    If you need the same Table to have the option for "view all rows" but just "edit the rows each user added", for that we currently do not have a built-in solution yet.

    ( In our "see and edit own rows", if you activate that, it is going to filter to only show them their own rows, too)

    But you can add this as a development suggestion for the future.

    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.


    3. So at this time, you can only try having multiple Tables, and setting different limitations on them.

    For example, you could set one Page where you place a Table which shows all rows - and in Editor Roles you can just allow Admins to edit, that one can be for non logged users area;

    And for specific editing of "edit only the rows they added", you would need a second SQL Query based Table, for that table activate the "user can only see and edit their rows" - and that one can be used for the "members editing".

    I hope that helps.

    Let me know if you have any questions.

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    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

  • Graham replied

    Miloš

    Thank you for the reply. Your ideas worked; I have two pages with a table on each. One table where the member has to be signed in and can only manage/see their entries. 

    The second page is an SQL selecting all for the table above. I hide the email column in the table. How can I reference a single cell in a row, the email address, and parse that to a form etc?

    Thanks

    Graham

  •  1,708
    Miloš replied

    Hi Graham,

    1. You're welcome, i am happy that these suggestions worked for your use-case.

    2. In regards to referencing a singe cell in a row, the email address, and parsing it to a Form,etc;

    i believe this is the same as you requested on the other ticket?

    Please refer to the answer for that there.


    In short, we don't have a built-in solution at the moment;

    If you just need to send an Email with some custom hook;

    I can only share this example which our developers explained :

    For sending emails, you can use this:

    https://www.a2hosting.com/kb/installable-applications/optimization-and-configuration/wordpress2/sending-e-mail-in-wordpress#:~:text=To%20send%20an%20e%2Dmail,authentication%20settings%20you%20defined%20above

    And to take values after Apply is hit, there's this hook:

    wpdatatables_after_frontent_edit_row( $formdata, $rowId, $tableId ) This action is executed after editing action is applied.

    $formdata is the array of keys and values for editing.

    $rowId is the ID field of the row in MySQL table that was edited.

    $tableId is the table identifier from the MySQL plugin table (wp_wpdatatables).

    For example:

    function sendEmailAfterEdit( $formdata, $rowId, $tableId ){ // create logic for sending emails } add_action('wpdatatables_after_frontent_edit_row', 'sendEmailAfterEdit',10,3);

    will be triggered in both cases when you edit or adding a new row in the table from front-end. Please note that data is already saved in database.

    Please note that using hooks requires certain level of programming skills and included support refers only to advice.

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    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