Skip to content

Add filters for customizing Imagify promotion notice#29

Draft
pratikrm wants to merge 1 commit intowp-media:trunkfrom
pratikrm:rank-math/filters
Draft

Add filters for customizing Imagify promotion notice#29
pratikrm wants to merge 1 commit intowp-media:trunkfrom
pratikrm:rank-math/filters

Conversation

@pratikrm
Copy link
Copy Markdown
Collaborator

Description

Introduces new filters to allow third parties to customize the Imagify partner ID and the promotion notice text. Also adds a filter to control asset enqueuing on admin pages. Updates JS and PHP to use the filtered notice text, improving extensibility and localization.

Introduces new filters to allow third parties to customize the Imagify partner ID and the promotion notice text. Also adds a filter to control asset enqueuing on admin pages. Updates JS and PHP to use the filtered notice text, improving extensibility and localization.
Comment on lines +390 to +392
// Allow host plugin to define the Imagify partner ID.
$partner = apply_filters( 'wpmedia/plugin_family/imagify_partner', '%imagifypartnerid%' );
$this->set_imagify_partner( $partner );
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We already cater for dynamic partner ID, you only need to add imagify_partner to your extra option in composer.json. During installation of the package, composer will take care of this and automatically pick the ID from your composer.json and replace the wildcard with it. you should also configure your plugin_domain as well
Screenshot 2025-09-01 at 08 50 59

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Thanks @jeawhanlee

I'll make this change in the plugin. Still we'll need to add some hook when plugin is being installed because we also want to add tracking event.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Hi @jeawhanlee

I added imagify_partner in composer.json file, but that is not working on my setup. Upon installing the plugin, the %imagifypartnerid% is stored in the imagifyp_id . Here is the composer.json file from my setup:
composer.json

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

For that to work, you'll need to use a post-install-cmd and post-update-cmd, majorly to perform the same operations for both composer install & update. We do that here for WPR

Comment thread src/Controller/PluginFamily.php
Comment thread src/View/promote-imagify-uploader.php
@pratikrm pratikrm marked this pull request as draft September 10, 2025 07:08
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