/** * Force 404 error if user or tabs do not exist. * * @since 1.0.0 * @access public * @return void */ function wpaam_profile_force_404_error() { // Bail if not on the profile page if (!is_page(wpaam_get_core_page_id('profile'))) { return; } // Bail if viewing single profile only and not another user profile if (!wpaam_is_single_profile()) { return; } // Trigger if tab is set and does not exist if (wpaam_get_current_profile_tab() !== null && !wpaam_profile_tab_exists(wpaam_get_current_profile_tab())) { wpaam_trigger_404(); } // Trigger if profile is set and does not exist if (wpaam_is_single_profile() && !wpaam_user_exists(wpaam_is_single_profile(), get_option('wpaam_permalink'))) { wpaam_trigger_404(); } }
<?php } ?> </ul> <!-- end tabs --> </div> <div class="wpaam-clearfix"></div> <div class="wpaam-profile-tabs-content"> <?php // Display tabs content. // Check that the tab exists or - null if we're on /profile/ page. if ($current_tab_slug === null || wpaam_profile_tab_exists($current_tab_slug)) { switch ($current_tab_slug) { case null: // Return first tab if null - meaning we're on /profile/ page do_action("wpaam_profile_tab_content_{$all_tabs[0]}", $user_data, $tabs, $current_tab_slug); break; case $current_tab_slug: do_action("wpaam_profile_tab_content_{$current_tab_slug}", $user_data, $tabs, $current_tab_slug); break; } // Display not found error if tab doesn't exist } else { // Display error message $args = array('id' => 'wpaam-not-found', 'type' => 'notice', 'text' => __('Content not found.', 'wpaam')); wpaam_message($args); }