Introduction
The Pro Reports Extension uses PHP templates that allow you to design and create professional reports with the information you want to show to your clients.
The Pro Reports Extension also allows you to add custom content, including contact info, images, additional text, or any other content you want to include in your report.
Creating a custom report consists of two steps. The first step is to create the actual PHP file representing the template, and the second is to edit and customize that PHP file.
Customizing the template by adding or removing Pro Reports Tokens should be easy and straightforward for most readers. However, advanced customization of the report requires some knowledge of HTML.
Creating a PHP file for the Custom report
We will be using one of the built-in templates as a starting point for the custom report. We will do so by downloading MainWP Pro Reports Extension in ZIP file format and copying one of the PHP template files.
Download the MainWP Pro Reports Extension from your MainWP Account
Extract the plugin files to your computer
Locate one of the default PHP templates in the /mainwp-pro-reports-extension/templates/reports/ directory
Copy a PHP file, rename the file to a new desired title, and use your favorite code editor to make customizations (see the following chapter for instructions on customization)
Once you are finished with the customization and the template is ready, upload the PHP file the /wp-content/uploads/mainwp/report-templates/ directory on your Dashboard site
Once uploaded, the template will be available in the Report template dropdown
How to Use Tokens
Tokens offer an easy way to customize your Pro Report. They can be added directly to the PHP file of your custom report or in the existing Reports through the visual editor on MainWP Dashboard.
The MainWP Client Reports extension uses three different types of tokens:
Client Tokens
Section Tokens
Data Tokens
A list of all available tokens for the Pro Reports extension is available here: Available Pro Reports Tokens
Client Tokens
These tokens will allow you to display data you have set in the Edit tab of the Individual Child site overview. If you plan to use one of the Client tokens in a report for a certain Child site, a value for it must be set.
For example, by setting the value for [client.email], that token can be used in the Send email to field in order to send a report for multiple websites and multiple clients.
You can easily see available Client Tokens and insert them into a field by clicking on the Insert tokens link.
Section Tokens
Section tokens require both opening and closing tags. They can easily be recognized by the starting part section.
For example, [section.plugins.installed] is an Opening tag and [/section.plugins.installed] is a Closing tag for that Section token.
Section token loops through the database and searches for the relevant data during the selected date range.
Example: [section.plugins.installed]
The following code would loop through all selected Child sites and, within the selected Date range, list all instances of plugin installations.
[section.plugins.installed] [plugin.name] [plugin.installed.date] [/section.plugins.installed]
Data Tokens
Data tokens have only one tag; they have to be used inside section tokens and have to be added between an opening and closing tag of a section token.
From the example above for the Section Tokens, the [plugin.name] and [plugin.installed.date] are Data Tokens.
[section.plugins.installed] [plugin.name] [plugin.installed.date] [/section.plugins.installed]
In our help article, you can find all available Data Tokens and the respective Section tokens into which they can be inserted.
Counter Tokens
Counter Tokens are a special type of Data tokens.
You will be able to recognize these tokens by the first word. They end with “.count.” For example [plugin.installed.count]
These tokens won’t work inside of the section tokens. You need to use them outside of section tokens.
Example: [plugin.installed.count]
The counter token will display the number of Installed Plugins, but it must be placed outside of the opening and closing tag of the section token.
[section.plugins.installed] [plugin.name] [plugin.installed.date] [/section.plugins.installed] Total number of plugin installations: [plugin.installed.count]