Skip to content

[action] [license-activation] Add a new action that is triggered afte… - #828

Merged
swashata merged 1 commit into
developfrom
feature/leo/after-license-activation-action
Oct 28, 2025
Merged

[action] [license-activation] Add a new action that is triggered afte…#828
swashata merged 1 commit into
developfrom
feature/leo/after-license-activation-action

Conversation

@fajardoleo

Copy link
Copy Markdown
Contributor

…r a license activation.

@fajardoleo
fajardoleo requested a review from swashata October 14, 2025 11:05
@fajardoleo fajardoleo self-assigned this Oct 14, 2025
Comment thread includes/class-freemius.php Outdated
$result['next_page'] = $next_page;
}

$this->do_action( 'after_license_activation', ( true === $result['success'] ) );

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about we keep it simple now and just trigger the action if the activation was successful? Like

if ( $result['success'] ) {
    $this->do_action...
}

will that work?

*
* @return bool
*/
protected function _activate_license( $background = false, $premium_license = null ) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fajardoleo how about you revert all these changes (and also line 23080 inside _handle_account_edits()) and at line 21673, before the $premium_license = new FS_Plugin_License( $license ); you fire the action directly?

$this->do_action( 'after_license_activation' );

again we fire it only when the license is actually activated. No need to pass a param suggesting the "status" of it, just to keep things simple and straightforward. (Conceptually one may not trigger an action that happens after license activation if the license wasn't activated to begin with ;) )

Comment thread includes/class-freemius.php Outdated

if ( is_object( $fs ) ) {
$fs->_activate_license();
$result = $fs->_activate_license();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see my suggestion, perhaps we won't be needing this change too.

@fajardoleo
fajardoleo force-pushed the feature/leo/after-license-activation-action branch from 8dfdebf to c162f02 Compare October 23, 2025 13:18
@swashata
swashata merged commit 24d7b27 into develop Oct 28, 2025
5 checks passed
@swashata
swashata deleted the feature/leo/after-license-activation-action branch October 28, 2025 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants