Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it possible to check if a custom optional permission was accepted. #657

Open
kofimokome opened this issue Aug 31, 2023 · 0 comments
Open

Comments

@kofimokome
Copy link

kofimokome commented Aug 31, 2023

馃殌 feature request

Description

I recently added a custom optional permission to the opt-in screen.

function add_collectspam_permission( $permissions ) {
		$permissions['collectspam'] = array(
			'icon-class' => 'dashicons dashicons-cloud-upload',
			'label'      => kmcf7ms_fs()->get_text_inline( 'Collect Spam Info', 'collectspam' ),
			'desc'       => kmcf7ms_fs()->get_text_inline( "Collect spam words, spam emails and messages blocked", 'permissions-collectspam' ),
			'priority'   => 16,
			'optional'   => true,
			'default'    => true,
			'tooltip'    => kmcf7ms_fs()->get_text_inline( "We would like to collect only the spam words and emails saved in the plugin settings and only the messages blocked by this plugin on a regular basis", 'permissions-collectspam' ),
		);

		return $permissions;
	}

I want to check if the permission was accepted by the user. Currently, the Freemius class does not provide a method to check if a custom optional permission has been accepted

Describe the solution you'd like

Make it possible to get an instance of the FS_Permission_Manager class from the Freemius class

Describe alternatives you've considered

Manually getting an instance of the FS_Permission_Manager class

$instance = kmcf7ms_fs();
$p=FS_Permission_Manager::instance($instance);
$p->is_permission_allowed('collectspam')

But does not seem to work. It always returns false

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

No branches or pull requests

1 participant