內容簡介
只需在方框內放置某些 SQL,並將其保存為報告。您可以保存多個報告,它們將列在管理選單中,因此您隨時可以輕鬆地點擊運行它們。您可以根據角色將報告放在用戶的儀表板上。您還可以使用縮短代碼(shortcode)[SQLREPORT name=”My Report” style=”padding: 6px;” /] 在頁面或帖子上放置報告。
還有 wpdb::get_var 函數的縮短代碼,您可以使用它顯示來自數據庫的單個值。例如,這將顯示您網站上的用戶數:
[sqlgetvar]SELECT COUNT(*) FROM wp_users[/sqlgetvar]
注意:由於 WordPress 縮短代碼功能中已知的漏洞,需要管理使用者使用完全匹配的查詢創建 SQL 報告,否則任何訂閱者都可以撰寫自己的縮短代碼查詢。
如果您想在頁面或帖子上包含「導出 CSV」按鈕,那麼只需在任何包含您想讓訪問者下載報告的頁面或帖子上使用其他縮短代碼 [SQLEXPORTCSV]。感謝 @loristictok 和 @rob66bnu 發布的建議及 JavaScript,它們用於製作這個新縮短代碼。
注意:僅在此添加縮短代碼就會在頁面上每個 HTML 表格的頂部插入「導出 CSV」按鈕。
自動數據庫備份
您的數據庫可以每小時和/或每天自動保存和存檔,並可以將備份發送到指定的地址。您還可以將數據恢復到您的 WP DB 或外部 DB,這使得將數據庫複製到另一個服務器變得容易。
外掛標籤
開發者團隊
② 後台搜尋「EZ SQL Reports Shortcode Widget and DB Backup」→ 直接安裝(推薦)
📦 歷史版本下載
原文外掛簡介
Just place some SQL on in the box and save it as a report. You can save multiple reports and they will be listed on the Admin Menu so you can quickly run them again anytime with just one click. You can place your reports on the User’s Dashboard based on Roles. You can also put a report on a Page or Post using a shortcode like [SQLREPORT name=”My Report” style=”padding: 6px;” /]
There is also an shortcode for the wpdb::get_var function that you can use to display a single value from your database. For example, this will display the number of users on your site:
[sqlgetvar]SELECT COUNT(*) FROM wp_users[/sqlgetvar]
Note: because of a known exploit in the WordPress shortcode functionality it is required that an admin user create an SQL Report with the exact query that will be used in the sqlgetvar shotcode, otherwise any subscriber could white their own shortcode query.
If you want to include an “Export to CSV” button on your page or post then use the additional shortcode [SQLEXPORTCSV] once on any page or post that contains a report you want visitors to be able to download. Thanks to @loristictok and @rob66bnu for posting the suggestion with the JavaScript that I used to make this new Shortcode.
Note: Adding this shortcode to the just one time will insert the “Export to CSV” button at the top of every HTML Table on the page.
Automatic Database Backups
Your database can be automatically saved and archived every hour and/or every day, and backups can be emailed to the address you specify. You can also restore the data to your WP DB or an external DB, which makes copying your database to another server and easy task.
