Custom Login Menu Item Not Working in Pro

Hi-
I had a custom plugin built for me two years ago that creates a login link as well as a user profile menu in the header. It worked well with the latest version of X but it does not work with the new Header builder in Pro. Could someone take a look at the code below and see what I might need to change for it work in Pro? Thank you!

<?php

/*

Plugin Name: Matt User Menu

Plugin URI: http://www.easy-development.com

Description: The User Menu that Matt needed

Version: 1.0

Author: Andrei-Robert Rusu

Author URI: http://www.easy-development.com

*/





class MattUserMenu {



  protected static $_instance;



  public static function getInstance() {

    if(self::$_instance === null)

      self::$_instance = new self();



    return self::$_instance;

  }



  public static function resetInstance() {

    self::$_instance = null;

  }



  public $settingUserPhotoDimension = 42;

  public $settingUserHello          = "Hello %s"; // %s will be replaced by the "user call name"

  /**

   * This is how we address the user, chose from :

   * Username: user_login

   * User first name: user_firstname

   * User last name: user_lastname

   * User display name: display_name

   * @var string

   */

  public $settingUserCallName       = "display_name";



  public function __construct() {

    add_filter('wp_nav_menu_items', array($this, 'wpNavMenuItemsFilter'), 10, 2);

    add_action("init", array($this, "init"));

  }



  public function init() {

    wp_enqueue_style('matt-user-menu', plugins_url( 'matt-user-menu.css', __FILE__));

  }



  public function wpNavMenuItemsFilter($items, $args) {

    if( strpos($args->theme_location, 'primary') === false)

    return $items;



    return is_user_logged_in() ? $this->_navMenuLoggedIn($items, $args) : $this->_navMenuLoggedOut($items, $args);

  }



  private function _navMenuLoggedIn($items, $args) {

    $loginLogoutLink = $this->_getLoginLogoutLink();

    $currentUser     = wp_get_current_user();

    $userCallName    = $this->settingUserCallName;





    $items .= '<li class="component-matt-user-menu user-box ' . strtolower(str_replace(array(" ", ":"), "", wp_get_theme())) . '">';

    $items .=   '<a class="user-box">';

    $items .=     get_avatar( $currentUser->ID, $this->settingUserPhotoDimension );

    $items .=   '</a>';

    $items .=   '<ul>';

    $items .=     '<li class="hello">' . sprintf($this->settingUserHello, $currentUser->$userCallName) . '</li>';

    $items .=     '<li><a href="' . get_site_url() . '/wpufprofile/">Edit Profile</li>';

    $items .=     '<li><a href="http://yciw.sites.noteflight.com/" target="_blank">Noteflight</li>';

	$items .=     '<li><a href="http://community.yciw.net/" target="_blank">Community</li>';

    $items .=     '<li>' . $loginLogoutLink . '</li>';

    $items .=   '</ul>';

    $items .= '</li>';



    return $items;

  }



  private function _navMenuLoggedOut($items, $args) {

    $loginLogoutLink = $this->_getLoginLogoutLink();



    $items .= '<li>'. $loginLogoutLink .'</li>';



    return $items;

  }



  private function _getLoginLogoutLink() {

    ob_start();

    wp_loginout('index.php');

    $loginLink = ob_get_contents();

    ob_end_clean();



    return $loginLink;

  }



}



MattUserMenu::getInstance();

Hi there,

Thanks for writing in! It sounds like you might be having an issue with a third party plugin or script. Regretfully, we cannot provide support for third party plugins or scripts as our support policy in the sidebar states due to the fact that there is simply no way to account for all of the potential variables at play when using another developer’s plugin or script. Because of this, any questions you have regarding setup, integration, or troubleshooting any piece of functionality that is not native to X will need to be directed to the original developer.

Thank you for your understanding.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.