Skip to content

Add ability to add plugins manually #68

@tarecord

Description

@tarecord

Currently, the add_plugin() method sets the current plugin slug and there's no way to override it. We should add a parameter to the method so plugins can override the wp_slug and manually add additional plugins to the opt-in option (stellarwp_telemetry in the options table).

/**
* Adds a plugin slug to the opt-in option array.
*
* @since 1.0.0
*
* @param string $stellar_slug The unique slug identifier for the plugin.
* @param boolean $status The opt-in status for the plugin.
*
* @return boolean
*/
public function add_plugin( string $stellar_slug, bool $status = false ) {
$option = $this->get_option();
$option['plugins'][ $stellar_slug ] = [
'wp_slug' => Config::get_container()->get( Core::PLUGIN_BASENAME ),
'optin' => $status,
];
return update_option( $this->get_option_name(), $option );
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions