Create Custom Report Templates

Create a Report Template

To create a custom report template,
  1. Download the MainWP Pro Reports Extension from your MainWP Account
  2. Extract the plugin files to your computer
  3. Locate one of the default report templates in the /mainwp-pro-reports-extension/templates/reports/ directory
  4. Copy the file and use your favorite code editor to make customizations
  5. Once your template is ready, upload the template file to the /wp-content/uploads/mainwp/report-templates/ directory on your Dashboard site. Once uploaded, the template will be available in the Report template selection.

How to Use Tokens

The MainWP Client Reports extension uses three different types of tokens:
  • Client Tokens
  • Section Tokens
  • Data Tokens

Client Tokens

These tokens will allow you to display data you have set in the Child Site edit screen. For each child site, you should set the token values. After you set values, you will easily display data for the selected site in the report.

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] – Opening Tag
[/section.plugins.installed] – Closing Tag
Section token loops through the database and searches for the right data.
Example 1. [section.plugins.installed][/section.plugins.installed] will search for all installed plugins.
Example 2. [section.themes.activated][/section.themes.activated] will search for all activated themes.
Example 3. [section.posts.created][/section.posts.created] will search for all created posts.

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.
Example 1: If you would like to display all installed plugins you would use this token structure:

[section.plugins.installed]
[plugin.name]
[/section.plugins.installed]

Output will be displayed like this:

Akismet
Hello Dolly
(Random plugin names are used in the example above)

Example 2: if you use token structure like this

[section.plugins.installed]
[plugin.name] – [plugin.installed.date]
[/section.plugins.installed]

The output will be

Akismet – 2014–05–30 15:43:11
Hello Dolly – 2014–05–29 12:41:12
A special type of Data token is Counter 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 out of section tokens.
Example 1: [plugin.installed.count] – It will display the number of Installed Plugins
Example 2: [theme.activated.count] – It will display the number of Activated Themes
Example 3: [post.created.count] – It will display the number of Created Posts


Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.