Esempio n. 1
0
/**
 * 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();
    }
}
Esempio n. 2
0
		<?php 
}
?>
	</ul>
	<!-- end tabs -->

</div>

<div class="wpum-clearfix"></div>

<div class="wpum-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 || wpum_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("wpum_profile_tab_content_{$all_tabs[0]}", $user_data, $tabs, $current_tab_slug);
            break;
        case $current_tab_slug:
            do_action("wpum_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' => 'wpum-not-found', 'type' => 'notice', 'text' => __('Content not found.', 'wpum'));
    wpum_message($args);
}