Extending UM Theme Header Profile Using Hooks

We created UM Theme so that you don’t have to spend any extra time building and designing a Community website using Ultimate Member plugin.  In UM Theme, you will be able to display the profile of logged in user in the header. Just like popular social media websites like Facebook or Instagram. But some of you may want to customize that to include some personalized text that speaks your voice. Well, keeping that in mind we have created the theme so that it can be easily customizable. But How do you do that without altering the core code and keeping the code secure from future updates. In this tutorial we will see how to display user last login time on top of the Header profile section.

We will be using the hook

um_theme_header_profile_before

to add this extra content. You can get the full list of  UM Theme hooks from here.

<?php
add_action('um_theme_header_profile_before', 'custom_add_last_login_time' );
function custom_add_last_login_time(){
  echo '<div class="small alert alert-light" role="alert">';
  echo "Last Login : ";
  echo um_user_last_login( get_current_user_id() );
  echo '</div>';
}
?>

How it will look on the front end:

NOTE: We have created this code example to provide guidance and to make it easier for you to implement this code into your website. However, we are not able to provide any support when it comes to customizing the theme. If you need help implementing this code, please hire a developer.