Skip to content

Commit

Permalink
Merge pull request #6 from newfold-labs/fix/PRESS8-25
Browse files Browse the repository at this point in the history
Press8-25: Prevent partner activation redirection
  • Loading branch information
wpalani authored Oct 7, 2024
2 parents 701a441 + fc07cfe commit 6004a69
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
3 changes: 3 additions & 0 deletions includes/Partners.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use NewfoldLabs\WP\Module\Activation\Partners\Akismet;
use NewfoldLabs\WP\ModuleLoader\Container;
use NewfoldLabs\WP\Module\Activation\Partners\CreativeMail;
use NewfoldLabs\WP\Module\Activation\Partners\Jetpack;
use NewfoldLabs\WP\Module\Activation\Partners\MonsterInsights;
use NewfoldLabs\WP\Module\Activation\Partners\OptinMonster;
use NewfoldLabs\WP\Module\Activation\Partners\WpForms;
Expand Down Expand Up @@ -44,13 +45,15 @@ public function __construct( Container $container ) {

$akismet = new Akismet();
$creative_mail = new CreativeMail();
$jetpack = new Jetpack();
$monster_insights = new MonsterInsights();
$optin_monster = new OptinMonster();
$wp_forms = new WpForms();
$yoast = new Yoast();

$akismet->init();
$creative_mail->init();
$jetpack->init();
$monster_insights->init();
$optin_monster->init();
$wp_forms->init();
Expand Down
34 changes: 34 additions & 0 deletions includes/Partners/Jetpack.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php
/**
* Jetpack.
*
* @package NewfoldLabs\WP\Module\Activation
*/

namespace NewfoldLabs\WP\Module\Activation\Partners;

/**
* Jetpack class.
*/
class Jetpack extends Partner {

/**
* Initialize.
*
* @return void
*/
public function init() {
add_action( 'admin_init', array( $this, 'disable_redirect' ), 5 ); // Priority 5 to run before Jetpack's own hook.
}

/**
* Disable plugin activation redirect.
*
* @return void
*/
public function disable_redirect() {
if ( get_transient( 'activated_jetpack' ) ) {
delete_transient( 'activated_jetpack' );
}
}
}

0 comments on commit 6004a69

Please sign in to comment.