public static function register() { // require the class for the theme options require_once dirname(__FILE__) . '/lib/options.php'; // get the theme options $options = ltp_options::get_options(); // require the class to log user actions require_once dirname(__FILE__) . '/lib/data.php'; // require the class to change the login function require_once dirname(__FILE__) . '/lib/login.php'; // require the class to provide filters for profile form require_once dirname(__FILE__) . '/lib/filters.php'; // require the class to provide template related stuff require_once dirname(__FILE__) . '/lib/template.php'; // hide admin bar from front end add_filter('show_admin_bar', '__return_false'); // theme installation and updates add_action('init', array(__CLASS__, 'upgrade')); // theme uninstallation add_action('switch_theme', array(__CLASS__, 'uninstall')); // make dasicons available to theme add_action('wp_enqueue_scripts', array(__CLASS__, 'enqueue_scripts')); // force ssl for site if (isset($options["debug_ssl"]) && $options["debug_ssl"]) { add_action('plugins_loaded', array(__CLASS__, 'force_ssl')); } }
<?php $options = ltp_options::get_options(); // redirect to https if (!isset($_SERVER["HTTPS"]) && (isset($options["debug_ssl"]) && intval($options["debug_ssl"]) > 0)) { ltp_redirect_to("invalid-role"); } if (is_user_logged_in()) { if (!ltp_is_admin()) { if (!ltp_is_student() && !ltp_is_wpp()) { ltp_redirect_to("invalid_role"); } elseif (ltp_is_student()) { ltp_redirect_to("builder"); } elseif (ltp_is_wpp()) { ltp_redirect_to("viewer"); } } else { ltp_redirect_to("viewer"); } } else { ltp_redirect_to("login"); }
/** * gets the login page URL */ public static function login_page_url() { $options = ltp_options::get_options(); if (isset($options["login_page_id"]) && !empty($options["login_page_id"])) { return get_permalink($options["login_page_id"]); } else { return false; } }