Skip to content

Commit

Permalink
[filters] [pricing-url] Updated the pricing_url filter so that it als…
Browse files Browse the repository at this point in the history
…o updates the pricing/upgrade submenu item's URL.
  • Loading branch information
fajardoleo committed Jul 17, 2024
1 parent 5feee60 commit c17d025
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 15 deletions.
48 changes: 34 additions & 14 deletions includes/class-freemius.php
Original file line number Diff line number Diff line change
Expand Up @@ -19167,18 +19167,34 @@ private function add_submenu_items() {
}
}

// Add upgrade/pricing page.
$this->add_submenu_item(
$pricing_cta_text . '  ' . ( is_rtl() ? $this->get_text_x_inline( '←', 'ASCII arrow left icon', 'symbol_arrow-left' ) : $this->get_text_x_inline( '➤', 'ASCII arrow right icon', 'symbol_arrow-right' ) ),
array( &$this, '_pricing_page_render' ),
$this->get_plugin_name() . ' – ' . $this->get_text_x_inline( 'Pricing', 'noun', 'pricing' ),
'manage_options',
'pricing',
'Freemius::_clean_admin_content_section',
WP_FS__LOWEST_PRIORITY,
( $add_submenu_items && $show_pricing ),
$pricing_class
);
$custom_pricing_url = $this->apply_filters( 'pricing_url', null );
$pricing_menu_title = $pricing_cta_text . '  ' . ( is_rtl() ? $this->get_text_x_inline( '←', 'ASCII arrow left icon', 'symbol_arrow-left' ) : $this->get_text_x_inline( '➤', 'ASCII arrow right icon', 'symbol_arrow-right' ) );
$show_pricing_submenu_item = ( $add_submenu_items && $show_pricing );

// Add upgrade/pricing submenu item.
if ( ! is_null( $custom_pricing_url ) ) {
$this->add_submenu_link_item(
$pricing_menu_title,
$custom_pricing_url,
'pricing',
'manage_options',
WP_FS__LOWEST_PRIORITY,
$show_pricing_submenu_item,
$pricing_class
);
} else {
$this->add_submenu_item(
$pricing_menu_title,
array( &$this, '_pricing_page_render' ),
$this->get_plugin_name() . ' – ' . $this->get_text_x_inline( 'Pricing', 'noun', 'pricing' ),
'manage_options',
'pricing',
'Freemius::_clean_admin_content_section',
WP_FS__LOWEST_PRIORITY,
$show_pricing_submenu_item,
$pricing_class
);
}
}
}

Expand Down Expand Up @@ -19467,14 +19483,16 @@ function add_submenu_item(
* @param string $capability
* @param int $priority
* @param bool $show_submenu
* @param string $class
*/
function add_submenu_link_item(
$menu_title,
$url,
$menu_slug = false,
$capability = 'read',
$priority = WP_FS__DEFAULT_PRIORITY,
$show_submenu = true
$show_submenu = true,
$class = ''
) {
$this->_logger->entrance( 'Title = ' . $menu_title . '; Url = ' . $url );

Expand All @@ -19488,7 +19506,8 @@ function add_submenu_link_item(
$menu_slug,
$capability,
$priority,
$show_submenu
$show_submenu,
$class
);

return;
Expand All @@ -19508,6 +19527,7 @@ function add_submenu_link_item(
'render_function' => 'fs_dummy',
'before_render_function' => '',
'show_submenu' => $show_submenu,
'class' => $class,
);
}

Expand Down
2 changes: 1 addition & 1 deletion start.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
* @var string
*/
$this_sdk_version = '2.7.3.1';
$this_sdk_version = '2.7.3.2';

#region SDK Selection Logic --------------------------------------------------------------------

Expand Down

0 comments on commit c17d025

Please sign in to comment.