Skip to content

Instantly share code, notes, and snippets.

@alanef
Created February 21, 2023 23:27
Show Gist options
  • Select an option

  • Save alanef/266add376cb7c3bc82477d8e5e22767d to your computer and use it in GitHub Desktop.

Select an option

Save alanef/266add376cb7c3bc82477d8e5e22767d to your computer and use it in GitHub Desktop.
if ( $replace_with_your_freemius_global->can_use_premium_code__premium_only() ) {
// premium code users if they ever had a licence show the contact form
$replace_with_your_freemius_global->add_filter(
'is_submenu_visible',
function ( $is_visible, $menu_id ) {
/** @var \Freemius $replace_with_your_freemius_global Freemius global object. */
global $replace_with_your_freemius_global;
if ( 'contact' === $menu_id ) {
return $replace_with_your_freemius_global->has_any_license();
}
if ( 'support' === $menu_id ) {
return ! $replace_with_your_freemius_global->has_any_license();
}
return $is_visible;
},
10,
2
);
} else {
// free code users if they ever had a licence show only the support link which is the free forum
$replace_with_your_freemius_global->add_filter(
'is_submenu_visible',
function ( $is_visible, $menu_id ) {
if ( 'contact' === $menu_id ) {
return false;
}
if ( 'support' === $menu_id ) {
return true;
}
return $is_visible;
},
10,
2
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment