Okay
  Public Ticket #3173097
Activity Log
Open

Comments

  • Venice Ann started the conversation

    I have a table which I added manually

    What I want is to link the wp_users table to it so, whenever a user adds a new entry I will know his or her name. More of like an Activity Log where I can monitor who added a new entry or who edit and delete an existing entry. I know you have a feature that is called "Users see and edit only own data". But I don't want to enable that feature because I want New or existing users to add new entry on One table only.

    I would really appreciate it if you have a workaround on this or any tutorial that you could point me to make this possible.


  •  1,239
    Miloš replied

    Hi ,Venice 

    Thanks for reaching out to us

    -

    In regards to making a solution that could store the current user's name in tables :

    If you take a look at all our available dynamic Placeholders here, you will notice that amongst them we have 

    • %CURRENT_USER_LOGIN% – this placeholder will be replaced with the currently logged-in username (if the user is logged in).
    • %CURRENT_USER_FIRST_NAME% – this placeholder will be replaced with the First Name of the currently logged-in user. Provide a value here to be used for table generation.
    • %CURRENT_USER_LAST_NAME% – this placeholder will be replaced with the Last Name of the currently logged-in user. Provide a value here to be used for table generation.

    -

    You could add a hidden column to this table, and set the Predefined Editor Value to as %CURRENT_USER_LOGIN%

    2484995138.png

    This would set a predefined editing value to come up as the currently logged-in username (if the user is logged in)

    But it will not stop the user from editing it during adding New Entry.

    If the row gets saved - and someone else comes to edit or delete it,

    it will still look like this until they edit it, so that's not a solution for your use-case.

    -

    That is the best i could come up with, but as you see, unfortunately for this specific use-case, we don't currently have a valid solution with any of our built-in options.

    -

    In terms of sending the edited data via a custom solution with a hook,  i covered everything about that on your other ticket, please refer to https://tmsplugins.ticksy.com/ticket/3167796/.

    And i also explained there that,  if you need new features/solutions that are not yet available, you can suggest a future improvement idea to our developers on our Suggestions Page,

    and they will do their best to create a solution in the future;

    -

    If you need a solution now, you can reach out to someone like WP Kraken, and ask them if they could create a custom workaround,  we just can't advise on their pricing.

    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

    You can try wpDataTables add-ons before purchase on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  • Venice Ann replied

    That could work but is there a way to hide user name field when adding new entry and editing an existing entry? If there is a CSS code just to hide it and use placeholder to auto populate it that would be great.

    Attached files:  Hide.png

  •  1,239
    Miloš replied

    Hi, Venice

    I see what you mean, thank you for that - you gave me an idea of what to try.

    Here is what i came up with.

    By selecting the HTML element that has the same CSS class across the entire input / edit Form,  i use the "nth child" CSS selector, in order to figure out exactly which HTML element holds the user ID and the Username on my test table example.

    2386504000.png
    1280840430.png

    This is the CSS i added to the table, in back-end table settings,

    Customize/Custom CSS:

    #table_1_edit_dialog > div.row.wdt-edit-dialog-fields-block > div:nth-child(5){
        
        display :none !important
        
    } #table_1_edit_dialog > div.row.wdt-edit-dialog-fields-block > div:nth-child(6){
        
        display :none !important
        
    }
    8446065295.png


    As you see, on my table it turns out that the div:nth-child numbers are child 5 and child 6,

    for "user ID field" and "userName" field,

    on your table the "div child" numbers will probably be different, 

    but i think you should be able to achieve this by using this method, just to get the right Div child numbers in the CSS code.

    -

    Let me know if that helped.smile.png Thank you

    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

    You can try wpDataTables add-ons before purchase on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  • Venice Ann replied

    I'll try your workaround. I was wondering if you have a way to create an Activity Logs for front end. I did sent a suggestion on that feature does it take time for them to add that feature? The reason why I'm persistent with these because this is the missing puzzle to my Add, Edit and Delete Data entry table. Also, how do you make the Date and Time column static? Like if a user added an entry I will be able to see what time and date he or she added the data is this possible? I really appreciate your help..



  •  1,239
    Miloš replied

    Hi, Venice

    1. Regarding the CSS to hide the form elements you need, i can devise the CSS for you,

    if you have the table on a page send me the URL,

     or even in the back-end, the same CSS will work,

    so i can do that on the back-end of the table;

    if you wish you can send me any Admin credentials to log in remotely and let me know  of the table ID.

    Just if you send me any confidential info, make sure to mark reply as PRIVATE so that nobody sees them but us.

    2.

    In regards to a "time stamp" column, to get a log when a new entry is added;

    For example, If you need a simple auto pre-populate for the column Date and Time, to be the current Date Time,

    we have a placeholder,

    that you can use as a predefined editor value.

    -

    Here is how you can do it :

    Set column type to DateTime;

    9626039055.png

    Then, in the Editor Type, set as "one line edit",  and set the predefined editor value as the placeholder %CURRENT_DATETIME% :

    1626344206.png

    And then, if someone tries to add a new row,   this column's value will automatically be default as the current date and time :

    7417353783.png

    -

    We can then hide the column from editing with CSS ( in a similar way as we will do with the user ID and username editing fields)

    2.

    There is also a custom SQL workaround, for SQL tables, if you need a timestamp :

    1. Create a column (for example "Updated") in your table

    2. In column settings set the type to be "DateTime" (in the "Data" tab), and in the "Editing" tab set the "Editor Input Type" to "none".

    3. In the database, run this query:

    ALTER TABLE `table_name` CHANGE `updated` `updated` DATETIME NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
    

    Please note that you need to replace 'table_name' with the actual database table name. You can find the database name of the table in the Editing tab above the table, in the "MySQL query name for editing" field.

    I hope that helps.

    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

    You can try wpDataTables add-ons before purchase on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  •   Venice Ann replied privately
  •   Venice Ann replied privately
  •   Venice Ann replied privately
  •   Miloš replied privately
  •   Miloš replied privately
  •   Venice Ann replied privately