• Hello Fabrik Community

    Fabrik is now in the hands of the development team that brought you Fabrik for Joomla 4. We have recently transitioned the Fabrik site over to a new server and are busy trying to clean it up. We have upgraded the site to Joomla 4 and are running the latest version of Fabrik 4. We have also upgraded the Xenforo forum software to the latest version. Many of the widgets you might have been used to on the forum are no longer operational, many abandoned by the developers. We hope to bring back some of the important ones as we have time.

    Exciting times to be sure.

    The Fabrik 4.0 Official release is now available. In addition, the Fabrik codebase is now available in a public repository. See the notices about these in the announcements section

    We wish to shout out a very big Thank You to all of you who have made donations. They have really helped. But we can always use more...wink..wink..

    Also a big Thank You to those of you who have been assisting others in the forum. This takes a very big burden off of us as we work on bugs, the website and the future of Fabrik.

Logs form plugin

  • Views Views: 14,486
  • Last updated Last updated:

Navigation

         Form Article Plugin Tutorial
      Autofill form plugin
      Clone form plugin
      Comment form plugin
      Email form plugin
      EXIF form plugin
      FTP form plugin
      J2store form plugin
      Kunena form plugin
      Limit form plugin
      Logs form plugin
      Mailchimp form plugin
      Paginate form plugin
      Paypal form plugin
      PHP form plugin
      Pingdotfm form plugin
      Receipt form plugin
      Redirect form plugin
      REST form plugin
      Slack form plugin (+)
      SMS form plugin
      Twitter form plugin
      Upsert form plugin
      VBforum form plugin
      Create a Search Form
      Accordion Form Groups
  • This is an update to for the logs taken from the initial post located here: https://fabrikar.com/forums/index.php?threads/doc-logs-plugin.12308/
    -------------------------------------------------------------------------------------------
    Installation
    -------------------------------------------------------------------------------------------
    Usage
    This plugin must be installed and added to your form.
    There are several configuration Options which range from
    • logging to database
    • Logging to file (csv, htm, txt)
    • logging to email
    -------------------------------------------------------------------------------------------
    Screenshot of settings (older version)

    index.php


    -------------------------------------------------------------------------------------------
    Plugin configuration (based on the latest version in Joomla 3 series)
    -------------------------------------------------------------------------------------------
    Record in DB
    • Will records the logs in the database
    • Yes/No
    Table suffix
    Leave blank to record into the default #__{package}_log table. Enter a suffix (e.g. _history) to automatically create and then fill a custom DB based on the table from where the records are added/edited (if the form stores records in the table jos_fb_mytable, the logs will be stored in jos_fb_mytable_history with the example suffix is given above).
    -------------------------------------------------------------------------------------------
    Date format
    -------------------------------------------------------------------------------------------
    Record IP
    • Yes/No
    Record user Referrer?
    • Yes/No
    Record User Agent?
    • Yes/No
    -------------------------------------------------------------------------------------------
    OR template message
    Customize the message to store in the file and/or DB.
    • Use {tablename___elementname} Placeholders to insert the form's data into the message.</li><li>{Add/Edit} will be replaced by added/edited.
    • {DATE} will be replaced by the date defined above.
    • Use {$_SERVER->REMOTE_ADDR}, {$_SERVER->HTTP_REFERER} and {$_SERVER->HTTP_USER_AGENT} to record those data.
    • For creating a CSV file labels and/or recording into a custom table (see 'Suffix table' option above), define the labels/fields by putting them between '++' (specify the fieldtype if you record in DB with ==) and the data to record between double quotes.
    • Examples and info at http://bit.ly/3TFwEl
    Example Templates for CSV data
    In #__fabrik_log and/or a TXT or HTM file: you can record a human-readable sentence such as:
    "User Fedepia added a record entitled This is my title, on 2009-08-25 09:10:32. His IP is XXX.XXX.XX.XX"​
    Template message:
    User {$my->username} {Add/Edit} a record entitled {testfabrik___title_element}, on {DATE}. His IP is {$_SERVER->REMOTE_ADDR}​

    In custom DB and/or CSV file: you will need to define the fields/CSV labels and also the data to record:
    Fields/CSV labels --> username, action, title, date, ip
    Data to record -----> Fedepia, added, This is my title, 2009-08-25 09:10:32, XXX.XXX.XX.XX​
    Template message for CSV only:
    ++username++ "{$my->username}" ++action++ "{Add/Edit}" ++title++ "{testfabrik___title_element}" ++date++ "{DATE}" ++ip++ "{$_SERVER->REMOTE_ADDR}"​
    or
    ++username++ ++action++ ++title++ ++date++ ++ip++ "{$my->username}" "{Add/Edit}" "{testfabrik___title_element}" "{DATE}" "{$_SERVER->REMOTE_ADDR}"
    Template message for CSV AND/OR Custom DB:
    ++username==varchar++ "{$my->username}" ++action==varchar++ "{Add/Edit}" ++title==varchar++ "{testfabrik___title_element}" ++date==datetime++ "{DATE}" ++ip==varchar++ "{$_SERVER->REMOTE_ADDR}"​
    or
    ++username==varchar++ ++action==varchar++ ++title==varchar++ ++date=datetime++ ++ip==varchar++ "{$my->username}" "{Add/Edit}" "{testfabrik___title_element}" "{DATE}" "{$_SERVER->REMOTE_ADDR}"
    Combining readable sentence and fields/CSV labels: Indeed, you may want both by using either:
    • A readable sentence to record in #__fabrik_log AND a CSV file.
    • A custom Database AND a readable sentence in a TXT or HTM file.
    In both cases template message
    User ++username==varchar++ "{$my->username}" ++action==varchar++ "{Add/Edit}" a record entitled ++title==varchar++ "{testfabrik___title_element}", on ++date==datetime++ "{DATE}". His ip is ++ip==varchar++ "{$_SERVER->REMOTE_ADDR}"
    -------------------------------------------------------------------------------------------
    Compare data (Work In Progress!!)
    If 'Yes' then the changes made on an edited record will be displayed in the file and/or DB
    -------------------------------------------------------------------------------------------
    Record in File
    Will records the logs in a file

    Path
    Path, starting from the J!Root, where the log files will be stored. Default use the existing folder 'logs/'. Use {tablename___elementname} Placeholders to insert the form's data into the path (e.g logs/mydir/{mytable___userelement}/). The folder(s) will be created if not exists. WITH ending slash.

    examples
    logs/by_user/form_id_{testfabrik___fabrik_internal_id}/
    logs/{$my->username}/formname/


    Filename
    Name of the log file. Use {tablename___elementname} Placeholders to insert the form's data into the filename (e.g logs_user{mytable___userelement}). The file will be opened if it already exists or will be created if it doesn't. Without space or special characters.

    example
    formname-{$my->username}

    Add random filename
    Will add a random filename after the one you choose above, depending on the length you specify below. THE 'APPEND METHOD' BELOW WILL NOT WORK WITH THIS OPTION TURNED ON!

    Length
    Length of the random filename to generate

    File format
    File format you want to use. If CSV and if you choose the Append option below, please choose once and for all which data (IP, Referrer, ...) will be stored and don't change it afterwards as the columns will not match anymore.

    Dataset separator
    Separator to use between different datasets within the same file (for HTM or TXT only)

    Append or Overwrite
    If Append is selected, the new log data will be added at the end of the file. If Overwrite is selected, the new log data will replace existing ones
    -------------------------------------------------------------------------------------------
    Record details view
    Will keep track of users visiting a record's details view depending on what you want to register. For now, this is recording in the default #__{package}_log DB

    If visitor
    If the user visiting the details view is not a registered one, what do we do? 'No' won't record anything, 'IP Address' will record the visitor's IP and 'Generic' will record 'Visitor' in the DB

    Record form load
    Record loading of the page in form view (as well as submitting of form)
    -------------------------------------------------------------------------------------------
    Send Email
    Send an email with the log summary
    Email To
    Comma separated list of email addresses (no spaces!), may use Placeholders
    Email Subject
    The subject line for email may use Placeholders.
Back
Top