Users Top Panel

The HJI Users Top Bar

The Top Bar, which contains the Sign In button, Favorited Listings, Saved Searches, and Sign Out button, is extending the existing WordPress Admin bar and replacing the content for the front end user. It does not replace content on admin pages or the site back end.

Initial State -

After User Sign In -

Removing the Top Bar with PHP

It is possible to filter the usage of the admin bar by the Top Bar and prevent it from being rendered to the front end. The  99for the priority is necessary for the removal to override the original filter.

if (!is_admin() & !is_user_logged_in()) {
    add_filter('show_admin_bar', '__return_false', 99);
}

Consequences of Removing the Top Bar

After the Top Bar has been removed, the front end user will lose the ability to easily login, view their saved searches and saved search notifications, view their favorited listings and favorited listing notifications, and will be unable to sign out.

A user can still register/login by clicking the Heart icon on a listing or Saving a Search.

Replacing Functionality

If a developer wishes to move that functionality to another location in the theme, the hooks for those functions are as follows -

// Displays a string before the **Sign In** button.
<?php do_action( 'hjiUserGetSignUpMessage' ); ?> 

// The **Sign In** button to register/login.
<?php do_action( 'hjiUserGetSignUpLink' ); ?> 

// Displays **Welcome {UserName}**.
<?php do_action( 'hjiUserGetWelcomeMessage' ); ?> 

// The Favorited Search link (requires user to be logged in to display).
<?php do_action( 'hjiUserGetFavoritesLink' ); ?> 

// The Saved Searchs link (requires user to be logged in to display).
<?php do_action( 'hjiUserGetSavedSearchesLink' ); ?> 

// The Sign Out link (requires user to be logged in to display).
<?php do_action( 'hjiUserGetLogoutLink' ); ?>

These actions can be placed anywhere in the theme you want to locate the specific markup related to user accounts.

Still need help? Contact Us Contact Us