/** * Force 404 error if user or tabs do not exist. * * @since 1.0.0 * @access public * @return void */ function wpum_profile_force_404_error() { // Bail if not on the profile page if (!is_page(wpum_get_core_page_id('profile'))) { return; } // Bail if viewing single profile only and not another user profile if (!wpum_is_single_profile()) { return; } // Trigger if tab is set and does not exist if (wpum_get_current_profile_tab() !== null && !wpum_profile_tab_exists(wpum_get_current_profile_tab())) { wpum_trigger_404(); } // Trigger if profile is set and does not exist if (wpum_is_single_profile() && !wpum_user_exists(wpum_is_single_profile(), get_option('wpum_permalink'))) { wpum_trigger_404(); } }
<?php /** * WPUM Template: Profile tabs. * * @package wp-user-manager * @copyright Copyright (c) 2015, Alessandro Tesoro * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License * @since 1.0.0 */ // Get current tab slug $current_tab_slug = wpum_get_current_profile_tab(); // Get keys of the tabs // Needed to show the first tab if on /profile/ $all_tabs = array_keys($tabs); ?> <div class="wpum-profile-tabs-holder"> <!-- Loop through each available tab --> <ul class="wpum-profile-tabs"> <?php foreach ($tabs as $tab) { ?> <li class="wpum-tab-<?php echo $tab['id']; ?> <?php echo $current_tab_slug == $tab['slug'] || $current_tab_slug == null && $all_tabs[0] == $tab['slug'] ? 'active' : ''; ?> ">