Plugin Update Available?

I am pretty new to MainWp so please pardon my lack of knowledge.
My problem is the following: I wanna send an email to a specific group of my clients, listing available plugin updates including Plugin Name, Current Version and available Version Update. I was hoping to be able to achieve this using Tokens but apparently there isn’t a token for that purpose. Is there another way to inform clients about available plugin updates before I actually update the plugins?
Thanks in advance.

Hi Ulmo,

thanks for reaching out.
Something like this is not possible out of box, but by using the provided hooks and upcoming REST API, something like this could be custom coded.

Hi Bogdan,
thank you for replying.
I was wondering if it might be achieved through editing custom templates in the Pro Reports extension?
So far I was unable to find a guide which is in-depth enough for me to get a grasp on things. Ive read in the Mainwp facebook group that my usecase should be achievable through editing templates, but I lack further information on how-to. The Agency i work for bought the Lifetime package, do you think solving a usecase like this would be possible via a helpdesk ticket?
Any additional information, guides, tutorials would be highly appreciated.
Kind regards.

Hi Ulmo

thanks for getting back to me.

Yes, you could use the Pro Reports system to send this data as a part of reports, but this approach requires making custom tokens for Reports.

To do that, here are the provided hooks:

// Create Custom tokens
add_filter( 'mainwp_pro_reports_tokens_groups', 'mycustom_reports_tokens_groups' );
function mycustom_reports_tokens_groups( $tokens ) {
       // examples
       $tokens['plugins']['sections'][] = array( 'name' => 'section.plugins.custompluginsection', 'desc' => 'Custom plugin section descriptions' );
       $tokens['plugins']['nav_group_tokens']['custompluginsection'] = 'Custom plugin section';
       $tokens['custompluginsection'][] = array( 'name' => 'plugin.custompluginsection.tokenname1', 'desc' => 'Token1 name descriptions' );
       $tokens['custompluginsection'][] = array( 'name' => 'plugin.custompluginsection.tokenname2', 'desc' => 'Token2 name descriptions' );
       return $tokens;


// token values
add_filter('mainwp_pro_reports_custom_tokens', 'mycustom_reports_custom_tokens');
function mycustom_reports_custom_tokens($tokens_values, $report) {
       $tokens_values['[plugin.custompluginsection.tokenname1]'] = 'Value for custom token name1';
       $tokens_values['[plugin.custompluginsection.tokenname2]'] = 'Value for custom token name2';
       return $tokens_values;

Now, you just need to get values for the tokens.

Here is one basic example that shows how you can get an array of all available updates:

$all_updates = array();

$websites = MainWP_DB::instance()->query( MainWP_DB::instance()->get_sql_websites_for_current_user() );

while ( $websites && ( $website  = MainWP_DB::fetch_object( $websites ) ) ) {
	$wp_upgrades                 = json_decode( MainWP_DB::instance()->get_website_option( $website, 'wp_upgrades' ), true );
	$plugin_upgrades             = json_decode( $website->plugin_upgrades, true );
	$theme_upgrades              = json_decode( $website->theme_upgrades, true );
	$translation_upgrades        = json_decode( $website->translation_upgrades, true );
	$all_updates[ $website->id ] = array(
		'wp_core'     => $wp_upgrades,
		'plugins'     => $plugin_upgrades,
		'themes'      => $theme_upgrades,
		'translation' => $translation_upgrades,
MainWP_DB::free_result( $websites );

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.