Beispiel #1
0
/**
 * 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();
    }
}
Beispiel #2
0
<?php

/**
 * wpaam 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 = wpaam_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="wpaam-profile-tabs-holder">

	<!-- Loop through each available tab -->
	<ul class="wpaam-profile-tabs">
		<?php 
foreach ($tabs as $tab) {
    ?>
			<li class="wpaam-tab-<?php 
    echo $tab['id'];
    ?>
 <?php 
    echo $current_tab_slug == $tab['slug'] || $current_tab_slug == null && $all_tabs[0] == $tab['slug'] ? 'active' : '';
    ?>
">