/** * Include the reset password link template * @param string $label Link text. Default: 'Reset Password' * @param string $classes Classes to add to the <a> tag. Default: 'reset-password' */ function tpl_link_reset_password($label = null, $classes = 'reset-password') { if (is_null($label)) { $label = __('Reset Password', 'theme'); } if (Settings::frontend_login_enabled()) { $url = home_url('reset-password'); } else { $url = wp_lostpassword_url(); } tpl('link', 'reset-password', array('url' => $url, 'label' => $label, 'classes' => $classes)); }
/** * Theme activation * This runs when the theme is activated */ static function _theme_activated() { // Generate & activate the home page if the setting is enabled if (Settings::generate_home_page_enabled()) { self::_generate_home_page(); self::_activate_home_page(); } // Generate a style guide if the setting is enabled if (Settings::generate_style_guide_enabled()) { self::_generate_style_guide(); } // Generate login and reset-password pages if the setting is enabled if (Settings::frontend_login_enabled()) { self::_generate_login_pages(); } }
/** * * Template Redirection * Generic hook for handling various redirections. Do what you will... carefully **/ static function _template_redirect() { /** * If the user is not logged into WP */ if (!is_user_logged_in()) { // If a non logged-in user is trying to access the profile page // redirect them to login if (is_page('profile')) { wp_redirect(home_url('login/restricted/profile')); exit; } if (is_page('reset-password')) { // If no reset stage is explicitly set in the URL // we assume its the request stage if (!get_query_var('reset_stage', 0)) { wp_redirect(home_url('reset-password/request')); exit; // If were at the new-password stage } elseif (get_query_var('reset_stage') == 'new') { // If no activation key or user email are present in the URL // redirect back to the request stage, they need to get a new request email if (!get_query_var('activation_key', 0) || get_query_var('reset_email', 0)) { wp_redirect(home_url('reset-password/request/error/invalid')); exit; } } } /** * If the user is logged in */ } else { $user = wp_get_current_user(); // If someone tries to access the login page, when they are already logged in if (is_page('login')) { // Redirect to their profile, if the front end profile setting is enabled if (Settings::frontend_login_enabled()) { wp_redirect(home_url('profile/loggedin')); exit; // Otherwise redirect to the admin } else { wp_redirect(admin_url()); exit; } } // If registration activation setting is enabled if (Settings::registration_activation_required()) { // If the user isn't activated if (!self::user_activated($user)) { wp_logout(); wp_redirect(home_url('activate/error/inactive')); exit; } } } }
if (Settings::frontend_profile_enabled()) { ?> <li><?php tpl_link_profile(); ?> </li> <?php } ?> <?php } else { ?> <?php if (Settings::frontend_login_enabled()) { ?> <li><?php tpl_link_login(); ?> </li> <?php } ?> <?php if (Settings::frontend_registration_enabled()) { ?> <li><?php tpl_link_register(); ?>
add_action('init', 'tpl_init'); add_action('admin_enqueue_scripts', 'tpl_admin_enqueue_scripts'); /** * Required files */ // Plugin activation class require get_template_directory() . '/includes/plugins/plugins.php'; // Settings class require get_template_directory() . '/classes/settings.class.php'; // Main theme class require get_template_directory() . '/classes/theme.class.php'; // Nav Menu Walkers require get_template_directory() . '/classes/walkers/topbar-walker.class.php'; require get_template_directory() . '/classes/walkers/offcanvas-walker.class.php'; // Member tools class if (Settings::frontend_login_enabled() || Settings::frontend_profile_enabled()) { require get_template_directory() . '/classes/member-tools.class.php'; } /** * Theme has been activated */ function tpl_after_switch_theme() { /** * Set the permalink structure to use postname */ global $wp_rewrite; $wp_rewrite->set_permalink_structure('/%postname%/'); } /** * WP Initialized