If you are using WordPress to power your website and like to allow users and customers to login to your WordPress with their Freemius credentials, you can use our official Single Sign-On WordPress Plugin.
This plugin bridges the gap between WordPress and the Freemius API. When a user logs in with their Freemius credentials and there is no matching user in WordPress, a new user with the same email address and password will be created in WordPress.
When embedding the User Dashboard on your site using our User Dashboard WordPress plugin, a logged-in user will be automatically logged into their Freemius User Dashboard without the need to log in again. This structure offers a much better user experience to your users.
How to restrict content from non-paying customers?
The SSO (Single Sign-On) plugin comes with several handy methods to easily allow you control the logic according to the user’s state on Freemius.
For example, if you have a contact form page or a forum, which you wish to restrict from users but show it to your customers, you can create a page template that will render different content according to the user’s licenses on Freemius as follows:
<?php /** * Template Name: Support Page Template */ $is_logged_in = false; $has_any_license = false; $has_any_active_license = false; if ( is_user_logged_in() ) { // User currently logged in. $is_logged_in = true; if ( class_exists( 'FS_SSO' ) ) { // Freemius SSO plugin is installed and running. $sso = FS_SSO::instance(); $has_any_license = $sso->get_freemius_has_any_license(); $has_any_active_license = $sso->get_freemius_has_any_active_license(); } } ?> <?php get_header(); ?> <?php if ( ! $is_logged_in ) : ?> <p>Whatever you want to show when the user is not logged in.</p> <?php elseif ( $has_any_license ) : ?> <p>User logged in and has at least one license on Freemius.</p> <?php elseif ( $has_any_active_license ) : ?> <p>User logged in and has at least one ACTIVE license on Freemius.</p> <?php else : ?> <p>Whatever you want to show when the user is logged in but doesn't have any licenses for your product on Freemius.</p> <?php endif; ?> <?php get_footer(); ?>